Skip to content

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.


ComponentPurposeActivated byDefault (official builds)Default (self-builds)
OpenTelemetry (OTel)Session metrics, token usage, tool callsMAGIA_OTEL_ENDPOINT build-time env varEnabled (collector runs locally)Collector runs locally; data stays local — no export endpoint
SentryCrash reports and error diagnosticsMAGIA_SENTRY_DSN build-time env varEnabledDisabled (no DSN compiled in)
PostHogAnonymous product analyticsMAGIA_POSTHOG_KEY build-time env varEnabledDisabled (no key compiled in)

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:

ProtocolDescriptionUsed by
HTTP (OTLP/HTTP)REST over TCP; default port 4318Agent processes via OTEL_EXPORTER_OTLP_ENDPOINT env var
gRPC (OTLP/gRPC)Protobuf over a Unix socketAgent 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.

MetricDescription
input_tokensNumber of input tokens consumed by the model in a session.
output_tokensNumber of output tokens generated.
cache_read_tokensNumber of tokens served from the prompt cache.
cache_creation_tokensNumber of tokens written to the prompt cache.
total_cost_usdEstimated USD cost of the session (computed from token counts and model pricing).
context_window_usedFraction of the model’s context window consumed (0.0–1.0).
context_window_sizeTotal context window capacity in tokens for the active model.
EventDescriptionControlled by
Tool call start / endTool name, start time, duration, and status (success, error, pending).Always collected when OTel is enabled.
User promptsThe text of user messages sent to the agent.otelLogUserPrompts (default: off).
Tool call detailsArguments and outputs of tool calls.otelLogToolDetails (default: off).
SettingKeyDefaultDescription
Enable collectorotelEnabledtrueStart 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 portotelCollectorPort4318TCP port for the HTTP OTLP collector.
Metric export intervalotelMetricExportIntervalMs5000How often (ms) metric batches are flushed.
Logs export intervalotelLogsExportIntervalMs2000How often (ms) log record batches are flushed.
Log user promptsotelLogUserPromptsfalseInclude prompt text in log records.
Log tool detailsotelLogToolDetailsfalseInclude tool arguments and results in log records.

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 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.

  • Self-builds: No action needed. Sentry is not compiled in.
  • Official builds: Toggle Settings → Telemetry → Crash Reporting off. This sets crashReportingEnabled: false and the SDK will not send any reports.

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.

  • Self-builds: No action needed. PostHog is not compiled in.
  • Official builds: Toggle Settings → Telemetry → Analytics off. This sets analyticsEnabled: false and the client will not send any events.

ScenarioWhat to do
Self-build (source)Nothing — all remote telemetry is disabled by default.
Official build — disable everythingTurn off Crash Reporting, Analytics, and OpenTelemetry in Settings → Telemetry.
Official build — keep local metrics onlyDisable Crash Reporting and Analytics; keep OpenTelemetry enabled. Data stays on-device.
Custom OTel export to your own backendSet MAGIA_OTEL_ENDPOINT at build time to your collector URL and keep otelEnabled: true.