Skip to content

feat(profiling): register llm.agent.phase slot and add phase set/clear API#11529

Draft
jbachorik wants to merge 1 commit into
jb/llm-ddt-1-configfrom
jb/llm-ddt-2-profiler
Draft

feat(profiling): register llm.agent.phase slot and add phase set/clear API#11529
jbachorik wants to merge 1 commit into
jb/llm-ddt-1-configfrom
jb/llm-ddt-2-profiler

Conversation

@jbachorik
Copy link
Copy Markdown
Contributor

@jbachorik jbachorik commented Jun 2, 2026

What Does This Do

Registers llm.agent.phase as a context attribute slot in DatadogProfiler at startup (when isLlmPhaseAttributeEnabled is true) and exposes setAgentPhase(String phaseToken) / clearAgentPhase() for use by instrumentation modules.

Motivation

ContextSetter is built once; slots not present at construction time have offset -1 (no-op). This change wires the registration into the existing orderedContextAttributes pipeline, consuming 1 of the 10 available slots. The named API (setAgentPhase/clearAgentPhase) hides the raw offset from instrumentation callers.

Part of PROF-14858. Stacked on #11528 (config flag). Next: [ddt-3-lc4j] (LangChain4j hooks).

Additional Notes

  • llm.agent.phase appears in the profiler start command's attributes= parameter when the feature flag is on.
  • No change to any sampler hot path; slot lookup and registration happen only at profiler startup.

Contributor Checklist

  • Format the title according to the contribution guidelines
  • Assign the type: and (comp: or inst:) labels in addition to any other useful labels
  • Avoid using close, fix, or any linking keywords when referencing an issue
    Use solves instead, and assign the PR milestone to the issue
  • Update the CODEOWNERS file on source file addition, migration, or deletion
  • Update public documentation with any new configuration flags or behaviors
  • Add your completed PR to the merge queue by commenting /merge. You can also:
    • Customize the commit message associated with the merge with /merge --commit-message "..."
    • Remove your PR from the merge queue with /merge -c
    • Skip all merge queue checks with /merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-level
    • Get more information in this doc

Jira ticket: PROF-14862

@datadog-official
Copy link
Copy Markdown
Contributor

datadog-official Bot commented Jun 2, 2026

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 10 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-java | spotless   View in Datadog   GitLab

🔧 Fix in code (Fix with Cursor). Spotless check failed due to format violations in src/main/java/com/datadog/profiling/ddprof/DatadogProfiler.java. Unexpected import changes detected.

Run system tests | main / End-to-end #2 / akka-http 2   View in Datadog   GitHub Actions

🔄 Retry job. This looks flaky and may succeed on retry. Connection to Docker registry failed: request canceled while waiting for connection. Fetch failed after 4 attempts.

Run system tests | main / End-to-end #5 / spring-boot 5   View in Datadog   GitHub Actions

🔄 Retry job. This looks flaky and may succeed on retry. 1 failed test. Assertion Error: Request failed: None. Expected status code 200 but got None instead at tests/ffe/test_dynamic_evaluation.py:237.

View all 10 failed jobs.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: f4b6093 | Docs | Datadog PR Page | Give us feedback!

@PerfectSlayer PerfectSlayer added tag: ai generated Largely based on code generated by an AI or LLM and removed AI labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tag: ai generated Largely based on code generated by an AI or LLM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants