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

Dio interceptor package for comon_otel with request tracing and propagation.

example/comon_otel_dio_example.dart

import 'package:comon_otel/comon_otel.dart';
import 'package:comon_otel_dio/comon_otel_dio.dart';
import 'package:dio/dio.dart';

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

  final dio = Dio()
    ..interceptors.add(
      OtelDioInterceptor(
        captureRequestHeaders: const <String>{'x-request-id'},
        captureResponseHeaders: const <String>{'content-type'},
      ),
    );

  try {
    final response = await dio.get<dynamic>(
      'https://httpbin.org/get',
      options: Options(
        headers: const <String, String>{'x-request-id': 'example-request-1'},
      ),
    );

    print('Response status: ${response.statusCode}');
  } finally {
    await Otel.shutdown();
  }
}
0
likes
160
points
30
downloads

Documentation

Documentation
API reference

Publisher

verified publisherserezhia.ru

Weekly Downloads

Dio interceptor package for comon_otel with request tracing and propagation.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#opentelemetry #dio #http #tracing #observability

License

MIT (license)

Dependencies

comon_otel, dio

More

Packages that depend on comon_otel_dio