Skip to content

Commit

Permalink
fix: set attribute before checking
Browse files Browse the repository at this point in the history
  • Loading branch information
emdneto committed May 3, 2024
1 parent 6b80286 commit 9f0af2d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/python/traces/sampling/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

for i in range(10000):
with tracer.start_as_current_span("SamplingSpan") as span:
# Trace flag 0x01 for sampled spans and
# Trace flag will be 0x01 for sampled ones
span.set_attribute("sampler", "traceidratio")
# Check if span is not NonRecordingSpan
if span.is_recording():
span.set_attribute("sampled", "1")
span.set_attribute("sampler", "traceidratio")
print("Doing something with sampled spans")

0 comments on commit 9f0af2d

Please sign in to comment.