Skip to content

Activate flag-gated internal job tracing - #4692

Closed
zero51 wants to merge 7 commits into
db/internal-telemetry-bootstrapfrom
db/internal-telemetry
Closed

zero51 wants to merge 7 commits into
db/internal-telemetry-bootstrapfrom
db/internal-telemetry

Conversation

@zero51

@zero51 zero51 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

The goal is to persist Pipelines OpenTelemetry (OTel) traces in ClickHouse for internal use, without relying on organisation tracing configuration or opt-in. Initially, this is limited to Buildkite-only dogfooding. This stack adds the agent-side support, separate from customer tracing.

Stack (land in order): #4693 → #4694 → #4695 → #4692.

Description

This PR connects the internal exporter and private credential handoff from the preceding PRs to job tracing. Customer tracing keeps its existing configuration and exporter.

Advertise support for local-exec agents only. Internal export requires collector settings at registration and internal_tracing: true on the job. Extend the bootstrap scenarios to verify customer-only, internal-only, combined, disabled and failing exports, including both HTTP/2 debug modes.

Context

Part 4/4 of the agent telemetry stack. Supports https://github.com/buildkite/buildkite/pull/39916, following https://github.com/buildkite/buildkite/pull/39878.

Public documentation

Status: not needed: Do not document

Deployment

Land after #4695. The first three PRs can deploy separately without advertising or activating internal tracing. This final PR advertises support; the backend policy still controls export.

Keep PipelinesInternalTelemetry disabled for everyone. This PR does not enable it. With the flag off, no internal spans are exported. Reserved-variable filtering and registration diagnostic protection come from the preceding PRs.

Rollback

Disable the flag and revert this PR if needed. The preceding PRs can remain deployed without activating internal export.

Testing

  • Tests have run locally (with go test ./...). Buildkite employees may check this if the pipeline has run automatically.
  • Code is formatted (with go tool gofumpt -extra -w .).

Locally, complete API, agent, internal/job, CLI and process package race tests pass. All 17 real-bootstrap tracing/failure cases pass with race detection and inherited CI settings. Both HTTP/2 debug modes deliver internal traces over HTTPS/HTTP/1.1 without leaking the internal token; customer traces still use HTTP/2.

Whole-repository compile checks, scoped lint, 12 capability checks and a Windows cross-build pass. The final source and test tree is byte-for-byte unchanged from the previously green CI revision. The full suite was not rerun locally for this stack. Windows runtime, Linux-only /proc assertions and a live collector were not rerun locally.

The test checkbox uses the template's automatic-CI allowance: build 15558.

Disclosures / Credits

Amp wrote the implementation and tests, assisted with review and prepared the stack.

Decode independent internal collector settings and the per-job export decision. Keep registration response credentials out of HTTP diagnostics.

Amp-Thread-ID: T-01a138c5-1e0c-75ab-982c-47b120e66629
Require registration settings and a per-job decision for local-exec agents. Keep internal collector credentials bootstrap-only and export allowlisted spans without reading customer collector settings.

Retain independent batch queues and best-effort bounded internal delivery without changing customer tracing or the existing shutdown policy.

Amp-Thread-ID: T-01a138c5-1e0c-75ab-982c-47b120e66629
@zero51
zero51 requested a review from a team as a code owner November 26, 2026 00:15
@zero51 zero51 added the change Not a new feature, but a user observable non-breaking behavior change. label Nov 26, 2026
@zero51 zero51 self-assigned this Nov 26, 2026

@buildsworth-bk-app buildsworth-bk-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found one blocker in credential isolation. The new internal-collector credential and telemetry trust boundary make this L3; human approval is required.

Want to dig deeper?

Paste this into your agent to explore the findings from this review's Buildkite build:

Download the buildsworth logs from build 58404, then answer my questions about the findings.

Install the reading-buildsworth-logs skill to run this.

About buildsworth

Model: gpt-6.1-sol with xhigh thinking.

How to request a review: Comment @buildsworth-bk review on the PR, or request buildsworth-bk as a reviewer.

