-
Notifications
You must be signed in to change notification settings - Fork 155
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
samples: add OTel Tracing quickstart #1371
base: main
Are you sure you want to change the base?
Conversation
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
|
||
# Configure the sampling rate to control trace ingestion volume. | ||
# Trace sampling rate must be in the range [0.0,1.0]. | ||
tracing_rate = 1.0 |
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.
Is there a rule of thumb for tracing rate?
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.
It truly depends on the user application and how users want to balance cost vs trace volume. For quickstart purposes, I think we want to set to 1.0 to ensure users can see the traces in Cloud Trace console.
|
||
from opentelemetry import trace | ||
from opentelemetry.exporter.cloud_trace import CloudTraceSpanExporter | ||
from opentelemetry.instrumentation.requests import RequestsInstrumentor |
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.
call out that this is optional for requests spans
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.
updated
RequestsInstrumentor().instrument(tracer_provider=tracer_provider) | ||
|
||
# Instantiate a storage client and perform a write and read workload. | ||
storage_client = storage.Client() |
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.
Do you need a parent span that groups the requests being made?
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.
Updated to create a root span that groups all the requests, thanks!
No description provided.