Skip to content

tauri-plugin-otelOpenTelemetry for Tauri v2

Traces and logs over OTLP/HTTP from the Rust side and the webview, under one resource and behind one export floor.

tauri-plugin-otel

At a glance โ€‹

rust
tauri::Builder::default()
    .plugin(
        tauri_plugin_otel::Builder::new("my-app", "production")
            .endpoint("https://otel.example.com") // `/v1/traces` and `/v1/logs` are appended
            .build(),
    )
    .run(tauri::generate_context!())
    .expect("error while running tauri application");
ts
import { BatchSpanProcessor, WebTracerProvider } from '@opentelemetry/sdk-trace-web'
import { TauriSpanExporter, captureErrors, log, tracedInvoke } from 'tauri-plugin-otel-api'

const provider = new WebTracerProvider({
  spanProcessors: [new BatchSpanProcessor(new TauriSpanExporter())],
})
provider.register()
captureErrors()

log.info('listing editor opened', { listing: id }) // withheld unless an error follows
await tracedInvoke('save_listing', { draft }) // one trace, page to Rust

The plugin is two halves from one repository and one release tag: the Rust crate tauri-plugin-otel, and the webview package tauri-plugin-otel-api. Both are consumed by git tag, not from crates.io or npm. The current release is v0.1.2.

It exports traces and logs and nothing else. Metrics, offline buffering and configuration from OTEL_* environment variables are left out on purpose; see what it does not do.

Released under the MIT License.