# How the agentsview Telemetry Ping Works and How to Disable It

> Learn how the agentsview telemetry ping works and how to disable it easily. Control data sharing for the kenn-io/agentsview daemon with simple environment variables.

- Repository: [Kenn Software/agentsview](https://github.com/kenn-io/agentsview)
- Tags: how-to-guide
- Published: 2026-06-12

---

**TLDR:** The agentsview daemon sends a lightweight "daemon_active" heartbeat to PostHog every 24 hours, but you can disable it entirely by setting `AGENTSVIEW_TELEMETRY_ENABLED=0` or unsetting the variable before starting the service.

The kenn-io/agentsview repository includes a telemetry system that periodically reports a heartbeat to track active daemon instances. Understanding how this agentsview telemetry ping functions helps operators maintain privacy compliance and manage network traffic in restricted environments. The implementation relies on environment-based feature flags and a configurable reporter pattern that requires no code changes to disable.

## How the agentsview Telemetry Ping Works

The telemetry flow follows a four-stage pipeline from initialization to transmission, orchestrated through the main entry point and internal telemetry package.

### Reporter Initialization in cmd/agentsview/main.go

When the CLI starts, it constructs a telemetry reporter using `NewReporterOrDisabled`:

```go
telemetryReporter := telemetry.NewReporterOrDisabled(telemetry.Options{
    DataDir: cfg.DataDir,
    Version: cfg.Version,
    Commit:  cfg.Commit,
})

```

This call in [`cmd/agentsview/main.go`](https://github.com/kenn-io/agentsview/blob/main/cmd/agentsview/main.go) (lines 129-137) determines whether the reporter will send events or operate as a no-op stub based on environment configuration.

### Environment Enable Check in internal/telemetry/telemetry.go

The enable flag is read from the `AGENTSVIEW_TELEMETRY_ENABLED` environment variable. In [`internal/telemetry/telemetry.go`](https://github.com/kenn-io/agentsview/blob/main/internal/telemetry/telemetry.go) (lines 18-44), the `EnabledFromEnv` function delegates to the Kit telemetry library:

```go
const EnabledEnv = "AGENTSVIEW_TELEMETRY_ENABLED"

func EnabledFromEnv() bool {
    return kittelemetry.PostHogTelemetryEnabledFromEnv(envPrefix)
}

```

If the variable is absent or evaluates to false, `NewReporter` returns a disabled reporter that silently discards all events.

### Periodic Ping Scheduler

After the HTTP server starts, `startTelemetryPings` launches a background goroutine that ticks every 24 hours:

```go
func startTelemetryPings(ctx context.Context, reporter *telemetry.Reporter) {
    go func() {
        ticker := time.NewTicker(telemetryPingInterval) // 24h
        defer ticker.Stop()
        for {
            select {
            case <-ctx.Done():
                return
            case <-ticker.C:
                captureTelemetryPing(ctx, reporter)
            }
        }
    }()
}

```

This implementation in [`cmd/agentsview/main.go`](https://github.com/kenn-io/agentsview/blob/main/cmd/agentsview/main.go) (lines 289-306) ensures the ping runs independently of request handling.

### Event Capture and PostHog Transmission

Each tick invokes `captureTelemetryPing`, which forwards the event only if telemetry is enabled:

```go
func captureTelemetryPing(ctx context.Context, reporter *telemetry.Reporter) {
    if err := reporter.CaptureDaemonActive(ctx); err != nil {
        log.Printf("capture telemetry event: %v", err)
    }
}

```

The actual network call is performed by the Kit telemetry library. The reporter is created with the *daemon_active* event whitelisted in [`internal/telemetry/telemetry.go`](https://github.com/kenn-io/agentsview/blob/main/internal/telemetry/telemetry.go):

```go
func allowedEventOptions() []kittelemetry.PostHogOption {
    return []kittelemetry.PostHogOption{
        kittelemetry.WithAllowedEvent(EventDaemonActive),
    }
}

```

## How to Disable agentsview Telemetry

You can disable telemetry without modifying source code or recompiling the binary.

### Disable via Environment Variable

Set the `AGENTSVIEW_TELEMETRY_ENABLED` variable to a falsy value or unset it entirely:

```bash
export AGENTSVIEW_TELEMETRY_ENABLED=0
./agentsview

```

When this variable evaluates to false, `EnabledFromEnv` returns false, causing `NewReporterOrDisabled` to instantiate a disabled reporter that never sends data.

### Alternative Disabling Methods

- **Generic Kit flag:** The underlying Kit library also respects `POSTHOG_TELEMETRY_ENABLED`. Setting this to `0` disables reporting across all Kit-based tools.
- **Test mode:** Running the binary under `go test` automatically disables telemetry because the code checks `runningUnderGoTest()`.

## Summary

- The agentsview telemetry ping sends a "daemon_active" heartbeat to PostHog every 24 hours via the `telemetry.Reporter`.
- Reporter initialization occurs in [`cmd/agentsview/main.go`](https://github.com/kenn-io/agentsview/blob/main/cmd/agentsview/main.go) using `NewReporterOrDisabled`, which checks `AGENTSVIEW_TELEMETRY_ENABLED`.
- The periodic ticker runs in a background goroutine started by `startTelemetryPings`.
- Disable telemetry by setting `AGENTSVIEW_TELEMETRY_ENABLED=0` or unsetting the variable before launch.
- No code changes or recompilation are required to disable telemetry.

## Frequently Asked Questions

### What data does agentsview telemetry collect?

The agentsview telemetry system only captures a lightweight "daemon_active" event containing version and commit information. According to [`internal/telemetry/telemetry.go`](https://github.com/kenn-io/agentsview/blob/main/internal/telemetry/telemetry.go), the reporter is explicitly restricted to the `EventDaemonActive` event type via `allowedEventOptions()`, and no user data or query content is transmitted.

### How often does agentsview send telemetry pings?

The ping interval is set to 24 hours, defined by the `telemetryPingInterval` constant used in the ticker within `startTelemetryPings` in [`cmd/agentsview/main.go`](https://github.com/kenn-io/agentsview/blob/main/cmd/agentsview/main.go). The background goroutine wakes once per interval to invoke `captureTelemetryPing`.

### Can I disable telemetry without rebuilding agentsview?

Yes. Because the reporter is created through `NewReporterOrDisabled`, you only need to adjust the environment before launching the daemon. Setting `AGENTSVIEW_TELEMETRY_ENABLED=0` or unsetting the variable causes the reporter to fall back to a disabled state that never sends network requests.

### Does agentsview telemetry work offline?

If the daemon cannot reach PostHog, the `CaptureDaemonActive` call will return an error, which is logged but does not crash the service. However, if telemetry is enabled via the environment variable, the reporter will still attempt to send the ping on each tick, resulting in periodic connection errors in the logs until network connectivity is restored or telemetry is disabled.