-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support verbatim prometheus configurations #4980
Comments
It sounds like this could be a generic feature supported by the collector rather than specific to Prometheus, allowing any section of the config to be extracted to a separate file. Adding support for Prometheus config specifically via a dedicated config field is easier to implement / justify though, as it doesn't affect the rest of the codebase. |
I think having config separated into multiple files would be also beneficial. On Kubernetes configmaps have limit of 4KB, which would also limit maximum size of configuration for OT collector. |
Ran into a similar issue with my prometheus config. Works on prometheus, but didn't work on the opentelemetry-collector. I updated |
I've mailed out this PR #5080, please take a look. |
… referenced file Allows reading Prometheus configurations verbatim from referenced files. This ensures that users can share their Prometheus configuration files as is with Kubernetes, Prometheus etc, without having to sweat with indentation or formatting. While here also fixed fmt.Errorf("...%s", err) calls to instead wrap err so fmt.Errorf("...%w", err) which is the way errors should be propagated. With this change, we can now do ```yaml receivers: prometheus: config_file: "./prom.yaml" ``` where the contents of "prom.yaml" are: ```yaml scrape_configs: - job_name: 'otel-collector' scrape_interval: 5s static_configs: - targets: ['0.0.0.0:8888'] - job_name: k8s kubernetes_sd_configs: - role: pod relabel_configs: - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] regex: "true" action: keep metric_relabel_configs: - source_labels: [__name__] regex: "(request_duration_seconds.*|response_duration_seconds.*)" action: keep ``` Fixes #4980
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping |
This issue has been closed as inactive because it has been stale for 120 days with no activity. |
Is your feature request related to a problem? Please describe.
As a new user, I copied the example configuration for kuberntes from prometheus/prometheus (see my copy here), but it produced errors when trying to scrape my workloads. For example:
Eventually, I found another opentelemetry config, and noticed the double $ before variables, which led me to open-telemetry/opentelemetry-collector#1112. After substituting $$ for $ in this commit, everything worked fine.
I believe being able to reference a verbatim prometheus configuration would make the opentelemetry collector much easier to adopt, as it would more easily enable sharing between the two ecosystems.
Describe the solution you'd like
I'd like to be able to reference an existing prometheus configuration file as an alternative to embedding it in the collector configuration file. Instead of:
I can instead do:
Describe alternatives you've considered
Better documentation around using prometheus configurations. I think this will help, but can only go so far.
cc @nilebox @james-bebbington
The text was updated successfully, but these errors were encountered: