Skip to content

[PROF-14883] Publish thread context attribute keys at process start#576

Open
ivoanjo wants to merge 1 commit into
mainfrom
ivoanjo/prof-14883-early-thread-context
Open

[PROF-14883] Publish thread context attribute keys at process start#576
ivoanjo wants to merge 1 commit into
mainfrom
ivoanjo/prof-14883-early-thread-context

Conversation

@ivoanjo
Copy link
Copy Markdown
Member

@ivoanjo ivoanjo commented Jun 4, 2026

What does this PR do?

This PR unifies the registerAttributeKeys mechanism used for supporting the "OTel thread context" with setProcessContext so that they get both published together at process start.

Motivation:

Beyond the code simplification (most of this PR is deletes), the big advantage of this approach is that registerAttributeKeys happened at profiler start, and now this is all moved to process start.

This was meh because profiler start is by default delayed (afaik up to 70 seconds in practice) which means that the "thread context" information would be missing for the same period of time, which was super confusing, and would mean an outside reader would be missing this data for that period.

Additional Notes:

This PR will pair with one on the dd-trace-java side to provide the needed info when setting the process context.

How to test the change?

This change includes test coverage + on the dd-trace-java coverage we'll add a few tests too.

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.
  • JIRA: PROF-14883

**What does this PR do?**

This PR unifies the `registerAttributeKeys` mechanism used for
supporting the "OTel thread context" with `setProcessContext` so that
they get both published together at process start.

**Motivation:**

Beyond the code simplification (most of this PR is deletes), the big
advantage of this approach is that `registerAttributeKeys` happened at
profiler start, and now this is all moved to process start.

This was meh because profiler start is by default delayed (afaik up to
70 seconds in practice) which means that the "thread context"
information would be missing for the same period of time, which was
super confusing, and would mean an outside reader would be missing this
data for that period.

**Additional Notes:**

This PR will pair with one on the dd-trace-java side to provide the
needed info when setting the process context.

**How to test the change?**

This change includes test coverage + on the dd-trace-java coverage
we'll add a few tests too.
@ivoanjo ivoanjo requested a review from a team as a code owner June 4, 2026 11:56
Copy link
Copy Markdown

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

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: 5c28a04d41

ℹ️ 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 ddprof-lib/src/main/java/com/datadoghq/profiler/OTelContext.java
Comment thread ddprof-lib/src/main/cpp/profiler.cpp
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented Jun 4, 2026

CI Test Results

Run: #26950190083 | Commit: c97205d | Duration: 12m 53s (longest job)

All 32 test jobs passed

Status Overview

JDK glibc-aarch64/debug glibc-amd64/debug musl-aarch64/debug musl-amd64/debug
8 - - -
8-ibm - - -
8-j9 - -
8-librca - -
8-orcl - - -
11 - - -
11-j9 - -
11-librca - -
17 - -
17-graal - -
17-j9 - -
17-librca - -
21 - -
21-graal - -
21-librca - -
25 - -
25-graal - -
25-librca - -

Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled

Summary: Total: 32 | Passed: 32 | Failed: 0


Updated: 2026-06-04 12:12:50 UTC

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