Skip to content

Commit d72f606

Browse files
authored
Update adk sample to use --otel_to_cloud instead of custom main.py (#446)
1 parent 6886ff7 commit d72f606

File tree

7 files changed

+1914
-1345
lines changed

7 files changed

+1914
-1345
lines changed

samples/adk-sql-agent/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ Configure the environment and run the sample:
3535
python -m venv venv/
3636
source venv/bin/activate
3737
pip install -r requirements.txt
38-
env $(cat opentelemetry.env | xargs) python main.py
38+
env $(cat opentelemetry.env | xargs) adk web --otel_to_cloud
3939
```
4040

4141
Alternatively if you have [`uv`](https://docs.astral.sh/uv/) installed:
4242

4343
```sh
44-
uv run --env-file opentelemetry.env main.py
44+
uv run --env-file opentelemetry.env adk web --otel_to_cloud
4545
```
4646

4747
## Viewing the results

samples/adk-sql-agent/main.py

Lines changed: 0 additions & 134 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
OTEL_SERVICE_NAME=adk-sql-agent
12
OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
23
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true
4+
5+
# Prevent ADK instrumentation from overwhelming span attribute limits. This will be the default in the future.
6+
ADK_CAPTURE_MESSAGE_CONTENT_IN_SPANS=false

samples/adk-sql-agent/pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@ description = "An ADK agent that can run queries on an ephemeral SQLite database
1919
readme = "README.md"
2020
requires-python = ">=3.12"
2121
dependencies = [
22-
"google-adk>=1.6.1",
22+
"google-adk>=1.17.0",
2323
"opentelemetry-exporter-gcp-logging>=1.9.0a0",
2424
"opentelemetry-exporter-gcp-monitoring>=1.9.0a0",
2525
"opentelemetry-exporter-otlp-proto-grpc>=1.33.0",
26-
"opentelemetry-instrumentation-google-genai>=0.2b0",
27-
"opentelemetry-instrumentation-httpx>=0.54b0",
28-
"opentelemetry-instrumentation-requests>=0.54b0",
26+
"opentelemetry-instrumentation-google-genai>=0.4b0",
2927
"opentelemetry-instrumentation-sqlite3>=0.54b0",
3028
"opentelemetry-instrumentation-vertexai>=2.0b0",
3129
]

0 commit comments

Comments
 (0)