10000 Add needed parameter (#2236) · pardeep-tm/python-docs-samples@968c992 · GitHub
[go: up one dir, main page]

Skip to content

Commit 968c992

Browse files
authored
Add needed parameter (GoogleCloudPlatform#2236)
The tracer won't always send traces unless a sampler is specified. This one sends every trace.
1 parent e126767 commit 968c992

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

trace/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ def initialize_tracer(project_id):
2828
exporter = stackdriver_exporter.StackdriverExporter(
2929
project_id=project_id
3030
)
31-
tracer = opencensus.trace.tracer.Tracer(exporter=exporter)
31+
tracer = opencensus.trace.tracer.Tracer(
32+
exporter=exporter,
33+
sampler=opencensus.trace.tracer.samplers.AlwaysOnSampler()
34+
)
3235

3336
return tracer
3437
# [END trace_setup_python_configure]

0 commit comments

Comments
 (0)
0