Repository navigation
fix/otel-collector: Scrape the collector's own metrics, and restart it on config changes - #1030
Open
marcleblanc2 wants to merge 6 commits into
Open
marcleblanc2 wants to merge 6 commits into
marcleblanc2 wants to merge 6 commits into
Conversation
This was referenced Nov 24, 2026
marcleblanc2
force-pushed
the
marc/otel-collector-metrics
branch
from
November 24, 2026 22:58
49f22a6 to
f82f082
Compare
marcleblanc2
changed the base branch from
marc/labels-every-object
to
marc/executor-k8s-remove-debug-port
November 24, 2026 22:58
The otel-collector Service had no app label, unlike every other scraped
Service, so its metrics had no app and job labels and the dashboard's
up{app=~".*otel-collector"} panel and alert had no data.
Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1effc-8aa2-756b-b724-e1218ffff085
The image's logging.yaml, and the ConfigMap the chart renders for custom exporters, left the collector's metrics on 127.0.0.1:8888, where Prometheus cannot scrape them. With the app label the Service gained, up was 0 and the pods available alert fired instead of showing no data. Pass the telemetry readers setting as a second --config to the default command, and add it to the rendered ConfigMap. jaeger.yaml already has it. Amp-Thread-ID: https://ampcode.com/threads/T-c7c725c9-ed68-48e2-9f2d-0b8c31e76050 Co-authored-by: Amp <amp@ampcode.com>
…rics to be scraped openTelemetry.gateway.command replaces the default command, so it does not get the argument that serves the collector's metrics on all interfaces. Amp-Thread-ID: https://ampcode.com/threads/T-c7c725c9-ed68-48e2-9f2d-0b8c31e76050 Co-authored-by: Amp <amp@ampcode.com>
The setting that serves the collector's own metrics on all interfaces was part of the default command, so a command set in `openTelemetry.gateway.command` did not get it, and Prometheus could not scrape the collector. It is now always the last container argument, after `openTelemetry.gateway.args`, so a replacement command gets it too. Last, so that it is `$0` of a `sh -c` command whose script is the first argument. Amp-Thread-ID: https://ampcode.com/threads/T-01a1cc03-93a7-7445-8f1f-3dd7123272bf Co-authored-by: Amp <amp@ampcode.com>
The collector does not reload a changed ConfigMap by itself, so a change to openTelemetry.gateway.config.traces took effect only at the pod's next restart. The pod template now has a checksum/otel-collector-config annotation over those values, which are all the ConfigMap's data is rendered from. It is set only when the chart renders the ConfigMap, so the default install does not change. Amp-Thread-ID: https://ampcode.com/threads/T-01a1cc03-93a7-7445-8f1f-3dd7123272bf Co-authored-by: Amp <amp@ampcode.com>
…gument on With the script as the first of openTelemetry.gateway.args after command: ["/bin/sh", "-c"], the chart's argument is $0 and "$@" is empty, so a wrapper that passes only "$@" drops it and the collector keeps serving its metrics on 127.0.0.1. Document "$0" "$@" for that form and "$@" for a script in command followed by a placeholder, and use the first in the test. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1902b-ece9-725c-863d-3e2bba35ee1d
marcleblanc2
force-pushed
the
marc/otel-collector-metrics
branch
from
November 25, 2026 03:13
f82f082 to
ae63325
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The OpenTelemetry Collector dashboard's "pods available" panel has no data, so the alerts can't fire
The
otel-collectorService has noapplabel, unlike every other scraped Service, so its metrics have noapporjoblabelWith that label added, the target is down and the alert fires: the collector serves its own metrics on
127.0.0.1only, unlessjaeger.enabledis set, so Prometheus can't scrape themThe collector doesn't restart when
openTelemetry.gateway.config.traceschanges, so a new exporter takes effect only at the next pod restartSolution
The
otel-collectorService getsapp: otel-collectorThe chart always passes the collector one last argument, after
openTelemetry.gateway.args, that serves its metrics on all interfaces, port 8888. It's an argument, not part of the default command, so a customopenTelemetry.gateway.commandgets it tooThe chart-rendered collector ConfigMap, used with
openTelemetry.gateway.config.traces.exporters, gets the same settingNew
checksum/otel-collector-configpod annotation restarts the collector when its ConfigMap changes. It's set only when the chart renders that ConfigMap, so the default install doesn't changeTested
Deployed on my test instance:
The
otel-collectorService gainedapp: otel-collector, and the Deployment gained the--configargumentPrometheus scrapes
otel-collectorwith healthup, through a customopenTelemetry.gateway.command, which passes"$@"The
otel-collectortargets went from down to up, and the "pods available" alert from firing to inactiveNew and updated tests in
otelCollectorJaeger_test.yaml,command_test.yaml, andallObjectLabels_test.yamlhelm unittest,helm lint, and helm-docs passAmp threads
Changelog
Fixed the OpenTelemetry Collector "pods available" panel and alert having no data
otel-collectorrestarts whenopenTelemetry.gateway.config.traceschangesA custom
openTelemetry.gateway.commandmust pass the chart's last argument on to the collector