Skip to content

Commit 5e6df42

Browse files
RKestcopybara-github
authored andcommitted
feat(telemetry): export logs over OTLP to telemetry.googleapis.com
CloudLoggingExporter is deprecated, so point ADK's Google Cloud logging setup at the Telemetry API instead, the same way traces and metrics already go there. Both branches it replaced are gone: the direct WriteLogEntries client used off Agent Engine, and the structured-JSON -to-stdout workaround used on it. Two things had to be carried over by hand, because the OTLP mapping is done server side and does not match what CloudLoggingExporter did: - MonitoredResource. CloudLoggingExporter special-cased `cloud.resource_id` into `aiplatform.googleapis.com/ReasoningEngine`. Left alone, the Telemetry API would detect the same resource as `generic_task` and silently break every existing log filter. On Agent Engine, GCPBatchLogRecordProcessor merges the type and its labels onto each record's resource. It keeps them off the resource traces and metrics share on purpose: the metrics pipeline reads `gcp.resource_type` too, and would move Agent Engine metrics off `prometheus_target`. - Log name and labels. The Telemetry API names the entry after the record's event name and otherwise falls back to a generic `otlp` log, where CloudLoggingExporter fell back to a configurable default. GCPBatchLogRecordProcessor stamps that default so GCP_DEFAULT_LOG_NAME keeps working, and re-publishes the event name as an `event.name` attribute so it still surfaces as a log entry label. Two behaviour changes worth calling out. On Agent Engine the default log name is now `aiplatform.googleapis.com/reasoning_engine_stdout` rather than `adk-on-agent-engine`, because that is what the stdout pipeline actually produced and what customer log filters match. And GOOGLE_CLOUD_DEFAULT_LOG_NAME is removed rather than carried over: it was never read by anything outside ADK. `opentelemetry-exporter-gcp-logging` is now unused but stays declared; dropping it churns uv.lock and five constraints files, so it is left for a follow-up. Co-authored-by: Max Ind <maxind@google.com> PiperOrigin-RevId: 973832408
1 parent bed446c commit 5e6df42

3 files changed

Lines changed: 552 additions & 134 deletions

File tree

0 commit comments

Comments
 (0)