Telemetry Collection

The Firebase telemetry plugin exports a combination of metrics, traces, and logs to Google Cloud Observability. This document details which metrics, trace attributes, and logs will be collected and what you can expect in terms of latency, quotas, and cost.

Telemetry delay

There may be a slight delay before telemetry from a given invocation is available in Firebase. This is dependent on your export interval (5 minutes by default).

Quotas and limits

There are several quotas that are important to keep in mind:

Cost

Cloud Logging, Cloud Trace, and Cloud Monitoring have generous free-of-charge tiers. Specific pricing can be found at the following links:

Metrics

The Firebase telemetry plugin collects a number of different metrics to support the various Genkit action types detailed in the following sections.

Feature metrics

Features are the top-level entry-point to your Genkit code. In most cases, this will be a flow. Otherwise, this will be the top-most span in a trace.

NameTypeDescription
genkit/feature/requestsCounterNumber of requests
genkit/feature/latencyHistogramExecution latency in ms

Each feature metric contains the following dimensions:

NameDescription
nameThe name of the feature. In most cases, this is the top-level Genkit flow
status'success' or 'failure' depending on whether or not the feature request succeeded
errorOnly set when status=failure. Contains the error type that caused the failure
sourceThe Genkit source language. Eg. 'ts'
sourceVersionThe Genkit framework version

Action metrics

Actions represent a generic step of execution within Genkit. Each of these steps will have the following metrics tracked:

NameTypeDescription
genkit/action/requestsCounterNumber of times this action has been executed
genkit/action/latencyHistogramExecution latency in ms

Each action metric contains the following dimensions:

NameDescription
nameThe name of the action
featureNameThe name of the parent feature being executed
pathThe path of execution from the feature root to this action. eg. '/myFeature/parentAction/thisAction'
status'success' or 'failure' depending on whether or not the action succeeded
errorOnly set when status=failure. Contains the error type that caused the failure
sourceThe Genkit source language. Eg. 'ts'
sourceVersionThe Genkit framework version

Generate metrics

These are special action metrics relating to actions that interact with a model. In addition to requests and latency, input and output are also tracked, with model specific dimensions that make debugging and configuration tuning easier.

NameTypeDescription
genkit/ai/generate/requestsCounterNumber of times this model has been called
genkit/ai/generate/latencyHistogramExecution latency in ms
genkit/ai/generate/input/tokensCounterInput tokens
genkit/ai/generate/output/tokensCounterOutput tokens
genkit/ai/generate/input/charactersCounterInput characters
genkit/ai/generate/output/charactersCounterOutput characters
genkit/ai/generate/input/imagesCounterInput images
genkit/ai/generate/output/imagesCounterOutput images
genkit/ai/generate/input/audioCounterInput audio files
genkit/ai/generate/output/audioCounterOutput audio files

Each generate metric contains the following dimensions:

NameDescription
modelNameThe name of the model
featureNameThe name of the parent feature being executed
pathThe path of execution from the feature root to this action. eg. '/myFeature/parentAction/thisAction'
latencyMsThe response time taken by the model
status'success' or 'failure' depending on whether or not the feature request succeeded
errorOnly set when status=failure. Contains the error type that caused the failure
sourceThe Genkit source language. Eg. 'ts'
sourceVersionThe Genkit framework version

Traces

All Genkit actions are automatically instrumented to provide detailed traces for your AI features. Locally, traces are visible in the Developer UI. For deployed apps enable Genkit Monitoring to get the same level of visibility.

The following sections describe what trace attributes you can expect based on the Genkit action type for a particular span in the trace.

Root Spans

Root spans have special attributes to help disambiguate the state attributes for the whole trace versus an individual span.

Attribute nameDescription
genkit/featureThe name of the parent feature being executed
genkit/isRootMarked true if this span is the root span
genkit/rootStateThe state of the overall execution as success or error. This does not indicate that this step failed in particular.

Flow

Attribute nameDescription
genkit/inputThe input to the flow. This will always be <redacted> because of trace attribute size limits.
genkit/metadata/subtypeThe type of Genkit action. For flows it will be flow.
genkit/nameThe name of this Genkit action. In this case the name of the flow
genkit/outputThe output generated in the flow. This will always be <redacted> because of trace attribute size limits.
genkit/pathThe fully qualified execution path that lead to this step in the trace, including type information.
genkit/stateThe state of this span's execution as success or error.
genkit/typeThe type of Genkit primitive that corresponds to this span. For flows, this will be action.

Util

Attribute nameDescription
genkit/inputThe input to the util. This will always be <redacted> because of trace attribute size limits.
genkit/nameThe name of this Genkit action. In this case the name of the flow
genkit/outputThe output generated in the util. This will always be <redacted> because of trace attribute size limits.
genkit/pathThe fully qualified execution path that lead to this step in the trace, including type information.
genkit/stateThe state of this span's execution as success or error.
genkit/typeThe type of Genkit primitive that corresponds to this span. For flows, this will be util.

Model

