Courseiva
hardMultiple ChoiceObjective-mapped

Exporting Custom Metrics from Vertex AI Custom Containers

A company uses a custom container on Vertex AI Prediction. They want to send custom metrics from their prediction container to Cloud Monitoring. Which method should they use?

Quick Answer

The answer is to use the OpenCensus or OpenTelemetry SDK. These open-source frameworks are the correct method because they allow your custom container to instrument application code directly and export custom metrics to Cloud Monitoring via the Cloud Monitoring API, eliminating the need for sidecar agents or log-based parsing. On the Google Professional Machine Learning Engineer exam, this question tests your understanding of Vertex AI’s native integration with observability standards, often appearing as a scenario where you must choose between agent-based solutions (like the Ops Agent) and direct SDK instrumentation—a common trap is selecting a log-based workaround, which is less efficient and not recommended for real-time metrics. The key insight is that Vertex AI Prediction containers support these SDKs out of the box, making them the most streamlined path. Memory tip: think “SDK, not sidecar” to recall that custom metrics flow directly from your code, not from an external agent.

⚠ Common exam trap

Watch out — candidates often confuse built-in Vertex AI metrics (which are automatic but limited) with the need for custom metrics, or they incorrectly assume that log-based metrics are the simplest path, when in fact OpenCensus/OpenTelemetry are the direct and recommended method for custom containers.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

OpenCensus or OpenTelemetry SDK

OpenCensus and OpenTelemetry are the recommended open-source frameworks for exporting custom metrics from custom containers on Vertex AI Prediction to Cloud Monitoring. They provide a standardized way to instrument your application code, collect metrics, and send them directly to Cloud Monitoring via the Cloud Monitoring API, without requiring additional agents or log-based workarounds.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • OpenCensus or OpenTelemetry SDK

    Why this is correct

    Vertex AI Prediction integrates with OpenTelemetry for custom metrics.

  • Vertex AI built-in metrics

    Why it's wrong here

    Built-in metrics do not support custom definitions.

  • Stackdriver Monitoring agent installed in the container

    Why it's wrong here

    The monitoring agent is not recommended inside Vertex AI containers.

  • Cloud Logging log-based metrics

    Why it's wrong here

    Log-based metrics are derived from logs, not direct metric emission.

About these practice questions

This PMLE question is part of Courseiva's 990-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on PMLE

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A company uses Vertex AI Predictions with a custom container that invokes an external API for feature enrichment. The prediction response time is highly variable. The engineer wants to monitor the external API's contribution to latency. What should the engineer do?

hard
  • A.Instrument the prediction container to emit custom metrics for the time spent in each prediction step, including the external API call.
  • B.Add a timeout setting to the endpoint's request to limit the external API call duration.
  • C.Monitor the Vertex AI endpoint latency metric and correlate with system metrics like CPU and memory.
  • D.Use Cloud Trace to trace the prediction request end-to-end, including the external API call.

Why A: Instrumenting the custom container to emit custom metrics (e.g., using OpenTelemetry or a Prometheus client library) allows the engineer to directly measure the time spent in each prediction step, isolating the external API call's contribution to latency. This provides granular, real-time visibility into the specific bottleneck, which is essential when the response time is highly variable and the external API is a known dependency.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PMLE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PMLE exam.