Repository navigation
otel: send traces directly to otel-collector by default - #1031
Closed
marcleblanc2 wants to merge 1 commit into
Closed
marcleblanc2 wants to merge 1 commit into
marcleblanc2 wants to merge 1 commit into
Conversation
Add openTelemetry.agent.enabled (default false) to deploy the otel-agent DaemonSet, and stop rendering the otel-agent ConfigMap without it. Application pods now send traces to the otel-collector Service by default, so tracing no longer needs DaemonSets or hostPorts on every node. openTelemetry.agent.kind is deprecated: kind: DaemonSet still deploys the agent, and kind: Deployment matches the new default. Amp-Thread-ID: https://ampcode.com/threads/T-01a20faa-7870-70ad-b747-bdc5a40a9524 Co-authored-by: Amp <amp@ampcode.com>
Member
|
realistically speaking on-prem customers have their own o11y setup. On Cloud, we still strong prefer the use of otel-agent as DS. for custom use cases, they should opt to setup their own pipeline. |
Contributor
Author
Unfortunately @michaellzc, the bulk of our self-hosted customers hit one speed bump then slash everything they can to shove it through. We have more customers with 0 Observability than any. |
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.
Stop deploying the
otel-agentDaemonSet by default. Application pods send traces straight to theotel-collectorService, like Docker Compose already does. Relates to FE-158 (DaemonSets blocked on shared clusters,hostPortclashes between instances on one cluster).Why the agent isn't needed
otlpexporter out tootel-collector:4317, with a 100-batchsending_queueandretry_on_failure. Thebatchandmemory_limiterprocessors are commented out as a TODO. It adds no processors or node metadata.NewBatchSpanProcessorininternal/tracer/otel.go), and the OTLP exporter retries on its own.selectivesampling, sootel-collector(1 CPU / 1Gi requested) handles direct traffic easily.kind: Deploymentto skip it.Changes
openTelemetry.agent.enabled(defaultfalse) deploys the agent.openTelemetry.agent.kindis deprecated and removed fromvalues.yaml.kind: DaemonSetstill deploys the agent, andkind: Deploymentmatches the new default.otel-agentConfigMap is now gated on the agent too. It was rendered even withkind: Deployment.Upgrade impact
otel-agentDaemonSet and ConfigMap, and pods roll out withOTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317.otel-agentConfigMap fail without the agent. Sourcegraph Cloud does this (controllerinternal/kubernetes/set-otel-agent-config.patch.yaml, and some instances insourcegraph/cloudadd a metrics pipeline to the agent). The controller must setopenTelemetry.agent.enabled: true(orkind: DaemonSet) before Cloud picks up this chart version.otel-collector:4317need a rule.Checklist
Test plan
helm unittest charts/sourcegraph: 264 tests and 120 snapshots pass. The selector label golden snapshots are unchanged; suites that cover every workload enable the agent so they still cover the DaemonSet.helm templatediffs againstmain:agent.enabled: trueandkind: DaemonSetrender byte-for-byte the same as themaindefault.mainwithkind: Deployment, minus the orphanedotel-agentConfigMap.helm lintpasses with and without the agent.m5, a test instance on a shared EKS cluster with other Sourcegraph instances in other namespaces, andrestrictedPod Security enforced. Release rev 94 wasmain(6315f79) withm5's values, andotel-agentwas already broken there: 2 of 3 podsPending(didn't have free ports for the requested pod ports), and the third rejected (violates PodSecurity "restricted:latest": hostPort).openTelemetry.gateway.argsmakes the collector's OTLP receivers listen on0.0.0.0and thedebugexporter log every span. Without them, the image'slogging.yamlreceivers listen on127.0.0.1and no span arrives with either chart. Site config had"observability.tracing": {"sampling": "all"}during each run. Traffic was 5 GraphQL searches, then spans logged by the collector were counted byservice.name.main+ test values: 0 spans reachedm5's collector. App pods sent to$(status.hostIP):4317, and fromsourcegraph-frontend,worker, andsearcherthat port accepted TCP connections on both nodes they ran on, thoughm5had no agent running. The hostPort listeners belong to other instances' agents, som5's traces went into another instance's pipeline. I could not see which, as the test role has no access to the other namespaces.helm upgrade --waitalso failed:DaemonSet/m5/otel-agent not ready ... Current: 2/3.012e869) + test values:helm diffshowed only the expected changes: theotel-agentDaemonSet and ConfigMap removed, andOTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317replacingOTEL_AGENT_HOSTin 8 containers of 7 workloads.helm upgrade --waitsucceeded in 51 s, and all 19 pods wereRunning, nonePending. The collector logged 1079 spans fromfrontend,gitserver,searcher,worker,precise-code-intel-worker, andsyntactic-code-intel-worker, at 3m CPU and 43Mi memory, with 0 errors in its log.indexed-search(zoekt-webserverlogsusing OpenTelemetry tracer); none of the searches may have reached zoekt, and it sent none onmaineither.openTelemetry.agent.enabled: trueandkind: DaemonSet, which render identically tomain(above), and an upgrade with a post-renderer patching theotel-agentConfigMap.m5is restored: rev 98 ishelm rollbackto rev 94 (manifest identical to rev 94), and site config is back to its original contents.