Skip to content
pubscout

dartastic_opentelemetry

0.12.0, released 6 weeks ago by dartastic.io

OpenTelemetry SDK for Dart and Flutter for distributed tracing, metrics, and context propagation.

$ flutter pub add dartastic_opentelemetry
Source repository

What it does

Provides an OpenTelemetry SDK for Dart and Flutter applications. It enables distributed tracing, metrics collection, OTLP exporters (gRPC/HTTP), and context propagation for observability backends.

AI-written summary of version 0.12.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need standard OpenTelemetry distributed tracing and metrics in Dart or Flutter.
  • You want to send telemetry data to an OTLP-compatible backend.

Skip it when

  • You do not need observability or distributed tracing in your application.

Strengths

  • Standards-compliant with the OpenTelemetry specification.
  • Supports all Dart and Flutter targets including mobile, desktop, web, and wasm.
  • Provides context propagation across async gaps and Isolates.

Weaknesses

  • Requires manual code instrumentation or additional integration packages for automatic monitoring.
  • Windows targets need validation.

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
8

Requires initializing the OTel class via code or environment variables.

import 'package:dartastic_opentelemetry/dartastic_opentelemetry.dart';

Future<void> main() async {
  await OTel.initialize(serviceName: 'my-service');
  final tracer = OTel.tracer();
  final span = tracer.startSpan('my-operation');
  try {
    await tracer.withSpanAsync(span, doWork);
  } catch (e, stackTrace) {
    span.recordException(e, stackTrace: stackTrace);
    span.setStatus(SpanStatusCode.Error, e.toString());
    rethrow;
  } finally {
    span.end();
  }
  await OTel.shutdown();
}

Future<void> doWork() async {}

Alternatives

Packages that do the same job and could replace dartastic_opentelemetry.

Works with

Packages commonly used together with dartastic_opentelemetry: ones it builds on, ones built on it, and its own family.