@@ -71,7 +71,8 @@ Here's a simple demonstration of Google ADK instrumentation. The demo uses:
7171export DASHSCOPE_API_KEY=your-dashscope-api-key
7272
7373# Enable content capture (optional, for debugging)
74- export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true
74+ export OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental
75+ export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_ONLY
7576
7677# Run with loongsuite instrumentation
7778loongsuite-instrument \
@@ -87,7 +88,8 @@ loongsuite-instrument \
8788export DASHSCOPE_API_KEY=your-dashscope-api-key
8889
8990# Configure OTLP exporter
90- export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true
91+ export OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental
92+ export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_ONLY
9193export OTEL_TRACES_EXPORTER=otlp
9294export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
9395export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
@@ -98,6 +100,51 @@ loongsuite-instrument \
98100 python examples/main.py
99101```
100102
103+ #### Option 3: Local otel-gui smoke scenarios
104+
105+ ` examples/otelgui_smoke.py ` produces real non-streaming, SSE streaming, and
106+ concurrent Google ADK calls for local trace validation.
107+
108+ ``` bash
109+ export DASHSCOPE_API_KEY=your-dashscope-api-key
110+ export OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:5173
111+ export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
112+ export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://127.0.0.1:5173/v1/traces
113+ export OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental
114+ export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_ONLY
115+ export OTEL_SERVICE_NAME=loongsuite-google-adk-smoke
116+ export GOOGLE_ADK_SMOKE_CONFIGURE_OTLP=1
117+ export GOOGLE_ADK_SMOKE_DISABLE_NATIVE_AGENT_SPAN=1
118+
119+ python examples/otelgui_smoke.py --scenario all
120+ ```
121+
122+ ` GOOGLE_ADK_SMOKE_DISABLE_NATIVE_AGENT_SPAN=1 ` uses a private ADK telemetry
123+ monkey-patch during smoke validation to remove ADK's native wrapper span, making
124+ the LoongSuite GenAI span tree easier to inspect in otel-gui. Keep it limited to
125+ local smoke tests because private ADK internals may change.
126+
127+ When using the local ` loongsuite-otelgui-plugin-verify ` helper, select the
128+ GenAI util agent trace explicitly because Google ADK also emits an ` invocation `
129+ trace:
130+
131+ ``` bash
132+ python /path/to/run_loongsuite_plugin_smoke.py \
133+ --repo-root /path/to/loongsuite-python-agent \
134+ --base-url http://127.0.0.1:5173 \
135+ --service-name loongsuite-google-adk-non-stream \
136+ --root-span-contains invoke_agent \
137+ --capture-message-content SPAN_ONLY \
138+ --expect-span-kind AGENT \
139+ --expect-span-kind LLM \
140+ --expect-span-kind TOOL \
141+ --expect-content \
142+ --env GOOGLE_ADK_SMOKE_CONFIGURE_OTLP=1 \
143+ --env GOOGLE_ADK_SMOKE_DISABLE_NATIVE_AGENT_SPAN=1 \
144+ --env OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://127.0.0.1:5173/v1/traces \
145+ --run " python examples/otelgui_smoke.py --scenario non-stream"
146+ ```
147+
101148### Expected Results
102149
103150The instrumentation will generate traces showing the Google ADK operations:
@@ -121,10 +168,11 @@ The instrumentation will generate traces showing the Google ADK operations:
121168 },
122169 "attributes" : {
123170 "gen_ai.operation.name" : " execute_tool" ,
171+ "gen_ai.span.kind" : " TOOL" ,
124172 "gen_ai.tool.name" : " get_current_time" ,
125173 "gen_ai.tool.description" : " xxx" ,
126- "input.value " : " {xxx}" ,
127- "output.value " : " {xxx}"
174+ "gen_ai.tool.call.arguments " : " {xxx}" ,
175+ "gen_ai.tool.call.result " : " {xxx}"
128176 },
129177 "events" : [],
130178 "links" : [],
@@ -148,6 +196,7 @@ The instrumentation will generate traces showing the Google ADK operations:
148196 "kind" : " SpanKind.CLIENT" ,
149197 "attributes" : {
150198 "gen_ai.operation.name" : " chat" ,
199+ "gen_ai.span.kind" : " LLM" ,
151200 "gen_ai.request.model" : " qwen-max" ,
152201 "gen_ai.response.model" : " qwen-max" ,
153202 "gen_ai.usage.input_tokens" : 150 ,
@@ -164,9 +213,10 @@ The instrumentation will generate traces showing the Google ADK operations:
164213 "kind" : " SpanKind.CLIENT" ,
165214 "attributes" : {
166215 "gen_ai.operation.name" : " invoke_agent" ,
216+ "gen_ai.span.kind" : " AGENT" ,
167217 "gen_ai.agent.name" : " ToolAgent" ,
168- "input.value " : " [{\" role\" : \" user\" , \" parts\" : [{\" type\" : \" text\" , \" content\" : \" 现在几点了? \" }]}]" ,
169- "output.value " : " [{\" role\" : \" assistant\" , \" parts\" : [{\" type\" : \" text\" , \" content\" : \" 当前时间是 2025-11-27 14:36:33\" }]}]"
218+ "gen_ai. input.messages " : " [{\" role\" : \" user\" , \" parts\" : [{\" type\" : \" text\" , \" content\" : \" What time is it? \" }]}]" ,
219+ "gen_ai. output.messages " : " [{\" role\" : \" assistant\" , \" parts\" : [{\" type\" : \" text\" , \" content\" : \" The current time is 2025-11-27 14:36:33\" }]}]"
170220 }
171221}
172222```
@@ -183,7 +233,8 @@ The following environment variables can be used to configure the Google ADK inst
183233
184234| Variable | Description | Default |
185235| ----------| -------------| ---------|
186- | ` OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT ` | Capture message content in traces | ` false ` |
236+ | ` OTEL_SEMCONV_STABILITY_OPT_IN ` | Enable latest experimental GenAI semantic conventions | - |
237+ | ` OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT ` | Capture message content in traces (` NO_CONTENT ` , ` SPAN_ONLY ` , ` SPAN_AND_EVENT ` ) | ` NO_CONTENT ` |
187238| ` DASHSCOPE_API_KEY ` | DashScope API key (required for demo) | - |
188239
189240### Programmatic Configuration
0 commit comments