dartastic_opentelemetry_api
0.12.0, released 6 weeks ago by dartastic.io
A Dart OpenTelemetry API that provides a no‑op implementation and strict spec compliance.
WASM-ready
What it does
It defines the OpenTelemetry API for Dart and Flutter, allowing developers to instrument code with traces, spans, and metrics. The API can be used alone for no‑op behavior or with an SDK for full telemetry collection.
AI-written summary of version 0.12.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a vendor‑neutral, spec‑compliant OpenTelemetry API for Dart/Flutter.
- You want a no‑op implementation for testing or minimal setups.
- You plan to use the accompanying dartastic_opentelemetry SDK for full functionality.
Skip it when
- You only need a lightweight tracing library without full OpenTelemetry support.
- You are already using another OpenTelemetry implementation that includes both API and SDK.
Strengths
- Strict adherence to the OpenTelemetry specification.
- Supports all platforms including web.
- Provides a no‑op implementation for safe inclusion without an SDK.
Weaknesses
- Requires an additional SDK for real telemetry collection.
- No built‑in exporters or instrumentation helpers.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Add to pubspec.yaml: `dartastic_opentelemetry_api: ^0.12.0` and import `package:dartastic_opentelemetry_api/dartastic_opentelemetry_api.dart`.
```dart
import 'package:dartastic_opentelemetry_api/dartastic_opentelemetry_api.dart';
void main() {
// No‑op API usage
final tracer = OTel.tracerProvider.getTracer('example');
final span = tracer.spanBuilder('mySpan').startSpan();
span.end();
}
```Works with
Packages commonly used together with dartastic_opentelemetry_api: ones it builds on, ones built on it, and its own family.
- webdartastic_opentelemetry_api depends on itLightweight bindings for browser APIs via JS interop
- fixnumdartastic_opentelemetry_api depends on itProvides 32‑ and 64‑bit signed fixed‑width integer types for Dart.
- dartastic_opentelemetryBuilt on dartastic_opentelemetry_apiOpenTelemetry SDK for Dart and Flutter for distributed tracing, metrics, and context propagation.
- embraceBuilt on dartastic_opentelemetry_apiA comprehensive observability and monitoring platform for iOS and Android apps.