Skip to content

Advanced configuration

This documentation will describe how to fine-tune which telemetry is collected, how often, and from what environments.

The Firebase telemetry plugin provides default options, out of the box, to get you up and running quickly. These are the provided defaults:

This guide focuses on advanced configuration options for deployed features using the Firebase telemetry plugin.

// Note: MetricExportIntervalMillis and MetricExportTimeoutMillis are pointers to int (*int).
// The values shown below represent the internal defaults in production.
{
DisableMetrics: false,
DisableTraces: false,
DisableLoggingInputAndOutput: false,
ForceDevExport: false,
// 5 minutes
MetricExportIntervalMillis: nil, // defaults to 300000
// 5 minutes
MetricExportTimeoutMillis: nil, // defaults to 300000
// OpenTelemetry defaults to sdktrace.AlwaysSample()
Sampler: nil, // defaults to sdktrace.AlwaysSample()
}

To export telemetry when running locally set the forceDevExport option to true.

import "github.com/firebase/genkit/go/plugins/firebase"
func main() {
firebase.EnableFirebaseTelemetry(
&firebase.FirebaseTelemetryOptions{
ForceDevExport: true,
}
)
}

During development and testing, you can decrease latency by adjusting the export interval and timeout.

Note: Shipping to production with a frequent export interval may increase the cost for exported telemetry.

import "github.com/firebase/genkit/go/plugins/firebase"
func main() {
interval := 10000
firebase.EnableFirebaseTelemetry(&firebase.FirebaseTelemetryOptions{
MetricExportIntervalMillis: &interval, // 10 seconds
MetricExportTimeoutMillis: &interval, // 10 seconds
})
}

The Firebase telemetry plugin will automatically collect traces and metrics for popular frameworks using OpenTelemetry zero-code instrumentation.

A full list of available instrumentations can be found in the auto-instrumentations-node documentation.

To selectively disable or enable instrumentations that are eligible for auto instrumentation, update the autoInstrumentationConfig field:

Genkit Monitoring leverages a combination of logging, tracing, and metrics to capture a holistic view of your Genkit interactions, however, you can also disable each of these elements independently if needed.

By default, the Firebase telemetry plugin will capture inputs and outputs for each Genkit feature or step.

To help you control how customer data is stored, you can disable the logging of input and output by adding the following to your configuration:

import "github.com/firebase/genkit/go/plugins/firebase"
func main() {
firebase.EnableFirebaseTelemetry(&firebase.FirebaseTelemetryOptions{
DisableLoggingInputAndOutput: true,
})
}

With this option set, input and output attributes will be redacted in the Genkit Monitoring trace viewer and will be missing from Google Cloud logging.

To disable metrics collection, add the following to your configuration:

import "github.com/firebase/genkit/go/plugins/firebase"
func main() {
firebase.EnableFirebaseTelemetry(&firebase.FirebaseTelemetryOptions{
DisableMetrics: true,
})
}

With this option set, you will no longer see stability metrics in the Genkit Monitoring dashboard and will be missing from Google Cloud Metrics.

To disable trace collection, add the following to your configuration:

import "github.com/firebase/genkit/go/plugins/firebase"
func main() {
firebase.EnableFirebaseTelemetry(&firebase.FirebaseTelemetryOptions{
DisableTraces: true,
})
}

With this option set, you will no longer see traces in the Genkit Monitoring feature page, have access to the trace viewer, or see traces present in Google Cloud Tracing.