statsd 0.1.2

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 31

StatsD client for Dart

Build Status Coverage Status Pub package License

A StatsD client library implemented in Dart.

Installation

Use git dependency in your pubspec.yaml:

dependencies:
  statsd: "^0.1.1"

And then import it as usual:

import 'package:statsd/statsd.dart';

Usage

Basic example:

import 'dart:io';
import 'dart:async';
import 'package:statsd/statsd.dart';

Future main() async {
  var connection = await StatsdConnection.connect(
    Uri.parse('udp://127.0.0.1:5678'));
  var client = new StatsdClient(connection, prefix: 'myapp');
  // Sending counters:
  await client.count('metric1'); // increment `myapp.metric1` by 1
  await client.count('metric1', -1); // decrement `myapp.metric1` by 1
  await client.count('metric1', 5, 0.1); // increment `myapp.metric1` by 5 with 0.1 sample rate

  // Sending timings:
  var stopwatch = new Stopwatch();
  stopwatch.start();
  // client will use value of stopwatch.elapsedMilliseconds
  await client.time('response-time', stopwatch);

  // Sending gauges:
  await client.gauge('metric2', 428); // sets gauge value to 428
  await client.gaugeDelta('metric2', 3); // increments value by 3
  await client.gaugeDelta('metric2', -10); // decrements value by 10

  // Sending sets:
  await client.set('uniques', 345);

  // Sending multiple metrics at once:
  var batch = client.batch();
  batch
    ..time('response-time', stopwatch)
    ..count('total-requests', 3)
    ..set('metric1', 56);
  await batch.send();

  // Make sure to close the connection when done:
  connection.close();
}

Current limitations:

  • Only UDP connections are supported at this moment.

License

BSD-2

Change Log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

[Unreleased]

[0.1.1]

  • added logger (name 'statsd') as well as some logging for UDP connection.
  • added possibility to set prefix for metric names in StatsdClient.
  • fixed bug in UDP connection when it was binding to the same port as Statsd server.

[0.1.0]

  • initial version

1. Depend on it

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


dependencies:
  statsd: "^0.1.2"

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:statsd/statsd.dart';
        
Version Uploaded Documentation Archive
0.1.2 Feb 19, 2016 Go to the documentation of statsd 0.1.2 Download statsd 0.1.2 archive
0.1.1 Jan 8, 2016 Go to the documentation of statsd 0.1.1 Download statsd 0.1.1 archive
0.1.0 Jan 8, 2016 Go to the documentation of statsd 0.1.0 Download statsd 0.1.0 archive

Analysis

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

Scores

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

Platforms

Detected platforms: Flutter, other

Primary library: package:statsd/statsd.dart with components: io.

Suggestions

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • 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.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use statsd.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.12.0 <2.0.0
logging ^0.11.2 0.11.3+1
Dev dependencies
dart_coveralls ^0.4.0
mockito ^0.11.0
test ^0.12.6+1