https://github.com/ahus1/prometheus-hystrix
This is an implementation of a HystrixMetricsPublisher that publishes metrics using the Prometheus java client.
https://github.com/ahus1/prometheus-hystrix
hystrix java prometheus prometheus-exporter
Last synced: 18 days ago
JSON representation
This is an implementation of a HystrixMetricsPublisher that publishes metrics using the Prometheus java client.
- Host: GitHub
- URL: https://github.com/ahus1/prometheus-hystrix
- Owner: ahus1
- License: apache-2.0
- Created: 2014-03-25T21:49:41.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2025-02-27T17:32:49.000Z (about 2 months ago)
- Last Synced: 2025-03-28T19:11:22.420Z (25 days ago)
- Topics: hystrix, java, prometheus, prometheus-exporter
- Language: Java
- Size: 256 KB
- Stars: 102
- Watchers: 46
- Forks: 36
- Open Issues: 1
-
Metadata Files:
- Readme: README.adoc
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
= prometheus-hystrix-metrics-publisher
This is an implementation of a http://netflix.github.com/Hystrix/javadoc/index.html?com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisher.html[HystrixMetricsPublisher]
that publishes metrics using Prometheus' https://github.com/prometheus/client_java[SimpleClient].image:https://img.shields.io/maven-central/v/de.ahus1.prometheus.hystrix/prometheus-hystrix.svg[link=https://mvnrepository.com/artifact/de.ahus1.prometheus.hystrix/prometheus-hystrix]
image:https://github.com/ahus1/prometheus-hystrix/workflows/Java%20CI%20with%20Maven/badge.svg?branch=master[Build Status,link=https://github.com/ahus1/prometheus-hystrix/actions?query=workflow%3A%22Java+CI+with+Maven%22+branch%3Amaster]See the https://github.com/Netflix/Hystrix/wiki/Metrics-and-Monitoring[Netflix Metrics & Monitoring] Wiki for more information.
_This continues the work started at SoundCloud._
The roadmap is the following:
* Adopt best practices in https://prometheus.io/docs/practices/naming/[naming metrics].
* Support ongoing development
Non-Goals:
* merge this project with https://github.com/prometheus/client_java[Prometheus Java Simple Client], as Hystrix is in maintenance mode and is no longer actively developed by Netflix, see the https://github.com/Netflix/Hystrix#hystrix-status[Status message in its GitHub repo].
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.
[source,xml]
----de.ahus1.prometheus.hystrix
prometheus-hystrix
4.x.x----
Register the metrics publisher for your application's namespace and the default Prometheus CollectorRegistry with Hystrix.
[source,java]
----
import com.soundcloud.prometheus.hystrix.HystrixPrometheusMetricsPublisher;// ...
HystrixPrometheusMetricsPublisher.register();
----Register the publisher for your application's namespace with your own Prometheus CollectorRegistry with Hystrix.
[source,java]
----
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_.To preview the contents in your browser, use the following link: +
https://oss.sonatype.org/content/repositories/snapshots/de/ahus1/prometheus/hystrix/prometheus-hystrix/[source,xml]
----
snapshots-repo
https://oss.sonatype.org/content/repositories/snapshots
false
true
----
== 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 athttp://www.apache.org/licenses/LICENSE-2.0[http://www.apache.org/licenses/LICENSE-2.0]
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.