From 634b20d0d268ac99bc9c031b3e91dd7411cbd4dd Mon Sep 17 00:00:00 2001 From: Filip Haftek Date: Thu, 16 Jul 2026 11:13:20 +0200 Subject: [PATCH 1/3] featuer(otel-collector): ordered processors list) --- charts/sourcegraph/README.md | 1 + .../otel-collector.ConfigMap.yaml | 6 ++ .../tests/otelCollectorProcessors_test.yaml | 72 +++++++++++++++++++ charts/sourcegraph/values.yaml | 4 ++ 4 files changed, 83 insertions(+) create mode 100644 charts/sourcegraph/tests/otelCollectorProcessors_test.yaml diff --git a/charts/sourcegraph/README.md b/charts/sourcegraph/README.md index e0dcc76f..7e6e23ee 100644 --- a/charts/sourcegraph/README.md +++ b/charts/sourcegraph/README.md @@ -227,6 +227,7 @@ In addition to the documented values, all services also support the following va | openTelemetry.enabled | bool | `true` | | | openTelemetry.gateway.config.traces.exporters | object | `{}` | Define where traces should be exported to. Read how to configure different backends in the [OpenTelemetry documentation](https://opentelemetry.io/docs/collector/configuration/#exporters) | | openTelemetry.gateway.config.traces.exportersTlsSecretName | string | `""` | Define the name of a preexisting secret containing TLS certificates for exporters, which will be mounted under "/tls". Read more about TLS configuration of exporters in the [OpenTelemetry Collector documentation](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configtls/README.md) | +| openTelemetry.gateway.config.traces.processorOrderedList | list | `[]` | Define the order in which trace processors run in the pipeline. When set, this takes precedence over the iteration order of `processors` (which cannot be relied on to preserve insertion order). Must contain exactly the same processor names as the keys of `processors`. | | openTelemetry.gateway.config.traces.processors | object | `{}` | Define trace processors. Read how to configure sampling in the [OpenTelemetry documentation](https://docs.sourcegraph.com/admin/observability/opentelemetry#sampling-traces) | | openTelemetry.gateway.containerSecurityContext.allowPrivilegeEscalation | bool | `false` | | | openTelemetry.gateway.containerSecurityContext.runAsGroup | int | `101` | | diff --git a/charts/sourcegraph/templates/otel-collector/otel-collector.ConfigMap.yaml b/charts/sourcegraph/templates/otel-collector/otel-collector.ConfigMap.yaml index 4a42db65..a1140960 100644 --- a/charts/sourcegraph/templates/otel-collector/otel-collector.ConfigMap.yaml +++ b/charts/sourcegraph/templates/otel-collector/otel-collector.ConfigMap.yaml @@ -44,9 +44,15 @@ data: - otlp {{- if .Values.openTelemetry.gateway.config.traces.processors }} processors: + {{- if .Values.openTelemetry.gateway.config.traces.processorOrderedList }} + {{- range .Values.openTelemetry.gateway.config.traces.processorOrderedList }} + - {{ . }} + {{- end }} + {{- else }} {{- range $key, $val := .Values.openTelemetry.gateway.config.traces.processors }} - {{ $key }} {{- end }} + {{- end }} {{- end }} exporters: {{- range $key, $val := .Values.openTelemetry.gateway.config.traces.exporters }} diff --git a/charts/sourcegraph/tests/otelCollectorProcessors_test.yaml b/charts/sourcegraph/tests/otelCollectorProcessors_test.yaml new file mode 100644 index 00000000..500bd3bf --- /dev/null +++ b/charts/sourcegraph/tests/otelCollectorProcessors_test.yaml @@ -0,0 +1,72 @@ +--- +suite: otelCollectorProcessors +templates: + - otel-collector/otel-collector.ConfigMap.yaml +set: + openTelemetry: + gateway: + config: + traces: + exporters: + otlp: + endpoint: "otlp.service.com:443" +tests: + - it: should not render a processors section when none are configured + asserts: + - notMatchRegex: + path: data["config.yaml"] + pattern: "processors:" + - it: should order pipeline processors by map key when processorOrderedList is not set + set: + openTelemetry: + gateway: + config: + traces: + processors: + memory_limiter: + check_interval: 1s + batch: + timeout: 1s + asserts: + - matchRegex: + path: data["config.yaml"] + pattern: "processors:\\s*\\n\\s*- batch\\s*\\n\\s*- memory_limiter" + - it: should order pipeline processors using processorOrderedList when set + set: + openTelemetry: + gateway: + config: + traces: + processors: + memory_limiter: + check_interval: 1s + batch: + timeout: 1s + processorOrderedList: + - memory_limiter + - batch + asserts: + - matchRegex: + path: data["config.yaml"] + pattern: "processors:\\s*\\n\\s*- memory_limiter\\s*\\n\\s*- batch" + - it: should still define processor configs regardless of ordering source + set: + openTelemetry: + gateway: + config: + traces: + processors: + memory_limiter: + check_interval: 1s + batch: + timeout: 1s + processorOrderedList: + - memory_limiter + - batch + asserts: + - matchRegex: + path: data["config.yaml"] + pattern: "check_interval: 1s" + - matchRegex: + path: data["config.yaml"] + pattern: "timeout: 1s" diff --git a/charts/sourcegraph/values.yaml b/charts/sourcegraph/values.yaml index 55cebae9..895af675 100644 --- a/charts/sourcegraph/values.yaml +++ b/charts/sourcegraph/values.yaml @@ -665,6 +665,10 @@ openTelemetry: # -- Define trace processors. # Read how to configure sampling in the [OpenTelemetry documentation](https://docs.sourcegraph.com/admin/observability/opentelemetry#sampling-traces) processors: {} + # -- Define the order in which trace processors run in the pipeline. When set, this takes + # precedence over the iteration order of `processors` (which cannot be relied on to preserve + # insertion order). Must contain exactly the same processor names as the keys of `processors`. + processorOrderedList: [] # -- Define where traces should be exported to. # Read how to configure different backends in the [OpenTelemetry documentation](https://opentelemetry.io/docs/collector/configuration/#exporters) exporters: {} From a8a18eb4784920ecb2680e73790bd2a916ba9906 Mon Sep 17 00:00:00 2001 From: Filip Haftek Date: Mon, 20 Jul 2026 16:50:04 +0200 Subject: [PATCH 2/3] refactor --- charts/sourcegraph/README.md | 2 +- .../otel-collector/otel-collector.ConfigMap.yaml | 4 ++-- .../sourcegraph/tests/otelCollectorProcessors_test.yaml | 8 ++++---- charts/sourcegraph/values.yaml | 9 +++++---- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/charts/sourcegraph/README.md b/charts/sourcegraph/README.md index 7e6e23ee..5cec4933 100644 --- a/charts/sourcegraph/README.md +++ b/charts/sourcegraph/README.md @@ -227,8 +227,8 @@ In addition to the documented values, all services also support the following va | openTelemetry.enabled | bool | `true` | | | openTelemetry.gateway.config.traces.exporters | object | `{}` | Define where traces should be exported to. Read how to configure different backends in the [OpenTelemetry documentation](https://opentelemetry.io/docs/collector/configuration/#exporters) | | openTelemetry.gateway.config.traces.exportersTlsSecretName | string | `""` | Define the name of a preexisting secret containing TLS certificates for exporters, which will be mounted under "/tls". Read more about TLS configuration of exporters in the [OpenTelemetry Collector documentation](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configtls/README.md) | -| openTelemetry.gateway.config.traces.processorOrderedList | list | `[]` | Define the order in which trace processors run in the pipeline. When set, this takes precedence over the iteration order of `processors` (which cannot be relied on to preserve insertion order). Must contain exactly the same processor names as the keys of `processors`. | | openTelemetry.gateway.config.traces.processors | object | `{}` | Define trace processors. Read how to configure sampling in the [OpenTelemetry documentation](https://docs.sourcegraph.com/admin/observability/opentelemetry#sampling-traces) | +| openTelemetry.gateway.config.traces.tracePipelineProcessors | list | `[]` | Define the order in which processors are applied in the traces pipeline. When set, this takes precedence over the iteration order of `processors` (which cannot be relied on to preserve insertion order). Must contain exactly the same processor names as the keys of `processors`. | | openTelemetry.gateway.containerSecurityContext.allowPrivilegeEscalation | bool | `false` | | | openTelemetry.gateway.containerSecurityContext.runAsGroup | int | `101` | | | openTelemetry.gateway.containerSecurityContext.runAsUser | int | `100` | | diff --git a/charts/sourcegraph/templates/otel-collector/otel-collector.ConfigMap.yaml b/charts/sourcegraph/templates/otel-collector/otel-collector.ConfigMap.yaml index a1140960..b236ee0b 100644 --- a/charts/sourcegraph/templates/otel-collector/otel-collector.ConfigMap.yaml +++ b/charts/sourcegraph/templates/otel-collector/otel-collector.ConfigMap.yaml @@ -44,8 +44,8 @@ data: - otlp {{- if .Values.openTelemetry.gateway.config.traces.processors }} processors: - {{- if .Values.openTelemetry.gateway.config.traces.processorOrderedList }} - {{- range .Values.openTelemetry.gateway.config.traces.processorOrderedList }} + {{- if .Values.openTelemetry.gateway.config.traces.tracePipelineProcessors }} + {{- range .Values.openTelemetry.gateway.config.traces.tracePipelineProcessors }} - {{ . }} {{- end }} {{- else }} diff --git a/charts/sourcegraph/tests/otelCollectorProcessors_test.yaml b/charts/sourcegraph/tests/otelCollectorProcessors_test.yaml index 500bd3bf..da0c1191 100644 --- a/charts/sourcegraph/tests/otelCollectorProcessors_test.yaml +++ b/charts/sourcegraph/tests/otelCollectorProcessors_test.yaml @@ -16,7 +16,7 @@ tests: - notMatchRegex: path: data["config.yaml"] pattern: "processors:" - - it: should order pipeline processors by map key when processorOrderedList is not set + - it: should order pipeline processors by map key when tracePipelineProcessors is not set set: openTelemetry: gateway: @@ -31,7 +31,7 @@ tests: - matchRegex: path: data["config.yaml"] pattern: "processors:\\s*\\n\\s*- batch\\s*\\n\\s*- memory_limiter" - - it: should order pipeline processors using processorOrderedList when set + - it: should order pipeline processors using tracePipelineProcessors when set set: openTelemetry: gateway: @@ -42,7 +42,7 @@ tests: check_interval: 1s batch: timeout: 1s - processorOrderedList: + tracePipelineProcessors: - memory_limiter - batch asserts: @@ -60,7 +60,7 @@ tests: check_interval: 1s batch: timeout: 1s - processorOrderedList: + tracePipelineProcessors: - memory_limiter - batch asserts: diff --git a/charts/sourcegraph/values.yaml b/charts/sourcegraph/values.yaml index 895af675..a1c73881 100644 --- a/charts/sourcegraph/values.yaml +++ b/charts/sourcegraph/values.yaml @@ -665,10 +665,11 @@ openTelemetry: # -- Define trace processors. # Read how to configure sampling in the [OpenTelemetry documentation](https://docs.sourcegraph.com/admin/observability/opentelemetry#sampling-traces) processors: {} - # -- Define the order in which trace processors run in the pipeline. When set, this takes - # precedence over the iteration order of `processors` (which cannot be relied on to preserve - # insertion order). Must contain exactly the same processor names as the keys of `processors`. - processorOrderedList: [] + # -- Define the order in which processors are applied in the traces pipeline. When set, this + # takes precedence over the iteration order of `processors` (which cannot be relied on to + # preserve insertion order). Must contain exactly the same processor names as the keys of + # `processors`. + tracePipelineProcessors: [] # -- Define where traces should be exported to. # Read how to configure different backends in the [OpenTelemetry documentation](https://opentelemetry.io/docs/collector/configuration/#exporters) exporters: {} From 6ac6547216dead542b6aa51189278b723aac57b4 Mon Sep 17 00:00:00 2001 From: Filip Haftek Date: Tue, 21 Jul 2026 13:51:00 +0200 Subject: [PATCH 3/3] changelog --- charts/sourcegraph/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/sourcegraph/CHANGELOG.md b/charts/sourcegraph/CHANGELOG.md index d67e9f8c..1da5929d 100644 --- a/charts/sourcegraph/CHANGELOG.md +++ b/charts/sourcegraph/CHANGELOG.md @@ -8,6 +8,7 @@ Use `**BREAKING**:` to denote a breaking change ## Unreleased +- Added support for ordering trace processors via `openTelemetry.gateway.config.traces.tracePipelineProcessors`, falling back to processors ordered by name when unset - Added support for overriding `replicaCount` per dedicated `worker` replica via `worker.replicas[].replicaCount`, falling back to `worker.replicaCount` when unset - Added support for overriding the image repository on a per-service basis via `.image.repository`, falling back to the global `sourcegraph.image.repository` when unset - Added livenessProbe to zoekt-webserver in indexed-search to detect and restart hung pods