GithubHelp home page GithubHelp logo

kamon-prometheus's Introduction

Prometheus Integration

Build Status Gitter Maven Central

Getting Started

Kamon Prometheus is currently available for Scala 2.10, 2.11 and 2.12.

Supported releases and dependencies are shown below.

kamon status jdk scala
1.1.1 stable 1.8+ 2.10, 2.11, 2.12

Adding the Reporter to your project

First, add the dependency to your build. For SBT that would look like this:

libraryDependencies += "io.kamon" %% "kamon-prometheus" % "1.1.1"

and for Maven:

<dependency>
    <groupId>io.kamon</groupId>
    <artifactId>kamon-prometheus_2.12</artifactId>
    <version>1.1.1</version>
</dependency>

Then, start the reporter when your application starts:

import kamon.prometheus.PrometheusReporter
Kamon.addReporter(new PrometheusReporter())

That's it! You can now go to `http://localhost:9095 and see the metrics. Check the reference.conf file for more details on what settings can be configured for the module.

Consuming the metrics

Finally, all you need to do is configure a scrape configuration in Prometheus. The following snippet is a minimal example that shold work with the minimal server from the previous section.

A minimal Prometheus configuration snippet
------------------------------------------------------------------------------
scrape_configs:
  - job_name: kamon-prometheus
    static_configs:
      - targets: ['localhost:9095']
------------------------------------------------------------------------------

Custom environment tags

Kamon allows you to provide custom environment tags to all your metrics by configuring kamon.environment.tags in your application.conf, e.g.

kamon.environment.tags {
  custom-id = "test1"
  env = staging
}

In order to include these tags in your Prometheus metrics as well, you need to activate this feature for the PrometheusReporter by setting

kamon.prometheus.include-environment-tags = yes

in your application.conf as well, yielding, for example

# TYPE some_metric_seconds_total counter
some_metric_seconds_total{custom_id="test1",env="staging"} 10.0
# TYPE some_metric_seconds gauge
some_metric_seconds{custom_id="test1",env="staging"} 10.0

Note that environment tags always have precedence over any other custom tag that may have been set by the application at runtime.

kamon-prometheus's People

Contributors

andreas-schroeder avatar casperkoning avatar dpsoft avatar fchiron avatar ilyshav avatar ivantopo avatar liff avatar piotrkosecki avatar stephenking avatar

Watchers

 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.