feat: export ADK agent engine template logs to the Telemetry API - #7087
Open
copybara-service[bot] wants to merge 1 commit into
Open
feat: export ADK agent engine template logs to the Telemetry API#7087copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
CloudLoggingExporter is deprecated, so the ADK agent engine templates
now send logs over OTLP to telemetry.googleapis.com, alongside the
traces they already export there. Applied to all four copies of the
template (vertexai/agent_engines, agentplatform/agent_engines,
vertexai/preview/reasoning_engines, agentplatform/private/frameworks) so
their telemetry does not diverge.
This collapses the semconv split. Experimental semconv used a batching
processor writing through the Cloud Logging API, while stable semconv
wrote structured JSON to stdout, because Agent Engine mis-parsed
`gen_ai.client.inference.operation.details` records off stdout. Neither
branch survives the move to OTLP -- there is one path now, and it
behaves the same under both settings.
Because the OTLP mapping is done server side, two behaviours had to be
reproduced explicitly:
- `_create_otel_resource(project_id, "logs")` pins `gcp.resource_type`
and the location/reasoning_engine_id labels, so entries keep landing
on `aiplatform.googleapis.com/ReasoningEngine` instead of being
detected as `generic_task`. It returns a logs-only resource: the
metrics pipeline reads `gcp.resource_type` too, and would move Agent
Engine metrics off `prometheus_target` if it saw it.
- `_named_batch_log_record_processor` keeps GCP_DEFAULT_LOG_NAME (and
the `adk-on-agent-engine` default) working, and re-publishes the
record's event name as an `event.name` attribute so it still lands
as a log entry label.
The User-Agent string is now built by `_get_user_agent` rather than
inline in the tracing branch, so both signals report the same one.
Nothing imports `opentelemetry-exporter-gcp-logging` or
`google-cloud-logging` any more -- the ADK templates were their only
users, and the other templates never set up logging -- so both are
dropped from the `agent_engines` and `reasoning_engine` extras, and the
missing-dependency warning now names the packages logging actually needs.
PiperOrigin-RevId: 966602473
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: export ADK agent engine template logs to the Telemetry API
CloudLoggingExporter is deprecated, so the ADK agent engine templates
now send logs over OTLP to telemetry.googleapis.com, alongside the
traces they already export there. Applied to all four copies of the
template (vertexai/agent_engines, agentplatform/agent_engines,
vertexai/preview/reasoning_engines, agentplatform/private/frameworks) so
their telemetry does not diverge.
This collapses the semconv split. Experimental semconv used a batching
processor writing through the Cloud Logging API, while stable semconv
wrote structured JSON to stdout, because Agent Engine mis-parsed
gen_ai.client.inference.operation.detailsrecords off stdout. Neitherbranch survives the move to OTLP -- there is one path now, and it
behaves the same under both settings.
Because the OTLP mapping is done server side, two behaviours had to be
reproduced explicitly:
_create_otel_resource(project_id, "logs")pinsgcp.resource_typeand the location/reasoning_engine_id labels, so entries keep landing
on
aiplatform.googleapis.com/ReasoningEngineinstead of beingdetected as
generic_task. It returns a logs-only resource: themetrics pipeline reads
gcp.resource_typetoo, and would move AgentEngine metrics off
prometheus_targetif it saw it._named_batch_log_record_processorkeeps GCP_DEFAULT_LOG_NAME (andthe
adk-on-agent-enginedefault) working, and re-publishes therecord's event name as an
event.nameattribute so it still landsas a log entry label.
The User-Agent string is now built by
_get_user_agentrather thaninline in the tracing branch, so both signals report the same one.
Nothing imports
opentelemetry-exporter-gcp-loggingorgoogle-cloud-loggingany more -- the ADK templates were their onlyusers, and the other templates never set up logging -- so both are
dropped from the
agent_enginesandreasoning_engineextras, and themissing-dependency warning now names the packages logging actually needs.