Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@


def _get_bigquery_client_info() -> ClientInfo:
"""Get ClientInfo with DataHub user-agent for BigQuery client identification"""
return ClientInfo(user_agent=f"datahub/{__version__}")
"""Get ClientInfo with DataHub user-agent for GCP API identification.

Follows Google's recommended format:
"<prod_name>/ver (GPN:<company name>; <other comments>)"
"""
return ClientInfo(user_agent=f"DataHub/{__version__} (GPN:DataHub)")


class BigQueryConnectionConfig(ConfigModel):
Expand Down Expand Up @@ -68,9 +72,15 @@ def make_gcp_logging_client(
client_options = self.extra_client_options.copy()
client_options["_use_grpc"] = False
if project_id is not None:
return GCPLoggingClient(**client_options, project=project_id)
return GCPLoggingClient(
**client_options,
project=project_id,
client_info=_get_bigquery_client_info(),
)
else:
return GCPLoggingClient(**client_options)
return GCPLoggingClient(
**client_options, client_info=_get_bigquery_client_info()
)

def get_sql_alchemy_url(self) -> str:
if self.project_on_behalf:
Expand Down
Loading