Skip to content

feat(llmobs): add BaseEvaluator support for Experiments - #9848

Merged
mehulsonowal merged 9 commits into
masterfrom
mehul/llmobs-experiments-parity
Oct 1, 2026
Merged

mehulsonowal merged 9 commits into
masterfrom
mehul/llmobs-experiments-parity

Conversation

@mehulsonowal

@mehulsonowal mehulsonowal commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Stack

1 of 2 — base: master. The RemoteEvaluator follow-up is #10487.

What does this PR do?

Adds dd-trace-js LLM Experiments parity features for project configuration and the core class-based evaluator API:

  • Adds llmobs.projectName and DD_LLMOBS_PROJECT_NAME configuration.
  • Supports project overrides for datasets, experiments, and dataset pulls.
  • Adds reusable BaseEvaluator and BaseSummaryEvaluator classes with evaluator contexts; their evaluate() methods may be synchronous or asynchronous.
  • Adds rich EvaluatorResult and MultiEvaluatorResult values.
  • Supports evaluator reasoning, assessment, metadata, and tags on emitted evaluation metrics.
  • Updates TypeScript declarations, documentation examples, tests, and the experiments example.
  • Keeps the existing mlApp/service fallback behavior.

Evaluator scope

This PR intentionally provides the evaluator primitives and result model, not a catalog of evaluator implementations:

  • Included: base row and summary evaluators, contexts, and metadata-capable result types.
  • Deferred: Python-style built-in evaluators, LLMJudge, and structured-output evaluator helpers.
  • Remote managed evaluators are implemented separately in stacked PR feat(llmobs): add remote evaluators #10487.

CSV upload remains out of scope.

Motivation

Bring the JavaScript Experiments API closer to the dd-trace-py LLM Experiments setup while keeping the initial evaluator surface focused on reusable primitives. Applications can implement their own evaluator logic and attach rich metadata to emitted metrics without committing the JavaScript SDK to a built-in evaluator catalog.

Additional Notes

  • Updated with the latest master.
  • Targeted evaluator/facade/SDK tests: 252 passing, 2 pending.
  • Changed-file ESLint passes.
  • Two VCR-backed facade cases require the local replay service at 127.0.0.1:9126 and were excluded from the local run.

@mehulsonowal
mehulsonowal force-pushed the mehul/llmobs-experiments-parity branch from f42f91b to 8649c8f Compare August 18, 2026 17:23
@dd-octo-sts

dd-octo-sts Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 9.34 MB
Deduped: 10.07 MB
No deduping: 10.07 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.5.1 | 127.66 kB | 513.61 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@datadog-official

datadog-official Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Tests

