I can’t see traces and/or metrics in Firebase Genkit Monitoring
- Ensure that the following APIs are enabled for your underlying GCP project:
- Ensure that the following roles are applied to the service account that
is running your code (or service account that has been configured as part of
the plugin options) in Cloud IAM.
- Monitoring Metric Writer (
roles/monitoring.metricWriter
) - Cloud Trace Agent (
roles/cloudtrace.agent
) - Logs Writer (
roles/logging.logWriter
)
- Monitoring Metric Writer (
Inspect the application logs for errors writing to Cloud Logging, Cloud Trace, and/or Cloud Monitoring. On GCP infrastructure such as Firebase Functions and Cloud Run, even when telemetry is misconfigured, logs to
stdout/stderr
are automatically ingested by the Cloud Logging Agent, allowing you to diagnose issues in the in the Cloud Logging Console.Debug locally:
Enable dev export:
enableFirebaseTelemetry({ forceDevExport: true });
To test with your personal user credentials, use the [gcloud CLI] to authenticate with Google Cloud. Doing so can help diagnose enabled/disabled APIs, but does not test the gcloud auth application-default login.
Alternatively, impersonating the service account allows you to test production-like access. You must have the
roles/iam. serviceAccountTokenCreator
IAM role applied to your user account in order to impersonate service accounts:gcloud auth application-default login --impersonate-service-account <SERVICE_ACCT_EMAIL>
See the ADC documentation for more information.
Telemetry upload reliability in Firebase Functions / Cloud Run
When Genkit is hosted in Google Cloud Run (including Cloud Functions for Firebase), telemetry-data upload may be less reliable as the container switches to the "idle" lifecycle state. If higher reliability is important to you, consider changing CPU allocation to always allocated in the Google Cloud Console.