-
Notifications
You must be signed in to change notification settings - Fork 19
feat: Publish OTel process context #324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ivoanjo
wants to merge
19
commits into
main
Choose a base branch
from
ivoanjo/prof-14789-otel-process-ctx
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
0e050b6
Import process context reference implementation
ivoanjo 2db7a35
feat: [PROF-14789] Publish OTel process context
ivoanjo 6813769
Make autoformatter happy
ivoanjo 35bb013
Tweak to make CI happy
ivoanjo 76267e5
Another try at making CI happy
ivoanjo 71d7825
More small tweaks to make CI happy
ivoanjo bcda89d
More CI fixes
ivoanjo 38359e2
More making CI happy
ivoanjo 1690f10
Add links to where `otel_process_ctx.h/.cpp
ivoanjo 4f6916d
Introduce new constant with library name, rather than hardcoding in r…
ivoanjo afddc6d
Minor: Remove redundant includes
ivoanjo 8b9a8a3
Minor: Use references when building up metadata
ivoanjo c191436
Minor: Don't compare unordered maps as it can easily break
ivoanjo 9d050df
Tweak behavior when report_hostname is disabled + add test
ivoanjo ab0b053
Add missing `static` declaration
ivoanjo 2984054
Minor: Fix wording in comment to use infinitive
ivoanjo c561524
Introduce move-only RAII guard and mutex to ensure correctness
ivoanjo 0575cde
Tighten tests for moving the tracer instance
ivoanjo e2ab668
Merge branch 'main' into ivoanjo/prof-14789-otel-process-ctx
ivoanjo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declaring a user-defined destructor suppresses the implicit move constructor and move assignment.
Moreover, the implicit copy is now problematic because it will lead to several calls to
otel_process_ctx_drop_current(). More precisely, the problem is that:otel_process_ctx_publish()is called from the constructor (viastore_config(), line 228);otel_process_ctx_drop_current()is called in then destructor (line 124).They operate on a process-global singleton (
published_stateinotel_process_ctx.cpp). So the destructor's drop is global, and it fires for every Tracer instance destroyed, including copies and temporaries.This notably breaks the implementation of
nginx-datadogthat uses move and return by value on Tracer.I suggest adding a move-only RAII guard, held by a
unique_ptr, so that to transfer the ownership on move. Copy constructor and assignment should be deleted. This is just an idea, maybe a better solution could come from thinking about the whole Otel process context handling.By the way,
TEST_TRACER("move semantics"), line 1885 oftest_tracer.cppis wrong: when the move constructor doesn't exist, it binds to the copy constructor. This test should be fixed!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ughhh thanks for spotting this, my C++-fu is not strong enough to have spotted this one.
In c561524 I've added a guard and a mutex that enforces thread-safe last-writer-wins semantics for the process context.
And in 0575cde I've tightened the "move semantics" test to not surprise us again in the future.