opentracing 1.0.1

  • Readme
  • Changelog
  • Installing
  • 85

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

Changelog #

1.0.0 #

  • Initial version

Use this package as a library

1. Depend on it

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

  opentracing: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub 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';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 4, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health suggestions

Fix lib/src/global_tracer.dart. (-1.99 points)

Analysis of lib/src/global_tracer.dart reported 4 hints:

line 22 col 39: Unnecessary new keyword.

line 23 col 27: Unnecessary new keyword.

line 34 col 3: Unnecessary new keyword.

line 41 col 10: Unnecessary new keyword.

Fix lib/src/abstract_tracer.dart. (-1 points)

Analysis of lib/src/abstract_tracer.dart reported 2 hints:

line 37 col 12: Unnecessary new keyword.

line 81 col 12: Unnecessary new keyword.

Fix lib/src/noop_scope_manager.dart. (-1 points)

Analysis of lib/src/noop_scope_manager.dart reported 2 hints:

line 23 col 16: Unnecessary new keyword.

line 29 col 14: Unnecessary new keyword.

Fix additional 5 files with analysis or formatting issues. (-3.50 points)

Additional issues in the following files:

  • lib/src/noop_span.dart (2 hints)
  • lib/src/span_context.dart (2 hints)
  • lib/src/constants.dart (1 hint)
  • lib/src/noop_scope.dart (1 hint)
  • lib/src/noop_tracer.dart (1 hint)

Maintenance suggestions

Package is getting outdated. (-13.97 points)

The package was last published 59 weeks ago.

Homepage URL is insecure. (-5 points)

Update the homepage field and use a secure (https) URL.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and opentracing.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.24.3<3.0.0
meta ^1.1.0 1.1.8
Dev dependencies
build_runner >=0.6.0 <1.0.0
build_test >=0.9.0 <1.0.0
build_web_compilers >=0.2.0 <1.0.0
coverage >=0.10.0 <0.13.0
test >=0.12.30 <2.0.0