-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update monitoring docs and add dashboard links (#1261)
* Update monitoring docs and add dashboard links * CHange dashboard link to sign up form link * Update monitoring with latest from doc * Cleanup * Feedback
- Loading branch information
Showing
2 changed files
with
42 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,57 @@ | ||
# Monitoring | ||
|
||
Firebase Genkit is fully instrumented with | ||
[OpenTelemetry](https://opentelemetry.io/) and provides hooks to export | ||
telemetry data. | ||
[OpenTelemetry](https://opentelemetry.io/) and provides built-in telemetry support for tracing and metrics. | ||
|
||
## Telemetry Configuration | ||
|
||
Genkit's configuration supports a `telemetry` block that exposes instrumentation (trace and metrics) and logging hooks, allowing plugins to provide OpenTelemetry and logging exporters. | ||
Genkit automatically manages tracing and metrics without requiring explicit configuration. You can enable telemetry exports for Firebase or Google Cloud using their respective plugins and helper functions. Using either plugin poweres the [Firebase AI Monitoring dashboard (private preview)](https://forms.gle/Lp5S1NxbZUXsWc457) that has an AI-idiomatic view of telemetry data. | ||
|
||
### For Firebase: | ||
|
||
```ts | ||
configureGenkit({ | ||
telemetry: { | ||
instrumentation: ..., | ||
logger: ... | ||
} | ||
import { genkit } from 'genkit'; | ||
import { enableFirebaseTelemetry } from '@genkit-ai/firebase'; | ||
|
||
enableFirebaseTelemetry({ | ||
// Firebase-specific configuration options | ||
}); | ||
|
||
const ai = genkit({ | ||
plugins: [ ... ] | ||
}); | ||
``` | ||
More details are outlined in the [Firebase plugin docs](./plugins/firebase.md). | ||
|
||
Genkit ships with a [Google Cloud plugin](./plugins/google-cloud.md) which exports telemetry to Cloud's operations suite. | ||
### For Google Cloud: | ||
|
||
## Trace Store | ||
```ts | ||
import { genkit } from 'genkit'; | ||
import { enableGoogleCloudTelemetry } from '@genkit-ai/google-cloud'; | ||
|
||
The `traceStore` option is complementary to the telemetry instrumentation. It | ||
lets you inspect your traces for your flow runs in the Genkit Developer UI. It | ||
requires a separate configuration which provides a trace storage implementation. | ||
The `firebase` plugin offers a Firestore-based implementation. This | ||
configuration is optional, but is recommended because it lets you inspect and | ||
debug issues in production. When using Firestore-based trace storage you will | ||
want to enable TTL for the trace documents: | ||
https://firebase.google.com/docs/firestore/ttl | ||
enableGoogleCloudTelemetry({ | ||
// Google Cloud-specific configuration options | ||
}); | ||
|
||
const ai = genkit({ | ||
plugins: [ ... ] | ||
}); | ||
``` | ||
More details are outlined in the [Google Cloud plugin docs](./plugins/google-cloud.md). | ||
|
||
## Logging | ||
Genkit provides a centralized logging system that can be configured using the logging module. Logs will be exported Google Cloud operations suite if telemetry export is enabled. | ||
|
||
```ts | ||
import { firebase } from '@genkit-ai/plugin-firebase'; | ||
import { logger } from 'genkit/logging'; | ||
|
||
configureGenkit({ | ||
plugins: [firebase()], | ||
traceStore: 'firebase', | ||
}); | ||
// Set the desired log level | ||
logger.setLogLevel('debug'); | ||
``` | ||
|
||
## Trace Storage and Developer UI | ||
Traces are automatically captured and can be viewed in the Genkit Developer UI. To start the UI: | ||
```posix-terminal | ||
npx genkit start -- <command to run your code> | ||
``` | ||
When using Firebase, trace data is automatically stored in Firestore. It's recommended to enable [TTL (Time To Live)](https://firebase.google.com/docs/firestore/ttl) for trace documents to manage storage costs and data retention. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters