diff --git a/charts/sourcegraph/CHANGELOG.md b/charts/sourcegraph/CHANGELOG.md index 27c2bf15..7a804a8f 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 - Removed the unused executor controller `/data` PersistentVolumeClaim from the Kubernetes-native executor chart (`sourcegraph-executor/k8s`), along with the now-orphaned `storageClass` and `executor.storageSize` values and the vestigial `EXECUTOR_KUBERNETES_PERSISTENCE_VOLUME_NAME` env var. Since single-job-pod became the only k8s execution mode, job pods use their own ephemeral `emptyDir` volume and the controller writes nothing to `/data`. - Removed the non-functional `executor.replicas` value from the Kubernetes-native executor chart; the controller is a singleton (it pins Job pods to its own node), so `replicas > 1` never worked. - Added support for overriding `replicaCount` per dedicated `worker` replica via `worker.replicas[].replicaCount`, falling back to `worker.replicaCount` when unset diff --git a/charts/sourcegraph/README.md b/charts/sourcegraph/README.md index e0dcc76f..5cec4933 100644 --- a/charts/sourcegraph/README.md +++ b/charts/sourcegraph/README.md @@ -228,6 +228,7 @@ In addition to the documented values, all services also support the following va | 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.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 4a42db65..b236ee0b 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.tracePipelineProcessors }} + {{- range .Values.openTelemetry.gateway.config.traces.tracePipelineProcessors }} + - {{ . }} + {{- 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..da0c1191 --- /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 tracePipelineProcessors 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 tracePipelineProcessors when set + set: + openTelemetry: + gateway: + config: + traces: + processors: + memory_limiter: + check_interval: 1s + batch: + timeout: 1s + tracePipelineProcessors: + - 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 + tracePipelineProcessors: + - 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..a1c73881 100644 --- a/charts/sourcegraph/values.yaml +++ b/charts/sourcegraph/values.yaml @@ -665,6 +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 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: {}