> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Telemetry: What Buckle Collects and Where

> Self-hosted Buckle sends no telemetry. On Cloud, the gateway reports credential-injection events to PostHog, never secrets or request bodies.

## Overview

Self-hosted Buckle (Community and Enterprise) sends **no telemetry** to Buckle or any third party. There is nothing to opt out of.

The only analytics in the codebase are product analytics for **Buckle Cloud**, and they stay off unless the deployment explicitly configures them.

## Self-hosted deployments

The gateway contains one analytics sink, and it is **disabled unless both `POSTHOG_API_KEY` and `POSTHOG_HOST` are set** in the gateway's environment. Neither variable has a default, the self-hosted Docker Compose file doesn't set them, and the images don't bake them in. A key without a host is also treated as off.

The web dashboard works the same way: its analytics only initialize when `NEXT_PUBLIC_POSTHOG_KEY` and `NEXT_PUBLIC_POSTHOG_HOST` are set at build time, which self-hosted builds don't do.

> [!NOTE]
>
> Self-hosted Buckle still records request activity in **your own PostgreSQL database** (the `request_logs` table behind the Activity page). That data never leaves your environment.

## Buckle Cloud

On Cloud, the gateway sends an `injection` event to [PostHog](https://posthog.com) for each request where it injected a credential. Each event carries:

| Property | What it is |
| - | - |
| `distinct_id` | Your workspace ID |
| `agent_id`, `agent_name` | The agent that made the request |
| `host`, `provider`, `method`, `path`, `status` | The destination and the response status |
| `latency_ms`, `injection_count` | How long the request took and how many credentials were injected |
| `environment`, `gateway_version` | The deployment and gateway version |

Events are buffered and sent in batches every 5 seconds (or every 500 events), off the request path, so they add no latency.

## What is never collected

* Secret or credential values
* Request or response bodies
* Database query text (it can appear in your own activity log, but is never sent to analytics)

## How it works

Telemetry lives in the gateway, in the [`telemetry` crate](https://github.com/trybuckle/buckle/tree/main/apps/gateway/crates/telemetry). It starts when the gateway starts and runs one background loop that:

1. Writes request activity to your PostgreSQL database (every edition).
2. Sends `injection` events to PostHog, only when `POSTHOG_API_KEY` and `POSTHOG_HOST` are both set.
3. Updates usage counters and budget spend in your cache and database.

## Data processor

When enabled on Cloud, events are sent to [PostHog](https://posthog.com) (US region). PostHog's privacy policy is available at [posthog.com/privacy](https://posthog.com/privacy).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.