Integrate dd-win-prof profiling feature into dd-sdk-cpp#185
Conversation
- CMake: DD_ENABLE_PROFILER option, FetchContent for dd-win-prof - Public API: Profiling::Register() following Rum/Logging patterns - RUM context: RumContextSnapshot + callback wiring to dd-win-prof - Stub UploadThread_PrepareReport (dd-win-prof uploads independently) Inspired from @aforsythe 's branch & co-authored using claude-4.6
|
✅ Code Quality ✅ Code Vulnerabilities ✅ Library Vulnerabilities ✅ Secrets 🎉 All green!🛠️ No new code quality issues 🔗 Commit SHA: 23f5263 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
Automatically wire profiling callback if RUM & profiling are active co-authored using claude-4.6
9c24469 to
a1eea38
Compare
| FetchContent_Declare( | ||
| dd-win-prof | ||
| GIT_REPOSITORY https://github.com/DataDog/dd-win-prof.git | ||
| GIT_TAG 74b9c6f |
There was a problem hiding this comment.
this could be a param from CI
There was a problem hiding this comment.
we can add this in later versions
a1eea38 to
18a7494
Compare
|
|
||
| // Wire RUM context changes → profiling: capture a weak_ptr so the callback | ||
| // doesn't extend the profiling feature's lifetime | ||
| std::weak_ptr<Profiling> weak_profiling = profiling_impl; |
There was a problem hiding this comment.
While the direct coupling of these two features isn't the cleanest approach, I think it's fine for now - it's an internal detail that can be changed without much disruption (AFAIK), and this code is only exercised in an opt-in, explicitly-experimental case, so I think it's relatively harmless to leave as-is for this PR.
As of a couple of recently-merged PRs (#180 and #181), the SDK now has a message bus that allows features to receive asynchronous notifications for things like RUM context changes, so the actual design would likely involve implementing MakeMessageHandler for Profiling, returning a function that handles ContextChangedMessage and takes the appropriate action when ctx.rum has changed.
That would obviate the need for SetContextChangeCallback (and direct coupling of features via the Core) entirely; but it's not pressing for this PR.
- remove interning of profiling config - add more granular change detection on context changes
044e1ed to
c5f59c0
Compare
|
|
||
| Create a `.env` file in this directory (git-ignored): | ||
|
|
||
| ``` |
There was a problem hiding this comment.
for now we have some redundant config
- Skip SetRumSession when session hasn't changed - Skip SetRumView when view hasn't changed - Call ClearRumContext on session end (application_id == Zero) - Cache UUID string representations to avoid repeated allocations Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| // command; write the relevant UUIDs to the global RumFeatureContext, so that | ||
| // other features can enrich their events with RUM data | ||
| ctx.rum = rum->_application_snapshot.ToFeatureContext(); | ||
| const RumFeatureContext new_context = |
There was a problem hiding this comment.
this could be optimized further, for now there would be allocation on large view names
- cleanup const cast - allow restart after stop
| DD_SITE_AP1, | ||
| DD_SITE_AP2, | ||
| DD_SITE_US1_FED, | ||
| DD_SITE_STAGING, |
There was a problem hiding this comment.
I am not sure we want to commit staging as client usable option....
There was a problem hiding this comment.
I'm fine with leaving this out, we still need a good way for us to test, what would be the suggestion ?
There was a problem hiding this comment.
I think I still had issues with getting the data in staging, even with this (the profiling data was fine though).
If you can deliver something that gets the data to staging, I'm happy to remove this part of the code.
There was a problem hiding this comment.
Instead of adding a new site enum and calling config.SetSite(datadog::Site::staging) etc.; I think you could just do config.Internal_UseCustomEndpoint("https://browser-intake-datad0g.com") to circumvent site-based URL resolution entirely. Would that work for your needs?
| #ifdef DD_ENABLE_PROFILER | ||
| #include "datadog/impl/features/profiling/profiling.hpp" |
There was a problem hiding this comment.
I'll let you and Alex hash this out but I'd rather have this be DD_ENABLE_PROFILING only because DD_ENABLE_PROFILER sounds like we'll enabling profiling the SDK, not the enduser's application.
There was a problem hiding this comment.
I agree, simply because we're calling the feature Profiling, so using that name verbatim feels clearer.
|
It's been a while since the original base commit, and since then I've made a bunch of changes in
I didn't want to leave this PR in the lurch, so I made a copy of the branch (as I don't have spare time at the moment to address any of the review notes, check that the smoke test is working, or implement the longer-term fix that's now possible thanks to the addition of a message bus (i.e. updating In the meantime, let know if you'd like me to force-push my rebase back to |
|
As we discussed in Slack: I'll open a new PR with my rebased changes. (It may be a day or two.) |
Description
Inspired from @aforsythe 's branch & co-authored using claude-4.6
Testing
e2e tests are ongoing
leaving as draft until I can add a test for the profiling integration
Follow up
Related PR
dd-win-prof PR