Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Add OpenTelemetry integration#149

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

@sethmaxwl
Copy link

@sethmaxwlsethmaxwl commentedJul 9, 2020
edited by plamut
Loading

Closes#124
Requires.#158.

This PR adds OpenTelemetry tracing to publisher and subscriber clients.
This PR does not interfere with any underlying client functions. OpenTelemetry is an optional dependency that creates a trace that tracks a message from when it is published to when it is received by a subscriber.

Ongoing concerns

  • Adding OpenTelemetry to unit tests as external dependencies.

PR checklist

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

@googlebotgooglebot added the cla: yesThis human has signed the Contributor License Agreement. labelJul 9, 2020
@sethmaxwlsethmaxwl changed the titleAdd OpenTelemetry integrationfeat: Add OpenTelemetry integrationJul 9, 2020
@plamut
Copy link
Contributor

plamut commentedJul 10, 2020
edited
Loading

This requires dropping Python 2 support, right? (#131)

Thesamples PR is more or less ready to be merged (IMO) and we can then make one final Python 2 compatible release, and drop Python 2 support immediately afterwards.

@plamutplamut added the status: blockedResolving the issue is dependent on other work. labelJul 10, 2020
@sethmaxwl
Copy link
Author

This requires dropping Python 2 support, right? (#131)

Yes, OpenTelemetry does not support any Python version before 3.4.

@sethmaxwlsethmaxwlforce-pushed theopentelemetry-integration branch from74bbff1 tod30d4f2CompareJuly 10, 2020 15:09
Copy link
Contributor

@plamutplamut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Disclaimer - I would have to familiarize myself with theopentelemetry library more, thus I primarily focused on the code aspects, and less on the actual semantics. Added suggestions at places where the code could benefit from them.

@sethmaxwlsethmaxwlforce-pushed theopentelemetry-integration branch from54be418 to6ebdf8eCompareJuly 13, 2020 21:32
@sethmaxwl
Copy link
Author

Disclaimer - I would have to familiarize myself with theopentelemetry library more, thus I primarily focused on the code aspects, and less on the actual semantics. Added suggestions at places where the code could benefit from them.

All suggestions have been addressed.

Copy link
Contributor

@plamutplamut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM now, although we might have to do some additional changes once#158 is merged.

If you have time, you might want to rebase your branch onto that PR branch and see if things work there, too.

@sethmaxwlsethmaxwlforce-pushed theopentelemetry-integration branch frome237daf to84b3a12CompareJuly 16, 2020 19:20
trace.set_tracer_provider(TracerProvider())
trace.get_tracer_provider().add_span_processor(
SimpleExportSpanProcessor(CloudTraceSpanExporter())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You should be using aBatchSpanProcessor here.SimpleExportSpanProcessor exports all spans sequentially and will be very slow.

if"googclient_OpenTelemetrySpanContext"inattrs:
_LOGGER.warning(
"googclient_OpenTelemetrySpanContext set on message"
"as an attribute, but will be overridden."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

No space between "message" and "as".

@plamutplamut requested a review fromcguardiaAugust 28, 2020 10:00
@cguardiacguardia added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelAug 31, 2020
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelAug 31, 2020
Copy link
Contributor

@cguardiacguardia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

There are still a couple of suggestions from previous reviews, though they are mostly documentation and log warning formatting issues.

"opentelemetry-api and opentelemetry-instrumentation"
"pip modules. See also"
"https://opentelemetry-python.readthedocs.io/en/stable/getting-started.html"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

There are no spaces at the end of these lines, which will cause words to be displayed together (e.g. couldnot, rather than could not).

"A parent span was provided but it could not be"
"converted into a SpanContext. Ensure that the"
"parent is a mapping with at least a trace_id, span_id"
"and is_remote keys."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Same issue from above, where spaces are missing at the end of the lines.

python.py_samples()

# ----------------------------------------------------------------------------
# Additional unit test dependincies
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Typo: dependencies.

"pip modules. See also"
"https://opentelemetry-python.readthedocs.io/en/stable/getting-started.html"
)
USE_OPENTELEMETRY=False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Just a suggestion: In addition to the import try, wouldn't it be possible to use an environment variable for explicitly disabling opentelemetry? That way the tests below would not need to mess with sys.modules.

Copy link
Contributor

@cguardiacguardia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Seems like lint is not passing, plus there are a few failing tests. Please review.

@plamut
Copy link
Contributor

Side note - before merging this (after releasing a new major version, of course), we must also run a few benchmarks to verify that the tracing does not hinder the performance, especially throughput. Mentioning as a a reminder to ourselves.

@johnbryan
Copy link

Hi all, Seth (author of this PR) finished his Google internship in mid-August so I assume is not actively maintaining this PR now. I would be willing to address the remaining comments here but will not be able to get to it for a couple of weeks. Seth if I'm mistaken and you are indeed still following/working on this let us know, but I assume you have other things to do!

@plamut
Copy link
Contributor

@johnbryan That sounds good, thanks!

No rush, though, as we need too release a new major version first anyway.

johnbryan reacted with thumbs up emoji

@plamutplamut removed the status: blockedResolving the issue is dependent on other work. labelSep 14, 2020
@plamut
Copy link
Contributor

@johnbryan FYI, a new major version has been released, unblocking this PR (which needs an update now, however).

@anguillanneuf
Copy link
Contributor

@johnbryan Will you have a chance to rebase this PR?

@pamarc
Copy link

Hi, any news on this PR? This could be of use :)

CyberHippo, fabito, and bgarcial reacted with rocket emoji

@plamut
Copy link
Contributor

@johnbryan What's the status of this PR, do we have an ETA for bringing it to completion? Thanks in advance!

@plamut
Copy link
Contributor

Just as a quick status update, it is still not clear what exactly do want to be tracked, still awaiting the official specs. We can thus consider this PR blocked until further notice.

@plamutplamut added the status: blockedResolving the issue is dependent on other work. labelAug 4, 2021
@plamutplamut added the do not mergeIndicates a pull request not ready for merge, due to either quality or timing. labelAug 4, 2021
@plamutplamut changed the base branch frommaster tomainAugust 25, 2021 10:18
@plamutplamut requested review froma team ascode ownersAugust 25, 2021 10:18
@plamutplamut changed the base branch frommain tomasterAugust 26, 2021 11:53
@pradnpradn added the release-please:force-runTo run release-please labelMar 9, 2022
@release-pleaserelease-pleasebot removed the release-please:force-runTo run release-please labelMar 9, 2022
@CyberHippo
Copy link

Hi, is there any update/ETA on this PR? :)

@dmallanb
Copy link

dmallanb commentedSep 15, 2023
edited
Loading

This PR has been open a while - any updates as to why it's still blocked?
(EDIT 12/12/23 - have since decided myself it's not a required change and my use case has a workaround)

data=data,ordering_key=ordering_key,attributes=attrs
)
span_name="{} publisher".format(topic)
span_attributes={"data":data.decode()}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

What is the argument for doing this? It seems to me that,best case, it results in the duplication of data in the message. But in theworst case it actually leaks sensitive information into observability stack, just like logging the output of a SQL query would.

tstringer-fn reacted with thumbs up emoji
@mukund-ananthu
Copy link
Contributor

Closing this, since its now done.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

6 more reviewers

@chrisrossichrisrossichrisrossi left review comments

@plamutplamutplamut left review comments

@AndrewAXueAndrewAXueAndrewAXue left review comments

@dmaier-FNdmaier-FNdmaier-FN left review comments

@cguardiacguardiacguardia requested changes

@pedroserrudopedroserrudopedroserrudo approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

@johnbryanjohnbryan

Labels

cla: yesThis human has signed the Contributor License Agreement.do not mergeIndicates a pull request not ready for merge, due to either quality or timing.status: blockedResolving the issue is dependent on other work.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

PubSub add OpenTelemetry support

17 participants

@sethmaxwl@plamut@johnbryan@anguillanneuf@pamarc@CyberHippo@dmallanb@mukund-ananthu@chrisrossi@cguardia@pedroserrudo@AndrewAXue@dmaier-FN@pradn@googlebot@busunkim96@yoshi-kokoro

[8]ページ先頭

©2009-2025 Movatter.jp