✅ All CI checks and tests passed. Datadog automation helped this PR pass.

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog retried 2 tests - 2 passed on retry View in Datadog

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 98.26% (+0.05%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 5b50359 | Docs | View more details | Give us feedback!

@pr-commenter

pr-commenter Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-10-01 19:26:37

Comparing candidate commit 5b50359 in PR branch mehul/llmobs-experiments-parity with baseline commit 0a5e10c in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2300 metrics, 13 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:debugger-line-probe-with-snapshot-default-20

  • unstable max_rss_usage [-10.442MB; +6.291MB] or [-7.623%; +4.592%]

scenario:debugger-line-probe-without-snapshot-24

  • unstable cpu_user_time [-627.758ms; +1101.614ms] or [-7.043%; +12.360%]
  • unstable execution_time [-632.791ms; +1116.232ms] or [-6.308%; +11.128%]
  • unstable throughput [-114.327op/s; +64.170op/s] or [-10.058%; +5.646%]

scenario:dogstatsd-aggregated-26

  • unstable cpu_user_time [-99.170ms; +155.352ms] or [-6.049%; +9.476%]
  • unstable execution_time [-97.509ms; +157.171ms] or [-5.892%; +9.496%]
  • unstable throughput [-1023662.969op/s; +639168.505op/s] or [-6.991%; +4.365%]

scenario:encoders-0.4-immediate-flush-20

  • unstable max_rss_usage [-1.333MB; +10.532MB] or [-1.614%; +12.758%]

scenario:plugin-aws-sdk-eventbridge-inject-detail-26

  • unstable execution_time [-174.457ms; +294.372ms] or [-4.377%; +7.385%]
  • unstable throughput [-102032.801op/s; +60474.161op/s] or [-6.753%; +4.003%]

scenario:plugin-graphql-long-with-depth-off-26

  • unstable max_rss_usage [-30.673MB; +17.981MB] or [-11.901%; +6.976%]

scenario:plugin-graphql-long-with-depth-on-max-26

  • unstable max_rss_usage [-5.964MB; +21.295MB] or [-2.314%; +8.261%]

scenario:plugin-mongodb-core-binary-hash-24

  • unstable execution_time [-150.909ms; +171.517ms] or [-5.094%; +5.789%]

@codecov

codecov Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.85%. Comparing base (0a5e10c) to head (5b50359).
⚠️ Report is 30 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9848      +/-   ##
==========================================
+ Coverage   98.78%   98.85%   +0.06%     
==========================================
  Files        1042     1048       +6     
  Lines      167109   169089    +1980     
  Branches       74       74              
==========================================
+ Hits       165081   167146    +2065     
+ Misses       2028     1943      -85     
Flag Coverage Δ
ai-guard 63.93% <31.61%> (+0.40%) ⬆️
apm-capabilities 54.90% <31.61%> (+0.06%) ⬆️
apm-integrations 81.17% <31.61%> (-0.09%) ⬇️
appsec 57.94% <31.61%> (+<0.01%) ⬆️
debugger 69.59% <31.61%> (-0.34%) ⬇️
instrumentation 55.41% <31.61%> (+0.18%) ⬆️
llmobs 80.57% <100.00%> (+0.39%) ⬆️
master-coverage 98.85% <100.00%> (?)
openfeature 65.87% <31.61%> (-0.19%) ⬇️
platform 68.72% <31.61%> (-0.04%) ⬇️
profiling 66.15% <31.61%> (-0.26%) ⬇️
serverless 65.71% <31.61%> (+0.51%) ⬆️
test-optimization 82.00% <31.61%> (-0.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…ments-parity

# Conflicts:
#	index.d.ts
#	index.d.v5.ts
#	packages/dd-trace/src/config/generated-config-types.d.ts
#	packages/dd-trace/src/config/index.js
#	packages/dd-trace/src/config/supported-configurations.json
#	packages/dd-trace/src/llmobs/experiments/experiment.js
#	packages/dd-trace/src/llmobs/experiments/index.js
#	packages/dd-trace/src/llmobs/noop.js
#	packages/dd-trace/src/llmobs/sdk.js
#	packages/dd-trace/test/config/index.spec.js
#	packages/dd-trace/test/llmobs/experiments/example.js
#	packages/dd-trace/test/llmobs/experiments/index.spec.js
#	packages/dd-trace/test/llmobs/sdk/index.spec.js
@mehulsonowal
mehulsonowal force-pushed the mehul/llmobs-experiments-parity branch from 87f7e44 to da49206 Compare September 28, 2026 19:03
@mehulsonowal mehulsonowal changed the title feat(llmobs): add experiments project and evaluator parity feat(llmobs): add BaseEvaluator support for Experiments Sep 29, 2026
@mehulsonowal
mehulsonowal marked this pull request as ready for review September 29, 2026 15:24
@mehulsonowal
mehulsonowal requested review from a team as code owners September 29, 2026 15:24
@mehulsonowal
mehulsonowal requested review from khanayan123 and tlhunter and removed request for a team September 29, 2026 15:24

@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: da49206da1

ℹ️ 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".

Comment thread packages/dd-trace/src/llmobs/experiments/experiment.js
Comment thread packages/dd-trace/src/llmobs/experiments/experiment.js
Comment thread packages/dd-trace/src/llmobs/experiments/experiment.js
Comment thread index.d.ts

@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: 9bfdf6c977

ℹ️ 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".

Comment thread index.d.ts
Comment thread index.d.ts
Comment thread packages/dd-trace/src/llmobs/experiments/experiment.js

@sabrenner sabrenner left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

just one small nit, and i think some of the codex comments probs need addressing, but otherwise lgtm! approving to unblock once codex comments are addressed

Comment thread packages/dd-trace/src/llmobs/experiments/experiment.js
Comment thread packages/dd-trace/src/llmobs/experiments/experiment.js Outdated

@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: 6faeb6f120

ℹ️ 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".

Comment thread packages/dd-trace/src/llmobs/experiments/experiment.js
Comment thread packages/dd-trace/src/llmobs/experiments/experiment.js
Comment thread packages/dd-trace/src/llmobs/noop.js
Comment thread packages/dd-trace/src/llmobs/experiments/evaluator.js Outdated
@mehulsonowal
mehulsonowal merged commit 1d0b8c3 into master Oct 1, 2026
678 checks passed
@mehulsonowal
mehulsonowal deleted the mehul/llmobs-experiments-parity branch October 1, 2026 21:41
This was referenced Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants