Skip to content

Commit b4f77d6

Browse files
committed
Add region tags & cleanup sample
1 parent 454662b commit b4f77d6

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

samples/adk-sql-agent/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import logging
1615
import google.auth
1716
import google.auth.transport.requests
1817
import grpc
@@ -97,6 +96,7 @@ def setup_opentelemetry() -> None:
9796

9897
# Load instrumentors
9998
SQLite3Instrumentor().instrument()
99+
# ADK uses Vertex AI and Google Gen AI SDKs.
100100
VertexAIInstrumentor().instrument()
101101
GoogleGenAiSdkInstrumentor().instrument()
102102

samples/adk-sql-agent/sql_agent/agent.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717

1818
import sqlite3
1919

20-
from opentelemetry import trace
21-
22-
# from utils import ask_prompt, console, print_markdown, render_messages
23-
24-
2520
SYSTEM_PROMPT = f"""\
2621
You are a helpful AI assistant with a mastery of database design and querying. You have access
2722
to an ephemeral sqlite3 database that you can query and modify through some tools. Help answer

samples/adk-sql-agent/sql_agent/tools.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class SqlRunResult(TypedDict):
3333
rows: NotRequired[list[tuple[str, ...]]]
3434
"""The rows returned by the SQL query"""
3535

36+
# [START opentelemetry_adk_agent_span]
3637
@tracer.start_as_current_span("create_database")
3738
def create_database_tool(tool_context: ToolContext) -> dict[str, Any]:
3839
"""Creates a temporary file in the /tmp directory to hold an ephemeral
@@ -46,6 +47,7 @@ def create_database_tool(tool_context: ToolContext) -> dict[str, Any]:
4647
tool_context.state[SESSION_DB_KEY] = path
4748
return {"resp": "Created an ephemeral database"}
4849
return {"resp": f"Skipping database creation, {tool_context.state[SESSION_DB_KEY]} already exists"}
50+
# [END opentelemetry_adk_agent_span]
4951

5052
@tracer.start_as_current_span("run_sql")
5153
def run_sql_tool(sql_query: str, tool_context: ToolContext) -> dict[str, Any]:

0 commit comments

Comments
 (0)