Skip to content

feat: export ADK agent engine template logs to the Telemetry API - #7087

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
copybara_966602473
Open

feat: export ADK agent engine template logs to the Telemetry API#7087
copybara-service[bot] wants to merge 1 commit into
mainfrom
copybara_966602473

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

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.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.

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
@copybara-service
copybara-service Bot requested a review from a team as a code owner August 21, 2026 15:13
@product-auto-label product-auto-label Bot added size: l Pull request size is large. api: vertex-ai Issues related to the googleapis/python-aiplatform API. labels Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: vertex-ai Issues related to the googleapis/python-aiplatform API. google-contributor size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant