comon_otel 0.0.1-alpha.1 copy "comon_otel: ^0.0.1-alpha.1" to clipboard
comon_otel: ^0.0.1-alpha.1 copied to clipboard

OpenTelemetry SDK foundation for Dart with traces, metrics, logs, context propagation, and OTLP exporters.

example/comon_otel_example.dart

import 'package:comon_otel/comon_otel.dart';

Future<void> main() async {
  await Otel.init(
    serviceName: 'comon-otel-example',
    exporter: OtelExporter.console,
  );

  final requestCounter = Otel.instance.meter.createIntCounter(
    'example.requests',
    description: 'Counts processed example requests',
  );

  final answer = await Otel.instance.tracer.traceAsync<int>(
    'example.compute_answer',
    attributes: const <String, Object>{'example.flow': 'quickstart'},
    fn: () async {
      requestCounter.add(1, attributes: const <String, Object>{'route': '/'});
      Otel.instance.logger.info('Computing example answer');
      return 42;
    },
  );

  await Otel.forceFlush();
  print('answer: $answer');

  await Otel.shutdown();
}
1
likes
160
points
31
downloads

Documentation

Documentation
API reference

Publisher

verified publisherserezhia.ru

Weekly Downloads

OpenTelemetry SDK foundation for Dart with traces, metrics, logs, context propagation, and OTLP exporters.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#opentelemetry #observability #tracing #metrics #logging

License

MIT (license)

Dependencies

archive, grpc, http, matcher

More

Packages that depend on comon_otel