Risk labels (how buildsworth classifies risk) — buildsworth classifies risk itself from the diff. The same approval policy applies in every repository:

  • L1 — Low risk (dep bumps, docs/copy, lockfiles, small presentational fixes). buildsworth may approve by default.
  • L2 — Standard risk (new UI, additive API fields, refactors). buildsworth may approve without per-PR permission.
  • L3 — High risk (auth, migrations, payments, secrets, perf-critical pipeline paths). Human approval required; buildsworth never approves.

Comment thread agent/job_runner.go Resolved
zero51 and others added 2 commits November 26, 2026 11:24
Stop ambient artifact-upload and customer-tracing settings from changing the bootstrap tracing scenarios. Keep production environment inheritance and existing assertions unchanged.

Amp-Thread-ID: T-01a138c5-1e0c-75ab-982c-47b120e66629
Linux retains startup environment bytes after os.Unsetenv, so pass internal collector configuration through an inherited pipe consumed before hooks and commands.

Keep the pipe scoped to local Unix execution and retain the Windows transport and disabled-job execution path.

Amp-Thread-ID: https://ampcode.com/threads/T-01a138c5-1e0c-75ab-982c-47b120e66629
Co-authored-by: Amp <amp@ampcode.com>
@buildsworth-bk-app
buildsworth-bk-app Bot dismissed their stale review November 26, 2026 01:31

Superseded by a newer Buildsworth review.

@buildsworth-bk-app buildsworth-bk-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous /proc exposure is fixed. I found a separate credential-isolation blocker in HTTP/2 debug logging.

Want to dig deeper?

Paste this into your agent to explore the findings from this review's Buildkite build:

Download the buildsworth logs from build 58467, then answer my questions about the findings.

Install the reading-buildsworth-logs skill to run this.

Comment thread internal/job/internal_tracing.go Resolved
Disable HTTP/2 only for the internal exporter. Keep HTTPS and customer HTTP/2 support unchanged.

Cover both HTTP/2 debug levels with real-bootstrap TLS regressions that verify credential isolation and delivery to both collectors.

Amp-Thread-ID: https://ampcode.com/threads/T-01a138c5-1e0c-75ab-982c-47b120e66629
@buildsworth-bk-app
buildsworth-bk-app Bot dismissed their stale review November 26, 2026 01:53

Superseded by a newer Buildsworth review.

@buildsworth-bk-app buildsworth-bk-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HTTP/2 credential-isolation blocker is fixed. No new findings in this revision.

Want to dig deeper?

Paste this into your agent to explore the findings from this review's Buildkite build:

Download the buildsworth logs from build 58486, then answer my questions about the findings.

Install the reading-buildsworth-logs skill to run this.

zero51 and others added 2 commits November 26, 2026 13:10
Connect registration settings and the private bootstrap handoff to job tracing. Advertise the capability only on local-exec agents, and require the server's per-job decision.

Extend the transport scenarios into real collector checks for customer-only, internal-only, combined, disabled, failure and HTTP/2 debug cases.

Amp-Thread-ID: https://ampcode.com/threads/T-01a138c5-1e0c-75ab-982c-47b120e66629
Co-authored-by: Amp <amp@ampcode.com>
Preserve the existing PR and review history while making the credential-transport branch its predecessor. The final source and test tree is unchanged.

Amp-Thread-ID: https://ampcode.com/threads/T-01a138c5-1e0c-75ab-982c-47b120e66629
@zero51 zero51 changed the title Add flag-gated internal agent telemetry exports Activate flag-gated internal job tracing Nov 26, 2026
@zero51
zero51 changed the base branch from main to db/internal-telemetry-bootstrap November 26, 2026 02:11
@zero51
zero51 added this pull request to stack #4696 November 26, 2026 02:11
Comment thread clicommand/bootstrap.go

tracingBackend := tracetools.BackendNone
if cfg.OpenTelemetryTracing {
if cfg.OpenTelemetryTracing || cfg.internalTracing {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this set TRACEPARENT on customer jobs which only have internal tracing on? Should we care about that?

@zero51 zero51 closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change Not a new feature, but a user observable non-breaking behavior change. security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants