Skip to content

Commit 2557aa5

Browse files
authored
fix(ingest/bigquery): Fix bigquery user agent string (#15214)
1 parent 0553f28 commit 2557aa5

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

metadata-ingestion/src/datahub/ingestion/source/bigquery_v2/bigquery_connection.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@
1515

1616

1717
def _get_bigquery_client_info() -> ClientInfo:
18-
"""Get ClientInfo with DataHub user-agent for BigQuery client identification"""
19-
return ClientInfo(user_agent=f"datahub/{__version__}")
18+
"""Get ClientInfo with DataHub user-agent for GCP API identification.
19+
20+
Follows Google's recommended format:
21+
"<prod_name>/ver (GPN:<company name>; <other comments>)"
22+
"""
23+
return ClientInfo(user_agent=f"DataHub/{__version__} (GPN:DataHub)")
2024

2125

2226
class BigQueryConnectionConfig(ConfigModel):
@@ -68,9 +72,15 @@ def make_gcp_logging_client(
6872
client_options = self.extra_client_options.copy()
6973
client_options["_use_grpc"] = False
7074
if project_id is not None:
71-
return GCPLoggingClient(**client_options, project=project_id)
75+
return GCPLoggingClient(
76+
**client_options,
77+
project=project_id,
78+
client_info=_get_bigquery_client_info(),
79+
)
7280
else:
73-
return GCPLoggingClient(**client_options)
81+
return GCPLoggingClient(
82+
**client_options, client_info=_get_bigquery_client_info()
83+
)
7484

7585
def get_sql_alchemy_url(self) -> str:
7686
if self.project_on_behalf:

0 commit comments

Comments
 (0)