Skip to content

Commit

Permalink
Update monitoring docs and add dashboard links (#1261)
Browse files Browse the repository at this point in the history
* 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
kmandrika authored Nov 13, 2024
1 parent 20d912f commit 54d754a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 25 deletions.
63 changes: 40 additions & 23 deletions docs/monitoring.md
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.
4 changes: 2 additions & 2 deletions docs/plugins/google-cloud.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Google Cloud plugin

The Google Cloud plugin exports Firebase Genkit's telemetry and logging data to
[Google Cloud's operation suite](https://cloud.google.com/products/operations) which powers the Firebase AI Monitoring dashboard.
[Google Cloud's operations suite](https://cloud.google.com/products/operations) which powers the [Firebase AI Monitoring dashboard (private preview)](https://forms.gle/Lp5S1NxbZUXsWc457).

> Note: Logging is facilitated by [Winston](https://github.com/winstonjs/winston) in favor of the [OpenTelemetry](https://opentelemetry.io/) logging APIs. Export of logs is done via a dedicated Winston Google Cloud exporter.
Expand Down Expand Up @@ -152,4 +152,4 @@ This option will force Genkit to export telemetry and log data when running in t
## Test your integration

When configuring the plugin, use `forceDevExport: true` to enable telemetry export for local runs. Navigate to the Google Cloud Logs, Metrics, or Trace Explorer to view telemetry. Alternatively, navigate to the Firebase AI Monitoring dashboard for an AI-idiomatic view of telemetry.
When configuring the plugin, use `forceDevExport: true` to enable telemetry export for local runs. Navigate to the Google Cloud Logs, Metrics, or Trace Explorer to view telemetry. Alternatively, navigate to the [Firebase AI Monitoring dashboard (private preview)](https://forms.gle/Lp5S1NxbZUXsWc457) for an AI-idiomatic view of telemetry.

0 comments on commit 54d754a

Please sign in to comment.