Repository navigation
fix/opentelemetry: Fix OpenTelemetry Collector's custom exporters config to expose metrics - #1039
Merged
michaellzc merged 1 commit intoNov 30, 2026
Conversation
…stom exporters The config the chart renders for openTelemetry.gateway.config.traces.exporters left the collector's own metrics on 127.0.0.1:8888, so Prometheus could not scrape them. With the app: otel-collector label on the Service, that failed scrape fires the otel-collector "pods available" critical alert. Add the service.telemetry.metrics.readers block the image's jaeger.yaml has. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a21663-f060-7148-8fdc-8eed219fa092
marcleblanc2
requested review from
michaellzc
and removed request for
michaellzc
November 27, 2026 20:20
michaellzc
approved these changes
Nov 30, 2026
marcleblanc2
added a commit
that referenced
this pull request
Dec 1, 2026
…bel from the node-exporter Service (#1040) Stacked on #1039, which merges into #1038 (`michael/opt-in-labels`) ## Context - The old deprecated Kustomize deployment method (sourcegraph/deploy-sourcegraph) labeled each resource with `sourcegraph-resource-requires: cluster-admin | no-cluster-admin` - This chart started as a copy of those manifests - #7 removed the label from all 69 objects in the Helm chart - #194 brought one copy back on the `node-exporter` Service - Nothing in the sourcegraph org selects on it: no selector, script, code, or docs page ## Problem - With #1038, `sourcegraph.serviceLabels` and `nodeExporter.serviceLabels` reach the `node-exporter` Service, and the hard-coded `sourcegraph-resource-requires` line comes after them, so setting that key in either value renders it twice - Helm and kubectl accept it; Kustomize and `kubeconform -strict` reject the duplicate key - #1038's changelog says each key renders once - Customers who have previously deployed on the old Kustomize repo may be carrying this label forward with them, which would fail deployment via Kustomize ## Solution - Remove the hard-coded label from the `node-exporter` Service, the last object in this chart that set it - Users who want it set it in `sourcegraph.labels`, `sourcegraph.serviceLabels`, or `nodeExporter.serviceLabels`, and it renders once - `node-exporter` metrics lose the `sourcegraph_resource_requires` label, which no bundled dashboard or alert queries, so their series are replaced once on upgrade ## Testing - Two new tests in `nodeExporter_test.yaml` fail on #1039's head (one with `mapping key "sourcegraph-resource-requires" already defined`) and pass here; `helm unittest` (313 tests, 120 snapshots) and `helm lint` pass - On EKS with #1038's head, the duplicate rendered as described above: client-side and server-side apply accepted it, `kubeconform -strict` and Kustomize did not ## Amp threads - https://ampcode.com/threads/T-01a21663-f060-7148-8fdc-8eed219fa092 ## Changelog Removed the deprecated `sourcegraph-resource-requires: no-cluster-admin` label from the `node-exporter` Service; set it in `sourcegraph.serviceLabels` or `nodeExporter.serviceLabels` if needed to keep it Co-authored-by: Amp <amp@ampcode.com>
2 of 3 tasks
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.
Merge into #1038 (
michael/opt-in-labels), which adds theapp: otel-collectorlabel to the collector's Service, which makes theotel-collector"pods available" critical alert fireThe same fix for the collector's default config is in sourcegraph/sourcegraph#20038, which should merge, and the chart's image tags move past it, before #1038 is released
Context
charts/sourcegraph/templates/otel-collector/otel-collector.ConfigMap.yamlis the collector's config whenopenTelemetry.gateway.config.traces.exportersis setPrometheus copies the
otel-collectorService's labels to the metrics it scrapes, so with sourcegraph: render opt-in labels on every object, each key once #1038'sapplabel, the "pods available" alert,up{app=~".*otel-collector"}, sees the scrape for the first timeProblem
127.0.0.1:8888only, its default since v0.104.0, so Prometheus can't scrape them, and with sourcegraph: render opt-in labels on every object, each key once #1038, the critical alert fires after 15 minuteslogging.yamlopenTelemetry.gateway.config.traces.exporters: the chart's ConfigMapjaeger.enabled: the image'sjaeger.yamlSolution
Add the
service.telemetry.metrics.readersblock the image'sjaeger.yamlalready has to the chart's ConfigMap, so metrics are served on0.0.0.0:8888sourcegraph/sourcegraph#20038 adds the same block to the image's default
logging.yamlTesting
New test in
otelCollectorJaeger_test.yamlfails on sourcegraph: render opt-in labels on every object, each key once #1038's head and passes here;helm unittest(311 tests) andhelm lintpassOn EKS, ran two pods with the
otel-collectorimage, one with the config rendered from sourcegraph: render opt-in labels on every object, each key once #1038's head, one with this branch's, both with adebugexporter. From the Prometheus pod, sent 3 OTLP/HTTP spans to each, then fetched:8888/metricsconfig.yamltelemetryblockreadersblock, nothing else changes:8888/metricsfrom inside the pod:8888/metricsfrom the Prometheus podotelcol_receiver_accepted_spans3openTelemetry.gateway.config.traces.exportersset (debug), behind anopenTelemetry.gateway.commandshell wrapperconnection refusedon 8888, alert pending at once, firing after 15 minutes, emailedlogging.yaml), with the image from sourcegraph/sourcegraph#20038Each alert result above was watched for 17 minutes after the collector pod was ready; the rule's
foris 15 minutesNot tested alongside
prometheus.existingConfigAmp threads
Changelog
Fixed the OpenTelemetry Collector's config for
openTelemetry.gateway.config.traces.exporters, so Prometheus can scrape its metrics again