-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-49382: [Python] Enable OpenTelemetry on PyArrow wheels #49383
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
raulcd
wants to merge
9
commits into
apache:main
Choose a base branch
from
raulcd:GH-49382
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.
+123
−27
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7426f25
GH-49382: [Python] Enable OpenTelemetry on PyArrow wheels
raulcd 8710842
Add ability to easily use Opentelemetry to the middleware Python exam…
raulcd 9ccb832
Enable opentelemetry for macOS wheels
raulcd 8d2daf8
Enable opentelemetry for Windows wheels
raulcd be1de48
Include arrow/util/windows_compatibility.h to fix some Windows compil…
raulcd 2bbd485
Fix linking issue on Windows where we are missing ARROW_EXPORT. acero…
raulcd c76ace6
Add pyarrow.lib.is_opentelemetry_enabled and add info on pa.show_info()
raulcd 73881db
Add test to validate opentelemetry traces are being generated into st…
raulcd 0357767
Fix for some Python versions
raulcd 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,8 @@ | |
| #include "arrow/util/config.h" | ||
|
|
||
| #ifdef ARROW_WITH_OPENTELEMETRY | ||
| // Avoid for example defining max() macro | ||
| # include "arrow/util/windows_compatibility.h" | ||
| # ifdef _MSC_VER | ||
| # pragma warning(push) | ||
| # pragma warning(disable : 4522) | ||
|
|
@@ -123,13 +125,13 @@ struct Scope { | |
| opentelemetry::trace::Scope scope_impl; | ||
| }; | ||
|
|
||
| opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span>& UnwrapSpan( | ||
| ARROW_EXPORT opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span>& UnwrapSpan( | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These symbols seem to be required to be exported for Windows: |
||
| ::arrow::util::tracing::SpanDetails* span); | ||
|
|
||
| const opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span>& UnwrapSpan( | ||
| const ::arrow::util::tracing::SpanDetails* span); | ||
| ARROW_EXPORT const opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span>& | ||
| UnwrapSpan(const ::arrow::util::tracing::SpanDetails* span); | ||
|
|
||
| opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span>& RewrapSpan( | ||
| ARROW_EXPORT opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span>& RewrapSpan( | ||
| ::arrow::util::tracing::SpanDetails* span, | ||
| opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span> ot_span); | ||
|
|
||
|
|
||
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
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.
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.
@lidavidm I am not entirely sure why this is necessary but using the example
middleware.pyenabling otel as updated below with a running server:and client:
I wasn't able to get traces unless I update this to use
arrow::internal::tracing::GetTracer. Example of local traces with the built wheel and this changes:Initially I thought it might be due to the addition of
CMAKE_INTERPROCEDURAL_OPTIMIZATIONto the wheels but I've validated is unrelated.Without this change I haven't been able to get opentelemetry traces using the
flight.TracingServerMiddlewareFactoryThere 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.
Hmm, it's been a while since I've worked with OTel...possibly the OTel trace provider isn't being configured (vs the hardcoded Arrow one)? The Arrow util is about equivalent, but does some static initialization first
Uh oh!
There was an error while loading. Please reload this page.
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.
yeah, that was my feeling too, either not being initialized or something to do with
libarrow.soandlibarrow_flight.soboth linking opentelementry statically and getting their own copy of the static opentelemetry provider that's why I thoughtCMAKE_INTERPROCEDUREAL_OPTIMIZATIONmight be related (but proved it wasn't).The Arrow util one should cross the shared object boundary and use the already initialized one (or initialize it) which I think is correct.
I just wanted to validate the change looks ok to you or whether do you think it would be better to keep investigating and try to configure when calling
MakeTracingServerMiddlewareFactoryinstead of using the one initialized vialibarrow.so?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.
I think this is OK.