Skip to content

Flag code a change carries into a hotter context, and weight header paths up (AI perf review) - #12902

Draft
dougqh wants to merge 1 commit into
masterfrom
dougqh/perf-review-carried-in-scope
Draft

dougqh wants to merge 1 commit into
masterfrom
dougqh/perf-review-carried-in-scope

Conversation

@dougqh

@dougqh dougqh commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Two amendments to the perf-review skill (SKILL.md and references/checks.md):

  1. Pre-existing code is in scope when the diff changes its execution context. Unchanged lines stay out of scope unless the diff changes what they cost: they now run more often (onto a hotter path, or per-trace to per-span), under a lock they weren't under, on a different thread (background to application thread), or ahead of a new branch or early return that makes them run more often. Such code is flagged as carried in by this change, under the normal confidence and severity rules.
  2. Propagation and header paths are exceptionally hot: findings there move up one severity notch (SEV-3 → SEV-2). This includes the propagation state behind the headers, updated on every trace whether or not a header is written: propagation tags at span start, trace-id formatting, the sampling decision's bookkeeping. Eager work for an optional propagation format (W3C/OTel tracestate, hex ids, string building, extra locks) belongs at inject/export time.

Motivation

Both come from reviewing #12397 (OTel consistent tracestate sampling, shipped in v1.67.0):

  • A blind perf-review of Support OpenTelemetry consistent tracestate sampling #12397 (diff only, no extra context) caught its two structural problems: an eager OtelTraceState per trace, and a new Object() lock on every span's PTags. It missed TagValue.from("-" + samplingMechanism), a per-trace string concatenation that check First PR - Implements the Opentracing API #2 covers. The line predates the PR, but the PR moved it inside its new synchronized block on the sampling path. A context-assisted run did flag it. Rule 1 closes that gap without opening the review up to every pre-existing issue near a diff.
  • Profiling put the sampling decision at ~38 ns per trace (~10% of a bare span on Zulu 17 / M1 Max), much of it propagation bookkeeping (APMLP-2048). Header and propagation handling is among the hottest code in the system. The blind run rated the eager OtelTraceState SEV-3, while the context-assisted run rated it SEV-2. Rule 2 encodes that weighting.

Additional Notes

  • Open question for reviewers: is a flat one-notch bump the right weighting for header and propagation paths, or should it be narrower (e.g. only for per-trace eager work)?
  • Documentation-only change to the skill. Next step: rerun the blind review on Support OpenTelemetry consistent tracestate sampling #12397 with these rules, and check that it now flags the carried-in concatenation without adding noise.

🤖 Generated with Claude Code

…aths up

Two amendments to the perf-review rubric, both from reviewing #12397.

Pre-existing code is in scope when the diff changes its execution
context: it now runs more often, under a new lock, on a different
thread, or ahead of a new branch that makes it run more often. A blind
review of #12397 missed an existing per-trace string concatenation the
PR moved inside a new synchronized block on the sampling path, because
the line itself was unchanged.

Propagation and header paths, and the propagation state updated on
every trace behind them, are exceptionally hot: findings there move up
one severity notch, and eager work for an optional propagation format
belongs at inject/export time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dougqh dougqh added comp: core Tracer core type: documentation tag: performance Performance related changes tag: no release notes Changes to exclude from release notes tag: ai generated Largely based on code generated by an AI or LLM labels Oct 16, 2026
@dd-octo-sts

dd-octo-sts Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 13.93 s 13.92 s [-0.7%; +0.8%] (no difference)
startup:insecure-bank:tracing:Agent 12.83 s 12.93 s [-1.4%; -0.2%] (maybe better)
startup:petclinic:appsec:Agent 17.14 s 17.04 s [-0.3%; +1.4%] (no difference)
startup:petclinic:iast:Agent 16.76 s 16.97 s [-1.9%; -0.6%] (maybe better)
startup:petclinic:profiling:Agent 16.79 s 16.83 s [-1.3%; +0.9%] (no difference)
startup:petclinic:sca:Agent 17.05 s 16.96 s [-0.5%; +1.5%] (no difference)
startup:petclinic:tracing:Agent 16.13 s 16.05 s [-0.4%; +1.4%] (no difference)

Commit: ac0d481d · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: core Tracer core tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes tag: performance Performance related changes type: documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant