You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This allows out-of-process readers like an EBPF profiler on Linux to get information from the tracer such as span and trace ids (and more).
This ALSO adds support for W3C trace flags in more places. This part needs specific review too, but I added it because it's part of these OTEPs to use it.
Platforms
To avoid having significantly different APIs on Linux vs macOS/Windows, this PR implements process and thread contexts on macOS and Windows too. They lack discovery and out-of-process readers: it's just and internal detail and is non-standard. There are still some divergences to make this work (they use different thread local storage mechanisms) but at the high level they are quite similar.
The profiler has been ported to use process and thread contexts when available on all platforms.
Notes
I need help to implement and verify the Windows portion.
Since PHP can have different service, env, version, etc on every request, we do not store these as resource attributes in the process context. Instead they are stored as thread attributes. I've opened a draft PR for our EBPF profiler fork to understand this pattern, and I've verified locally that it works.
❄️ Known flaky: extended heartbeat re-emits configuration, dependencies and integrations() from com.datadog.appsec.php.integration.TelemetryExtendedHeartbeatTests
java.lang.AssertionError: phpredis not emitted via app-started/app-integrations-change; saw: []. Expression: (phpredis in flushed). Values: flushed = []
java.lang.AssertionError: phpredis not emitted via app-started/app-integrations-change; saw: []. Expression: (phpredis in flushed). Values: flushed = []
at org.codehaus.groovy.runtime.InvokerHelper.createAssertError(InvokerHelper.java:416)
at com.datadog.appsec.php.integration.TelemetryExtendedHeartbeatTests.extended heartbeat re-emits configuration, dependencies and integrations(TelemetryExtendedHeartbeatTests.groovy:70)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Not introduced in this PR.
DataDog/apm-reliability/dd-trace-php | Cargo test
DataDog/apm-reliability/dd-trace-php | PHP language tests: [7.1, amd64, nts]
Comparing candidate commit 6d8c87e in PR branch PROF-15487-Implement-OTel-process-and-thread-context-dd-trace-php with baseline commit f068c9e in branch master.
Found 9 performance improvements and 8 performance regressions! Performance is the same for 177 metrics, 0 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 ----------------------------------'
🟩 execution_time [-46.243µs; -34.057µs] or [-11.258%; -8.291%]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This implements OTel process and thread contexts described here:
This allows out-of-process readers like an EBPF profiler on Linux to get information from the tracer such as span and trace ids (and more).
This ALSO adds support for W3C trace flags in more places. This part needs specific review too, but I added it because it's part of these OTEPs to use it.
Platforms
To avoid having significantly different APIs on Linux vs macOS/Windows, this PR implements process and thread contexts on macOS and Windows too. They lack discovery and out-of-process readers: it's just and internal detail and is non-standard. There are still some divergences to make this work (they use different thread local storage mechanisms) but at the high level they are quite similar.
The profiler has been ported to use process and thread contexts when available on all platforms.
Notes
I need help to implement and verify the Windows portion.
Since PHP can have different service, env, version, etc on every request, we do not store these as resource attributes in the process context. Instead they are stored as thread attributes. I've opened a draft PR for our EBPF profiler fork to understand this pattern, and I've verified locally that it works.
Reviewer checklist