Skip to content

feat: five runtime knobs are named, kept and shipped (ADR 0047) - #80

Merged
kfeofantov merged 1 commit into
mainfrom
docs/what-the-agent-reports
Aug 28, 2026
Merged

kfeofantov merged 1 commit into
mainfrom
docs/what-the-agent-reports

Conversation

@kfeofantov

@kfeofantov kfeofantov commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

GOMAXPROCS unset under a CPU limit is the most common waste in Go on
Kubernetes: the runtime counts the node's cores, not the cgroup's quota, so a
container limited to half a core starts as many scheduler threads as the machine
has CPUs. GOMEMLIMIT unset under a memory limit is the second: the collector
has no idea a ceiling exists, so the container is killed where the GC would have
run. Both are stated only in the environment, which ADR 0046 dropped whole. The
module list can show go.uber.org/automaxprocs is absent — evidence the default
was not fixed, not evidence of what was set instead.

  • GOMAXPROCS, GOGC, GOMEMLIMIT, GODEBUG, GOTRACEBACK, kept at the same
    informer transform. Every other variable is still removed before the object is
    cached, and so are envFrom, args, command.
  • A name is not a promise about the value. One of the five sourced from a
    secretKeyRef or configMapKeyRef is dropped anyway — reading it would be a
    Secret read, which the agent does not do and holds no RBAC for.
  • One read from the container's own limits ships as the field path
    (resource:limits.cpu). That is the canonical way to tie GOMAXPROCS to a
    limit; the spec holds no value until the kubelet resolves it.
  • They ship in workload_metadata as runtime_env. Keeping a field no payload
    carries would be collection without a consumer — the outcome ADR 0046 refuses.

Negative check:

--- FAIL: TestARuntimeKnobIsKeptOnlyWhenItsValueIsNotASecret
    kept [GOGC GOTRACEBACK GOMAXPROCS GOMEMLIMIT], want [GOMAXPROCS GOMEMLIMIT]

The golden covers both forms — an inline value and a downward-API one — and the
sidecar record carries no runtime_env at all, so absence stays absent.

docs/security.md §8 states the list by name and the two exclusions. The ceiling
test caught the growth: §8 went to 296 against a 290 ceiling and was brought back
by shedding a mechanism sentence about ADR 0012 and tightening the ADR 0046
bullet.

go build ./..., go test -race -count=1 ./..., make lint (0 issues),
go vet -tags e2e ./..., gofmt — all green.

🤖 Generated with Claude Code

@kfeofantov kfeofantov changed the title docs: what the agent reports, and the first collection gap it closes (ADR 0047) feat: five runtime knobs are named, kept and shipped (ADR 0047) Aug 28, 2026
ADR 0046 dropped `env` whole, and took GOMAXPROCS and GOMEMLIMIT with it — the
two settings behind the most common waste in Go on Kubernetes, and stated
nowhere else. The module list can show `automaxprocs` is absent; it cannot show
what was set instead.

- GOMAXPROCS, GOGC, GOMEMLIMIT, GODEBUG, GOTRACEBACK are kept at the same
  informer transform. Every other variable is still removed before the object is
  cached, and so are envFrom, args and command.
- A name is not a promise about the value: one of the five sourced from a
  secretKeyRef or configMapKeyRef is dropped anyway.
- One read from the container's own limits — the canonical way to tie GOMAXPROCS
  to a CPU limit — ships as the field path (`resource:limits.cpu`), because the
  spec holds no value until the kubelet resolves it.
- They ship in `workload_metadata` as `runtime_env`. Keeping a field the payloads
  do not carry would be collection without a consumer, which ADR 0046 refuses.

Negative check: keeping the allow-listed names regardless of where the value
comes from fails with `kept [GOGC GOTRACEBACK GOMAXPROCS GOMEMLIMIT], want
[GOMAXPROCS GOMEMLIMIT]`.

Golden updated; §8 stayed at its ceiling by shedding the lines it grew.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@kfeofantov
kfeofantov force-pushed the docs/what-the-agent-reports branch from 7295c11 to 51a8e63 Compare August 28, 2026 15:55
@kfeofantov
kfeofantov merged commit 94f9f64 into main Aug 28, 2026
3 checks passed
@kfeofantov
kfeofantov deleted the docs/what-the-agent-reports branch August 28, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant