Skip to content

Fix instrumenting metric on multi-line expressions - #12928

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
masterfrom
jpbempel/fix-unstrinstrumentable-line-metric
Oct 20, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
masterfrom
jpbempel/fix-unstrinstrumentable-line-metric

Conversation

@jpbempel

@jpbempel jpbempel commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

What Does This Do

On a multi-line expressions, we are now preventing instrumentation of a metric line probe.
Example:

1  var sb = new StringBuilder(
2    getName()
3    )
4    .append("foo")
5    .build();

with computeFrame we are detecting non-empty operand stack which means we are in the middle of an expression or statement. We are throwing an exception an return an ERROR for instrumentation result.

Motivation

Additional Notes

Contributor Checklist

Jira ticket: DEBUG-6361

On a multi-line expressions, we are now preventing instrumentation
of a metric line probe.
Example:
```
1  var sb = new StringBuilder(
2    getName()
3    )
4    .append("foo")
5    .build();
```

with computeFrame we are detecting non-empty operand stack which means
we are in the middle of an expression or statement. We are throwing
an exception an return an ERROR for instrumentation result.
@jpbempel
jpbempel requested a review from a team as a code owner October 19, 2026 12:15
@jpbempel
jpbempel requested review from andreimatei and removed request for a team October 19, 2026 12:15
@jpbempel jpbempel added the comp: debugger Dynamic Instrumentation label Oct 19, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T12:22:24.210756Z e7c9953 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jpbempel jpbempel added the type: bug fix Bug fix label Oct 19, 2026

@datadog-official datadog-official 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.

Bits Code Review: PASS

More details

Static inspection supports rejecting unsafe mid-expression metric probes while preserving the existing catch-handler exception-preservation path. Runtime behavior was not exercised.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit e7c9953

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e7c99533d1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@datadog-official

This comment has been minimized.

@pr-commenter

pr-commenter Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Debugger benchmarks

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
ci_job_date 1792490379 1792490706
end_time 2026-10-20T10:01:10 2026-10-20T10:06:37
git_branch master jpbempel/fix-unstrinstrumentable-line-metric
git_commit_sha 9d9daf9 5dbc4e0
start_time 2026-10-20T09:59:40 2026-10-20T10:05:07
See matching parameters
Baseline Candidate
ci_job_id 2155612753 2155612753
ci_pipeline_id 145966937 145966937
cpu_model Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz
git_commit_date 1792489772 1792489772

Summary

Found 0 performance improvements and 5 performance regressions! Performance is the same for 4 metrics, 6 unstable metrics.

scenario Δ mean agg_http_req_duration_min Δ mean agg_http_req_duration_p50 Δ mean agg_http_req_duration_p75 Δ mean agg_http_req_duration_p99 Δ mean throughput
scenario:loop worse
[+642.068µs; +942.476µs] or [+7.971%; +11.700%]
worse
[+651.825µs; +952.225µs] or [+8.028%; +11.728%]
worse
[+668.163µs; +967.300µs] or [+8.190%; +11.856%]
worse
[+663.967µs; +966.953µs] or [+8.044%; +11.715%]
worse
[-11.665op/s; -7.295op/s] or [-9.624%; -6.018%]
See unchanged results
scenario Δ mean agg_http_req_duration_min Δ mean agg_http_req_duration_p50 Δ mean agg_http_req_duration_p75 Δ mean agg_http_req_duration_p99 Δ mean throughput
scenario:noprobe unstable
[-21.452µs; +24.685µs] or [-6.403%; +7.368%]
unstable
[-33.407µs; +35.718µs] or [-9.061%; +9.688%]
unstable
[-42.081µs; +45.466µs] or [-10.998%; +11.883%]
unstable
[-3.325µs; +193.531µs] or [-0.307%; +17.894%]
same
scenario:basic same same same unstable
[-11.249µs; +241.711µs] or [-1.316%; +28.278%]
unstable
[-185.897op/s; +89.279op/s] or [-8.365%; +4.018%]
Request duration reports for reports
gantt
    title reports - request duration [CI 0.99] : candidate=None, baseline=None
    dateFormat X
    axisFormat %s
