Skip to content

Commit

Permalink
add tracing to server
Browse files Browse the repository at this point in the history
  • Loading branch information
rick-c-goog committed Jul 21, 2021
1 parent 9671ecf commit 114ba20
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"configurations": [
{
"name": "Kubernetes: Run/Debug",
"type": "cloudcode.kubernetes",
"request": "launch",
"skaffoldConfig": "${workspaceFolder}/step2/skaffold.yaml",
"watch": true,
"cleanUp": true,
"portForward": true,
"imageRegistry": "gcr.io/rick-chen-demo1"
}
]
}
2 changes: 1 addition & 1 deletion step2/src/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ class UnexpectedResultError(Exception):
# NOTE: SimpleSpanProcessor is for debugging use in general.
# we use it here for a demonstration purpose.
exporter = CloudTraceSpanExporter()
trace.set_tracer_provider(TracerProvider())
trace.get_tracer_provider().add_span_processor(SimpleSpanProcessor(exporter))
propagate.set_global_textmap(CloudTraceFormatPropagator())
trace.set_tracer_provider(TracerProvider())


@app.route("/")
Expand Down
2 changes: 1 addition & 1 deletion step2/src/loadgen/loadgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ def main():
target = os.environ.get("CLIENT_ADDR", "0.0.0.0:8080")

exporter = CloudTraceSpanExporter()
trace.set_tracer_provider(TracerProvider())
trace.get_tracer_provider().add_span_processor(
SimpleSpanProcessor(exporter)
)
tracer = trace.get_tracer(__name__)
propagate.set_global_textmap(CloudTraceFormatPropagator())
trace.set_tracer_provider(TracerProvider())

# connectivity check to client service
healthz = f"http://{target}/_healthz"
Expand Down

0 comments on commit 114ba20

Please sign in to comment.