Git Product home page Git Product logo

metrics-gelf's Introduction

GELF Metrics Reporter

Build Status Maven Central

This is a reporter for the Dropwizard Metrics library, similar to the Graphite or Ganglia reporters, except that it reports to a GELF-capable server, such as Graylog.

As this metrics reporter is using GELF for sending data into Graylog, the only library needed is gelfclient.

Installation

You can simply add a dependency in your pom.xml (or whatever dependency resolution system you might have)

<dependency>
  <groupId>org.graylog.metrics</groupId>
  <artifactId>metrics-gelf</artifactId>
  <version>${metrics-gelf.version}</version>
</dependency>

Configuration

final MetricRegistry registry = new MetricRegistry();
GelfReporter reporter = GelfReporter.forRegistry(registry)
    .host(new InetSocketAddress("127.0.0.1", 12201))
    .build();
reporter.start(60, TimeUnit.SECONDS);

Define your metrics and registries as usual

private final Meter incomingRequestsMeter = registry.meter("incoming-http-requests");

// in your app code
incomingRequestsMeter.mark(1);

Format of metrics

This is how the serialized metrics looks like in Graylog:

Counter

{
  "message": "name=usa-gov-heartbearts type=COUNTER",
  "name": "usa-gov-heartbearts",
  "type": "COUNTER",
  "timestamp": "2016-07-20T09:29:58.000",
  "count": 18
}

Timer

{
  "message" : "name=bulk-request-timer type=TIMER",
  "name" : "bulk-request-timer",
  "type" : "TIMER",
  "timestamp" : "2016-07-20T09:43:58.000",
  "count" : 114,
  "max" : 109.681,
  "mean" : 5.439666666666667,
  "median" : 5.439666666666667,
  "min" : 2.457,
  "p50" : 4.3389999999999995,
  "p75" : 5.0169999999999995,
  "p95" : 8.37175,
  "p98" : 9.6832,
  "p99" : 94.68429999999942,
  "p999" : 109.681,
  "stddev" : 9.956913151098842,
  "m15_rate" : 0.10779994503690074,
  "m1_rate" : 0.07283351433589833,
  "m5_rate" : 0.10101298115113727,
  "mean_rate" : 0.08251056571678642,
  "duration_unit" : "milliseconds",
  "rate_unit" : "second"
}

Meter

{
  "message" : "name=usagov-incoming-requests type=METER",
  "name" : "usagov-incoming-requests",
  "type" : "METER",
  "timestamp" : "2016-07-20T09:29:58.000",
  "count" : 224,
  "m1_rate" : 0.3236309568191993,
  "m5_rate" : 0.45207208204948995,
  "m15_rate" : 0.5014348927301423,
  "mean_rate" : 0.4135529888278531,
  "rate_unit" : "second"
}

Histogram

{
  "message" : "name=my-histgram type=HISTOGRAM",
  "name" : "my-histgram",
  "type" : "HISTOGRAM",
  "timestamp" : "2016-07-20T09:29:58.000",
  "count" : 114,
  "min" : 2.457,
  "max" : 109.681,
  "mean" : 5.439666666666667,
  "stddev" : 9.956913151098842,
  "median" : 5.439666666666667,
  "p50" : 4.3389999999999995,
  "p75" : 5.0169999999999995,
  "p95" : 8.37175,
  "p98" : 9.6832,
  "p99" : 94.68429999999942,
  "p999" : 109.681
}

Gauge

{
  "message" : "name=usagov-incoming-requests type=GAUGE",
  "name" : "usagov-incoming-requests",
  "type" : "GAUGE",
  "timestamp" : "2016-07-20T09:29:58.000",
  "value" : 123
}

License

Copyright (c) 2016 Graylog, Inc.

This library is licensed under the Apache License, Version 2.0.

See http://www.apache.org/licenses/LICENSE-2.0.html or the LICENSE file in this repository for the full license text.

metrics-gelf's People

Stargazers

Jari avatar Gaurav Sehgal avatar  avatar Frank Versnel avatar

Watchers

Bernd Ahlers avatar Dennis Oelkers avatar Kay Roepke avatar Konrad Merz avatar James Cloos avatar Othello Maurer avatar Ousmane SAMBA avatar Tomas Dvorak avatar  avatar Rob Curtis avatar Fagani Hajizada avatar William Trelawny avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.