Telemetry
Magia has three separate telemetry systems: a local OpenTelemetry collector, Sentry crash reporting, and PostHog analytics. All three are opt-in for self-builds: if the relevant environment variable is not set at compile time, that system is entirely disabled at runtime — no data leaves the machine.
Telemetry Components at a Glance
Section titled “Telemetry Components at a Glance”| Component | Purpose | Activated by | Default (official builds) | Default (self-builds) |
|---|---|---|---|---|
| OpenTelemetry (OTel) | Session metrics, token usage, tool calls | MAGIA_OTEL_ENDPOINT build-time env var | Enabled (collector runs locally) | Collector runs locally; data stays local — no export endpoint |
| Sentry | Crash reports and error diagnostics | MAGIA_SENTRY_DSN build-time env var | Enabled | Disabled (no DSN compiled in) |
| PostHog | Anonymous product analytics | MAGIA_POSTHOG_KEY build-time env var | Enabled | Disabled (no key compiled in) |
OpenTelemetry
Section titled “OpenTelemetry”Architecture
Section titled “Architecture”Magia embeds a lightweight OTLP collector inside the Tauri backend. Agent processes (Claude CLI, Gemini CLI, etc.) are started with OTEL_EXPORTER_OTLP_ENDPOINT pointing to this collector. The collector receives metrics and log records from agents and processes them in-process.
Two transport protocols are supported:
| Protocol | Description | Used by |
|---|---|---|
| HTTP (OTLP/HTTP) | REST over TCP; default port 4318 | Agent processes via OTEL_EXPORTER_OTLP_ENDPOINT env var |
| gRPC (OTLP/gRPC) | Protobuf over a Unix socket | Agent processes on platforms that support Unix sockets |
The port can be configured with otelCollectorPort (default 4318). If that port is unavailable, the server tries the next available port automatically.
What Data is Collected
Section titled “What Data is Collected”Metrics
Section titled “Metrics”| Metric | Description |
|---|---|
input_tokens | Number of input tokens consumed by the model in a session. |
output_tokens | Number of output tokens generated. |
cache_read_tokens | Number of tokens served from the prompt cache. |
cache_creation_tokens | Number of tokens written to the prompt cache. |
total_cost_usd | Estimated USD cost of the session (computed from token counts and model pricing). |
context_window_used | Fraction of the model’s context window consumed (0.0–1.0). |
context_window_size | Total context window capacity in tokens for the active model. |
Logs / Events
Section titled “Logs / Events”| Event | Description | Controlled by |
|---|---|---|
| Tool call start / end | Tool name, start time, duration, and status (success, error, pending). | Always collected when OTel is enabled. |
| User prompts | The text of user messages sent to the agent. | otelLogUserPrompts (default: off). |
| Tool call details | Arguments and outputs of tool calls. | otelLogToolDetails (default: off). |
Configuration Settings
Section titled “Configuration Settings”| Setting | Key | Default | Description |
|---|---|---|---|
| Enable collector | otelEnabled | true | Start the local OTLP collector on app launch. Disabling this also removes the export endpoint from agent processes, so no metrics are collected at all. |
| Collector port | otelCollectorPort | 4318 | TCP port for the HTTP OTLP collector. |
| Metric export interval | otelMetricExportIntervalMs | 5000 | How often (ms) metric batches are flushed. |
| Logs export interval | otelLogsExportIntervalMs | 2000 | How often (ms) log record batches are flushed. |
| Log user prompts | otelLogUserPrompts | false | Include prompt text in log records. |
| Log tool details | otelLogToolDetails | false | Include tool arguments and results in log records. |
Disabling OTel
Section titled “Disabling OTel”Toggle Settings → Telemetry → Enable OpenTelemetry off, or set otelEnabled: false in settings.json. Agent processes will not receive an OTEL_EXPORTER_OTLP_ENDPOINT variable and will not attempt to export telemetry.
Sentry (Crash Reporting)
Section titled “Sentry (Crash Reporting)”Sentry captures unhandled panics and JavaScript errors. Reports include a stack trace, the OS version, the Magia version, and any Sentry breadcrumbs set before the crash. No user-generated content (prompts, code, file paths) is included in crash reports.
Sentry is activated at compile time by the MAGIA_SENTRY_DSN environment variable. If this variable is empty or absent, the Sentry SDK is never initialized — not even in a disabled state.
Disabling Sentry
Section titled “Disabling Sentry”- Self-builds: No action needed. Sentry is not compiled in.
- Official builds: Toggle Settings → Telemetry → Crash Reporting off. This sets
crashReportingEnabled: falseand the SDK will not send any reports.
PostHog (Analytics)
Section titled “PostHog (Analytics)”PostHog collects anonymous usage events such as:
- App launch and session counts
- Feature adoption signals (e.g. which providers are used)
- Funnel events (e.g. onboarding completion)
Events do not include content from sessions, prompts, file contents, or any personally identifiable information. A random anonymous identifier is generated per installation.
PostHog is activated at compile time by the MAGIA_POSTHOG_KEY environment variable. If this variable is empty or absent, the PostHog client is never initialized.
Disabling PostHog
Section titled “Disabling PostHog”- Self-builds: No action needed. PostHog is not compiled in.
- Official builds: Toggle Settings → Telemetry → Analytics off. This sets
analyticsEnabled: falseand the client will not send any events.
Summary: How to Fully Opt Out
Section titled “Summary: How to Fully Opt Out”| Scenario | What to do |
|---|---|
| Self-build (source) | Nothing — all remote telemetry is disabled by default. |
| Official build — disable everything | Turn off Crash Reporting, Analytics, and OpenTelemetry in Settings → Telemetry. |
| Official build — keep local metrics only | Disable Crash Reporting and Analytics; keep OpenTelemetry enabled. Data stays on-device. |
| Custom OTel export to your own backend | Set MAGIA_OTEL_ENDPOINT at build time to your collector URL and keep otelEnabled: true. |