opentracing 0.2.1

  • Installing
  • Versions
  • 74

OpenTracing API for Dart

This library is the Open Tracing API written in Dart. It is intended for use both on the server and in the browser.

Required Reading

To fully understand this platform API, it's helpful to be familiar with the OpenTracing project and terminology more generally.

Quick Start

Add the package to your pubspec:

  opentracing: ^1.0.0

In your dart code, add instrumentation to the operations to be tracked. This is composed primarily of using "spans" around operations of interest and adding log statements to capture useful data relevant to those operations.

  var tracer = globalTracer();
  Span span = tracer.startSpan('http_request');

  HttpRequest.getString('').then((String result){
    span.log('data_received', payload: result);
    span.log('request_error', payload: error);

The default behavior of the opentracing package is to act as a "no-op" implementation.

To capture and make the tracing data actionable, the Tracer object should be initialized with the OpenTracing implementation of your choice as in the example code below:

    initGlobalTracer(new CustomTracer());

Note: The underlying implementation object is shared between all inclusions of the opentracing package, so initGlobalTracer needs to only be called once during initialization.

Development Information

See the OpenTracing website for general information on contributing to OpenTracing.

The project examples are run by . Run:

pub serve --hostname=localhost --port=9000 example

Dart OpenTracing Implementations

OpenTracing tracer implementations

This section is intended for developers wishing to implement their own tracers. Developers who simply wish to use OpenTracing can safely ignore this information.

Custom tracer implementation

Implementations can implement Tracer, extend Span, and implement or extend the other API classes to build a OpenTracing tracer.

See basictracer-dart for an example.

API compatibility testing

Coming soon / todo



  • Initial version

1. Depend on it

Add this to your package's pubspec.yaml file:

  opentracing: "^0.2.1"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:opentracing/opentracing.dart';
Version Uploaded Documentation Archive
0.2.1 Jul 11, 2017 Go to the documentation of opentracing 0.2.1 Download opentracing 0.2.1 archive


This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1


Describes how popular the package is relative to other packages. [more]
47 / 100
Code health derived from static analysis. [more]
100 / 100
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:opentracing/opentracing.dart.


  • Fix .analysis_options.

    We were unable to parse .analysis_options.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use opentracing.dart.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.

  • Enable strong mode analysis.

    Strong mode helps you to detect bugs and potential issues earlier.Start your analysis_options.yaml file with the following:

      strong-mode: true


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.23.0 <2.0.0
Dev dependencies
coverage ^0.7.3
dart_dev ^1.7.7
dart_style ^0.2.4
dartdoc ^0.9.0
github ^3.0.0
json_schema ^1.0.3
test ^0.12.0
w_transport ^3.0.0