GithubHelp home page GithubHelp logo

royalwang / prometheus-hystrix Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ahus1/prometheus-hystrix

0.0 1.0 0.0 265 KB

This is an implementation of a HystrixMetricsPublisher that publishes metrics using the Prometheus java client.

License: Apache License 2.0

Java 99.90% Batchfile 0.10%

prometheus-hystrix's Introduction

prometheus-hystrix-metrics-publisher

This is an implementation of a HystrixMetricsPublisher that publishes metrics using Prometheus' SimpleClient.

prometheus hystrix Build Status

See the Netflix Metrics & Monitoring Wiki for more information.

This continues the work started at SoundCloud.

The roadmap is the following:

Non-Goals:

To use this library you can use Java 6, 7 or 8. Later versions should work, but have not been tested yet - please create it ticket if you experience problems.

Continuous integration tests run on Java 8 only, but the build is parameterized to be Java 6 compatible. Animal sniffer is part of the build to ensure no APIs that are not part of JDK 6 are used.

USAGE

Include the most recent release from Maven Central in your build configuration.

<dependency>
    <groupId>de.ahus1.prometheus.hystrix</groupId>
    <artifactId>prometheus-hystrix</artifactId>
    <version>4.x.x</version>
</dependency>

Register the metrics publisher for your application’s namespace and the default Prometheus CollectorRegistry with Hystrix.

import com.soundcloud.prometheus.hystrix.HystrixPrometheusMetricsPublisher;

// ...

HystrixPrometheusMetricsPublisher.register();

Register the publisher for your application’s namespace with your own Prometheus CollectorRegistry with Hystrix.

import com.soundcloud.prometheus.hystrix.HystrixPrometheusMetricsPublisher;
import io.prometheus.client.CollectorRegistry;

// ...

CollectorRegistry registry = // ...
HystrixPrometheusMetricsPublisher.builder().withRegistry(registry).buildAndRegister();

For all advanced options, please use the .builder() like in the previous example.

STATISTICS

Most metrics are similar to the standard Hystrix are straightforward to use.

The events emitted by each HystrixCommand might need a little bit more explanation: Each HystrixCommand can create multiple events, but only one terminal event. The following provides the rate of each event type per command:

irate(hystrix_command_event_total [1m])

The following provides the percentage of the events over all commands:

irate(hystrix_command_event_total [1m])
/ ignoring(event) group_left
sum(irate(hystrix_command_event_total{terminal='true'} [1m]))
  by (command_group, command_name, instance, job, terminal)

You can add the following suffix condition to hide all events that never happened in your environment:

... AND hystrix_command_event_total > 0

DEVELOPMENT

Run ./mvnw package to compile, test and JARs locally.

The most recent development version (based on the master branch on GitHub) is available from the Sonatype OSS Snapshot Repository. To use it, include the following repository in your pom.xml.

<repositories>
    <repository>
        <id>snapshots-repo</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        <releases><enabled>false</enabled></releases>
        <snapshots><enabled>true</enabled></snapshots>
    </repository>
</repositories>

LICENSE

Copyright 2014-2017 SoundCloud, Inc., Alexander Schwartz and Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

prometheus-hystrix's People

Contributors

ahus1 avatar dependabot[bot] avatar tomcz avatar beorn7 avatar dadadom avatar benzvan 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.