Skip to content

Conversation

aphralG
Copy link
Contributor

@aphralG aphralG commented Oct 1, 2025

Proposed changes

This change allows a user to list paths to their own Otel configs, these are then merged with the default Agent collector config. The last config specified takes priority over the rest if they have the same values declared.

collector:
  additional_config_paths:
    - "/configs/my_config.yaml"
    - /etc/nginx-agent/nginx-agent-otelcol.yaml

To make debugging easier the merged OTel config which OTel is running with is outputted to /var/lib/nginx-agent/opentelemetry-collector-agent-debug.yaml

To make modifying the NGINX Receiver and NGINX Plus Receiver easier if there is only one instance running thee instance ID is no longer needed be needed for the name. This will make modifying the collection_interval setting for example using your own OTel config easier as you no longer need the instanceID

  nginx/123456789:
    instance_id: "123"
    api_details:
      url: "http://localhost:80/status"
      listen: ""
      location: ""
      ca: ""
    collection_interval: 30s
    access_logs:
      - log_format: "$remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\" \"$http_x_forwarded_for\"\"$upstream_cache_status\""
        file_path: "/var/log/nginx/access-custom.conf"

will now be

  nginx:
    instance_id: "123456789"
    api_details:
      url: "http://localhost:80/status"
      listen: ""
      location: ""
      ca: ""
    collection_interval: 30s
    access_logs:
      - log_format: "$remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\" \"$http_x_forwarded_for\"\"$upstream_cache_status\""
        file_path: "/var/log/nginx/access-custom.conf"

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@aphralG aphralG self-assigned this Oct 1, 2025
@aphralG aphralG requested a review from a team as a code owner October 1, 2025 16:43
@github-actions github-actions bot added the chore Pull requests for routine tasks label Oct 1, 2025
@aphralG aphralG changed the title Embedded Otel Collector Embedded OTel Collector Config Oct 1, 2025
config_path: "/etc/nginx-agent/nginx-agent-otelcol.yaml"
additional_config_paths:
- "/configs/my_config.yaml"
- /etc/nginx-agent/nginx-agent-otelcol.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be commented?

Suggested change
- /etc/nginx-agent/nginx-agent-otelcol.yaml
- "/etc/nginx-agent/nginx-agent-otelcol.yaml"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's without the quotes because I wanted to check it would work with and without the quotes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for routine tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants