Skip to content

Commit 71be52c

Browse files
Update adk.py to check for client_cert_callback
1 parent f31c939 commit 71be52c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • vertexai/agent_engines/templates

vertexai/agent_engines/templates/adk.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
SynchronousMultiSpanProcessor = Any
9595

9696

97+
9798
_DEFAULT_APP_NAME = "default-app-name"
9899
_DEFAULT_USER_ID = "default-user-id"
99100
_TELEMETRY_API_DISABLED_WARNING = (
@@ -379,6 +380,7 @@ def _detect_cloud_resource_id(project_id: str) -> Optional[str]:
379380
import opentelemetry.exporter.otlp.proto.http.version
380381
import opentelemetry.exporter.otlp.proto.http.trace_exporter
381382
import google.auth.transport.requests
383+
from google.auth.transport import mtls
382384
from google.cloud.aiplatform import version as aip_version
383385
except (ImportError, AttributeError):
384386
return _warn_missing_dependency(
@@ -388,13 +390,14 @@ def _detect_cloud_resource_id(project_id: str) -> Optional[str]:
388390
import google.auth
389391

390392
credentials, _ = google.auth.default()
393+
client_cert_callback = mtls.default_client_cert_source()
391394
vertex_sdk_version = aip_version.__version__
392395
otlp_http_version = opentelemetry.exporter.otlp.proto.http.version.__version__
393396
user_agent = f"Vertex-Agent-Engine/{vertex_sdk_version} OTel-OTLP-Exporter-Python/{otlp_http_version}"
394397
session = google.auth.transport.requests.AuthorizedSession(
395398
credentials=credentials
396399
)
397-
session.configure_mtls_channel()
400+
session.configure_mtls_channel(client_cert_callback)
398401
print("configure_mtls_channel done")
399402
span_exporter = (
400403
opentelemetry.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporter(

0 commit comments

Comments
 (0)