feat: Add OpenTelemetry publish sample#1258
Conversation
|
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
|
🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use -- conventional-commit-lint bot |
2fcd31e to
184b8e5
Compare
samples/snippets/publisher.py
Outdated
| # Choose and configure the exporter for your set up accordingly. | ||
|
|
||
| # Sample 1 in every 1000 traces. | ||
| sampler = ParentBased(root=TraceIdRatioBased(1 / 1000)) |
There was a problem hiding this comment.
Can you sample at 100% to begin with and add a comment to lower the trace in production?
I can imagine customers who use the sample don't see that there are any traces exported and think something is broken.
There was a problem hiding this comment.
I use 1/100 with 10k messages published. That ensures there would be atleast 100 samples exported.
There was a problem hiding this comment.
Done, changed it to 1 based on offline discussion.
samples/snippets/publisher.py
Outdated
| tracer = trace.get_tracer("google.cloud.pubsub_v1.publisher") | ||
| with tracer.start_as_current_span("parent cloud trace span"): |
There was a problem hiding this comment.
I think we should omit this, since it's not necessary to wrap the traces in this way.
There was a problem hiding this comment.
Done. This would mean, there would be no parent trace. But as discussed offline, we are good with this / this is intended.
184b8e5 to
1f7520d
Compare
89db874 to
8b1f369
Compare
4edd561 to
326822f
Compare
326822f to
05ab569
Compare
Fixes #<issue_number_goes_here> 🦕