8000 chore: add google-adk/{version} to bigquery user agent · cloudbuilderspa/adk-python@f9fa784 · GitHub
[go: up one dir, main page]

Skip to content

Commit f9fa784

Browse files
google-genai-botcopybara-github
authored andcommitted
chore: add google-adk/{version} to bigquery user agent
PiperOrigin-RevId: 772703504
1 parent 5f89a46 commit f9fa784

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/google/adk/tools/bigquery/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
from google.cloud import bigquery
1919
from google.oauth2.credentials import Credentials
2020

21-
USER_AGENT = "adk-bigquery-tool"
21+
from ... import version
22+
23+
USER_AGENT = f"adk-bigquery-tool google-adk/{version.__version__}"
2224

2325

2426
def get_bigquery_client(

tests/unittests/tools/bigquery/test_bigquery_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from __future__ import annotations
1515

1616
import os
17+
import re
1718
from unittest import mock
1819

1920
from google.adk.tools.bigquery.client import get_bigquery_client
@@ -122,4 +123,7 @@ def test_bigquery_client_user_agent():
122123
# Verify that the tracking user agent was set
123124
client_info_arg = mock_connection.call_args[1].get("client_info")
124125
assert client_info_arg is not None
125-
assert client_info_arg.user_agent == "adk-bigquery-tool"
126+
assert re.search(
127+
r"adk-bigquery-tool google-adk/([0-9A-Za-z._\-+/]+)",
128+
client_info_arg.user_agent,
129+
)

0 commit comments

Comments
 (0)
0