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 theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/genkit-ai/genkit/llms.txt
Use this file to discover all available pages before exploring further.
@genkit-ai/google-cloud plugin (or its language equivalents).
What is automatically traced
Genkit instruments the following operations without any extra code:| Span type | Recorded automatically |
|---|---|
| Flow execution | Input, output, duration, success/error |
| Model call | Model name, input/output (redacted in export), token usage, latency |
| Tool call | Tool name, invocation count |
ai.run() step | Step name, duration |
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
gcloud auth application-default login or provide a credentials option.
Available options
| Option | Type | Default | Description |
|---|---|---|---|
projectId | string | ADC / env | Google Cloud project to export to. |
credentials | JWTInput | ADC | Explicit credentials for non-GCP environments. |
sampler | Sampler | AlwaysOn | OpenTelemetry trace sampler. |
autoInstrumentation | boolean | true | Enable OTel auto-instrumentation for popular libraries. |
metricExportIntervalMillis | number | 60000 | Metric export frequency (minimum 5000 ms). |
disableMetrics | boolean | false | Skip metric export. |
disableTraces | boolean | false | Skip trace export. |
disableLoggingInputAndOutput | boolean | false | Redact model I/O in exported spans and logs. |
forceDevExport | boolean | false | Export even when GENKIT_ENV=dev (for local testing). |
Python — genkit-google-cloud
Install:
google-cloud plugin follows the same trace/metric/log pipeline as the Node.js plugin.
Third-party telemetry backends (Python)
Thegenkit-observability community plugin provides exporters for Datadog, Honeycomb, Sentry, and other OpenTelemetry-compatible backends:
Go — googlecloud plugin
Import:
genkit.Init:
Go telemetry options
| Option | Type | Default | Description |
|---|---|---|---|
ProjectID | string | env | Google Cloud project. |
Credentials | *google.Credentials | ADC | Explicit credentials. |
Sampler | sdktrace.Sampler | AlwaysOn | Trace sampler. |
MetricExportIntervalMillis | *int | 300000 (prod) | Export frequency. |
DisableMetrics | bool | false | Skip metric export. |
DisableTraces | bool | false | Skip trace export. |
DisableLoggingInputAndOutput | bool | false | Redact model I/O. |
ForceDevExport | bool | false | Export in GENKIT_ENV=dev. |
Firebase telemetry
For Firebase Cloud Functions deployments, useenableFirebaseTelemetry from @genkit-ai/firebase. It wraps enableGoogleCloudTelemetry and exports to the same Google Cloud Observability suite:
Viewing traces in Google Cloud Console
Open Cloud Trace
Go to console.cloud.google.com/traces and select your project.
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.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.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 followinggenkit:* attributes are set on every span and normalised to genkit/* before export:
| Attribute | Description |
|---|---|
genkit/type | Span type: flow, action, model, tool, flowStep |
genkit/name | Action or flow name |
genkit/path | Full call path, e.g. /myFlow/googleai/gemini-2.0-flash |
genkit/isRoot | true for the outermost flow span |
genkit/state | success or error |
genkit/feature | Feature name (set on root spans) |
genkit/model | Model name (set on model spans) |
genkit/input | Flow or model input (redacted during export) |
genkit/output | Flow or model output (redacted during 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, andspanIdfields 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/countwithgenkit/status != successgenkit/generate/requests/countwith 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.