section baseline
noprobe (368.675 µs) : 336, 401
.   : milestone, 369,
basic (346.359 µs) : 340, 353
.   : milestone, 346,
loop (8.119 ms) : 8055, 8183
.   : milestone, 8119,
section candidate
noprobe (369.831 µs) : 337, 403
.   : milestone, 370,
basic (350.745 µs) : 343, 358
.   : milestone, 351,
loop (8.921 ms) : 8735, 9108
.   : milestone, 8921,
Loading
  • baseline results
Scenario Request median duration [CI 0.99]
noprobe 368.675 µs [336.162 µs, 401.188 µs]
basic 346.359 µs [340.111 µs, 352.608 µs]
loop 8.119 ms [8.055 ms, 8.183 ms]
  • candidate results
Scenario Request median duration [CI 0.99]
noprobe 369.831 µs [336.72 µs, 402.942 µs]
basic 350.745 µs [343.392 µs, 358.099 µs]
loop 8.921 ms [8.735 ms, 9.108 ms]

@dd-octo-sts

dd-octo-sts Bot commented Oct 19, 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.89 s 13.87 s [-0.7%; +0.9%] (no difference)
startup:insecure-bank:tracing:Agent 12.83 s 12.95 s [-1.8%; -0.1%] (maybe better)
startup:petclinic:appsec:Agent 17.02 s 16.88 s [-0.0%; +1.6%] (no difference)
startup:petclinic:iast:Agent 16.78 s 16.45 s [-2.7%; +6.6%] (no difference)
startup:petclinic:profiling:Agent 16.67 s 16.73 s [-1.3%; +0.5%] (no difference)
startup:petclinic:sca:Agent 17.02 s 16.99 s [-0.6%; +0.9%] (no difference)
startup:petclinic:tracing:Agent 15.59 s 16.27 s [-8.3%; +0.1%] (no difference)

Commit: 5dbc4e00 · 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.

@jpbempel
jpbempel requested a review from dudikeleti October 19, 2026 15:53

@dudikeleti dudikeleti left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Question: could we support count metric probes with no value expression, and only reject metrics that have a value expression? I'm not sure it's worth splitting the code for this, or whether this use case is common enough to justify supporting it.

fix an issue with probe status, use encoded Id instead of raw probe Id
for addDiagnostics
@jpbempel
jpbempel added this pull request to the merge queue Oct 20, 2026
@dd-octo-sts

dd-octo-sts Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-10-20 12:00:48 UTC ℹ️ Start processing command /merge


2026-10-20 12:00:52 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 1h (p90).


2026-10-20 12:22:25 UTC ❌ MergeQueue: The build pipeline contains failing jobs for this merge request

Build pipeline has failing jobs for a75c459:

⚠️ Do NOT retry failed jobs directly (why?).

What to do next?

  • Investigate the failures and when ready, re-add your pull request to the queue!
  • If your PR checks are green, try to rebase/merge. It might be because the CI run is a bit old.
  • Any question, go check the FAQ.
Details

Since those jobs are not marked as being allowed to fail, the pipeline will most likely fail.
Therefore, and to allow other builds to be processed, this merge request has been rejected and the pipeline got canceled.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 20, 2026
@jpbempel

Copy link
Copy Markdown
Member Author

Question: could we support count metric probes with no value expression, and only reject metrics that have a value expression? I'm not sure it's worth splitting the code for this, or whether this use case is common enough to justify supporting it.

not sure to follow. If I have to choose I would do the opposite, keep only value expression because it's more flexible than no value expression.
no value expression means only count++ while with expression you can do count += var1 or count += 10

@jpbempel

Copy link
Copy Markdown
Member Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-10-20 12:38:25 UTC ℹ️ Start processing command /merge


2026-10-20 12:38:29 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 1h (p90).


2026-10-20 13:49:42 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit ef7e5f9 into master Oct 20, 2026
617 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the jpbempel/fix-unstrinstrumentable-line-metric branch October 20, 2026 13:49
@github-actions github-actions Bot added this to the 1.68.0 milestone Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: debugger Dynamic Instrumentation type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants