Skip to main content
Genkit is built on OpenTelemetry. Every flow execution, model call, and tool invocation creates a span that records input, output, latency, and token usage. In production you export those spans to Google Cloud Trace, Cloud Monitoring, and Cloud Logging using the @genkit-ai/google-cloud plugin (or its language equivalents).

What is automatically traced

Genkit instruments the following operations without any extra code: Each span carries a genkit:type attribute (flow, action, model, tool) and a genkit:path that shows the full call chain, for example /menuSuggestion/googleai/gemini-2.0-flash.
By default, model input and output content is redacted before export to Google Cloud (genkit:input and genkit:output are replaced with <redacted>). To retain them, set disableLoggingInputAndOutput: false (it defaults to false, meaning redaction is on during export). Check the option description in GcpTelemetryConfigOptions for the exact semantics before enabling this in production.

Node.js — @genkit-ai/google-cloud

Installation

Configuration

The plugin reads credentials from Application Default Credentials (ADC). On Cloud Run, GKE, or Cloud Functions no additional setup is needed. Outside of GCP, run gcloud auth application-default login or provide a credentials option.

Available options

Python — genkit-google-cloud

Install:
Enable telemetry:
The Python google-cloud plugin follows the same trace/metric/log pipeline as the Node.js plugin.

Third-party telemetry backends (Python)

The genkit-observability community plugin provides exporters for Datadog, Honeycomb, Sentry, and other OpenTelemetry-compatible backends:
See the plugin README for the full list of supported backends.

Go — googlecloud plugin

Import:
Enable telemetry before calling genkit.Init:

Go telemetry options

Firebase telemetry

For Firebase Cloud Functions deployments, use enableFirebaseTelemetry from @genkit-ai/firebase. It wraps enableGoogleCloudTelemetry and exports to the same Google Cloud Observability suite:

Viewing traces in Google Cloud Console

1

Open Cloud Trace

Go to console.cloud.google.com/traces and select your project.
2

Filter by Genkit flow

In the Trace Explorer, filter by the genkit/feature attribute to find traces for a specific flow. Root spans carry genkit/isRoot: true.
3

Inspect model calls

Expand a trace to see child spans. Spans with genkit/metadata/subtype: model represent model calls. They include the model name (genkit/model) and — if disableLoggingInputAndOutput is false — the prompt and response.
4

View logs

Open Cloud Logging and filter by logName: genkit_log. Log entries are linked to their parent trace via the logging.googleapis.com/trace field.

Span attributes reference

The following genkit:* attributes are set on every span and normalised to genkit/* before export:

Structured logging

The @genkit-ai/google-cloud plugin replaces the default logger with a Winston-based logger that:
  • Emits structured JSON to Cloud Logging (logName: genkit_log).
  • Attaches logging.googleapis.com/trace, trace_sampled, and spanId fields so log entries are correlated with traces in Cloud Trace.
  • Uses Pino and Winston OpenTelemetry instrumentations when autoInstrumentation: true.

Production monitoring best practices

Sample traces

Use TraceIdRatioBasedSampler at 10–20 % to control costs while retaining statistical signal. Always sample errors (ParentBasedSampler with an error filter).

Set up alerting

Create Cloud Monitoring alerting policies on:
  • genkit/feature/requests/count with genkit/status != success
  • genkit/generate/requests/count with high latency
  • Error rate above a threshold

Redact sensitive data

Set disableLoggingInputAndOutput: true (or leave at default) for flows that handle PII, financial data, or other sensitive information. Review what gets exported before enabling full input/output logging.

Flush before exit

For short-lived processes or Cloud Functions, flush pending spans before returning. The Go plugin calls googlecloud.FlushMetrics(ctx). In Node.js the BatchSpanProcessor flushes on SIGTERM.

Next steps

Deploy to Firebase

Firebase deployment guide with telemetry wiring.

Deploy to Cloud Run

Cloud Run deployment guide.

Plugins overview

Explore all official Genkit plugins.