Attribute nameDescription
genkit/inputThe input to the model. This will always be <redacted> because of trace attribute size limits.
genkit/metadata/subtypeThe type of Genkit action. For models it will be model.
genkit/modelThe name of the model.
genkit/nameThe name of this Genkit action. In this case the name of the model.
genkit/outputThe output generated by the model. This will always be <redacted> because of trace attribute size limits.
genkit/pathThe fully qualified execution path that lead to this step in the trace, including type information.
genkit/stateThe state of this span's execution as success or error.
genkit/typeThe type of Genkit primitive that corresponds to this span. For flows, this will be action.

Tool

Attribute nameDescription
genkit/inputThe input to the model. This will always be <redacted> because of trace attribute size limits.
genkit/metadata/subtypeThe type of Genkit action. For tools it will be tool.
genkit/nameThe name of this Genkit action. In this case the name of the model.
genkit/outputThe output generated by the model. This will always be <redacted> because of trace attribute size limits.
genkit/pathThe fully qualified execution path that lead to this step in the trace, including type information.
genkit/stateThe state of this span's execution as success or error.
genkit/typeThe type of Genkit primitive that corresponds to this span. For flows, this will be action.

Logs

For deployed apps with Genkit Monitoring, logs are used to capture input, output, and configuration metadata that provides rich detail about each step in your AI feature.

All logs will include the following shared metadata fields:

Field nameDescription
insertIdUnique id for the log entry
jsonPayloadContainer for variable information that is unique to each log type
labels{module: genkit}
logNameprojects/weather-gen-test-next/logs/genkit_log
receivedTimestampTime the log was received by Cloud
resourceInformation about the source of the log including deployment information region, and projectId
severityThe log level written. See Cloud's LogSeverity
spanIdIdentifier for the span that created this log
timestampTime that the client logged a message
traceIdentifier for the trace of the format projects/<project-id>/traces/<trace-id>
traceSampledBoolean representing whether the trace was sampled. Logs are not sampled.

Each log type will have a different json payload described in each section.

Input

JSON payload:

Field nameDescription
message[genkit] Input[<path>, <featureName>] including (message X of N) for multi-part messages
metadataAdditional context including the input message sent to the action

Metadata:

Field nameDescription
contentThe input message content sent to this Genkit action
featureNameThe name of the Genkit flow, action, tool, util, or helper.
messageIndex *Index indicating the order of messages for inputs that contain multiple messages. For single messages, this will always be 0.
model *Model name.
pathThe execution path that generated this log of the format step1 > step2 > step3
partIndex *Index indicating the order of parts within a message for multi-part messages. This is typical when combining text and images in a single input.
qualifiedPathThe execution path that generated this log, including type information of the format: /{flow1,t:flow}/{generate,t:util}/{modelProvider/model,t:action,s:model
totalMessages *The total number of messages for this input. For single messages, this will always be 1.
totalParts *Total number of parts for this message. For single-part messages, this will always be 1.

(*) Starred items are only present on Input logs for model interactions.

Output

JSON payload:

Field nameDescription
message[genkit] Output[<path>, <featureName>] including (message X of N) for multi-part messages
metadataAdditional context including the input message sent to the action

Metadata:

Field nameDescription
candidateIndex * (deprecated)Index indicating the order of candidates for outputs that contain multiple candidates. For logs with single candidates, this will always be 0.
contentThe output message generated by the Genkit action
featureNameThe name of the Genkit flow, action, tool, util, or helper.
messageIndex *Index indicating the order of messages for inputs that contain multiple messages. For single messages, this will always be 0.
model *Model name.
pathThe execution path that generated this log of the format `step1 > step2 > step3
partIndex *Index indicating the order of parts within a message for multi-part messages. This is typical when combining text and images in a single output.
qualifiedPathThe execution path that generated this log, including type information of the format: /{flow1,t:flow}/{generate,t:util}/{modelProvider/model,t:action,s:model
totalCandidates * (deprecated)Total number of candidates generated as output. For single-candidate messages, this will always be 1.
totalParts *Total number of parts for this message. For single-part messages, this will always be 1.

(*) Starred items are only present on Output logs for model interactions.

Config

JSON payload:

Field nameDescription
message[genkit] Config[<path>, <featureName>]
metadataAdditional context including the input message sent to the action

Metadata:

Field nameDescription
featureNameThe name of the Genkit flow, action, tool, util, or helper.
modelModel name.
pathThe execution path that generated this log of the format `step1 > step2 > step3
qualifiedPathThe execution path that generated this log, including type information of the format: /{flow1,t:flow}/{generate,t:util}/{modelProvider/model,t:action,s:model
sourceThe Genkit library language used. This will always be set to 'ts' as it is the only supported language.
sourceVersionThe Genkit library version.
temperatureModel temperature used.

Paths

JSON payload:

Field nameDescription
message[genkit] Paths[<path>, <featureName>]
metadataAdditional context including the input message sent to the action

Metadata:

Field nameDescription
flowNameThe name of the Genkit flow, action, tool, util, or helper.
pathsAn array containing all execution paths for the collected spans.