forked from Netflix/Hystrix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Netflix#199 from fkjellberg/codahale-metrics
Add new module for publishing metrics to Coda Hale Metrics version 3
- Loading branch information
Showing
7 changed files
with
568 additions
and
1 deletion.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
hystrix-contrib/hystrix-codahale-metrics-publisher/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# hystrix-codahale-metrics-publisher | ||
|
||
This is an implementation of [HystrixMetricsPublisher](http://netflix.github.com/Hystrix/javadoc/index.html?com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisher.html) that publishes metrics using [Coda Hale Metrics](http://metrics.codahale.com) version 3. If you are using Yammer Metrics version 2, please use the [hystrix-yammer-metrics-publisher](../hystrix-yammer-metrics-publisher) module instead. | ||
|
||
See the [Metrics & Monitoring](https://github.com/Netflix/Hystrix/wiki/Metrics-and-Monitoring) Wiki for more information. | ||
|
||
# Binaries | ||
|
||
Binaries and dependency information for Maven, Ivy, Gradle and others can be found at [http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22hystrix-codahale-metrics-publisher%22). | ||
|
||
Example for Maven: | ||
|
||
```xml | ||
<dependency> | ||
<groupId>com.netflix.hystrix</groupId> | ||
<artifactId>hystrix-codahale-metrics-publisher</artifactId> | ||
<version>1.1.2</version> | ||
</dependency> | ||
``` | ||
|
||
and for Ivy: | ||
|
||
```xml | ||
<dependency org="com.netflix.hystrix" name="hystrix-codahale-metrics-publisher" rev="1.1.2" /> | ||
``` |
24 changes: 24 additions & 0 deletions
24
hystrix-contrib/hystrix-codahale-metrics-publisher/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apply plugin: 'java' | ||
apply plugin: 'eclipse' | ||
apply plugin: 'idea' | ||
|
||
dependencies { | ||
compile project(':hystrix-core') | ||
compile 'com.codahale.metrics:metrics-core:3.0.1' | ||
} | ||
|
||
eclipse { | ||
classpath { | ||
// include 'provided' dependencies on the classpath | ||
plusConfigurations += configurations.provided | ||
downloadSources = true | ||
downloadJavadoc = true | ||
} | ||
} | ||
|
||
idea { | ||
module { | ||
// include 'provided' dependencies on the classpath | ||
scopes.COMPILE.plus += configurations.provided | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...com/netflix/hystrix/contrib/codahalemetricspublisher/HystrixCodaHaleMetricsPublisher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* 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 | ||
* | ||
* 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. | ||
*/ | ||
package com.netflix.hystrix.contrib.codahalemetricspublisher; | ||
|
||
import com.codahale.metrics.MetricRegistry; | ||
import com.netflix.hystrix.HystrixCircuitBreaker; | ||
import com.netflix.hystrix.HystrixCommandGroupKey; | ||
import com.netflix.hystrix.HystrixCommandKey; | ||
import com.netflix.hystrix.HystrixCommandMetrics; | ||
import com.netflix.hystrix.HystrixCommandProperties; | ||
import com.netflix.hystrix.HystrixThreadPoolKey; | ||
import com.netflix.hystrix.HystrixThreadPoolMetrics; | ||
import com.netflix.hystrix.HystrixThreadPoolProperties; | ||
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisher; | ||
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisherCommand; | ||
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisherThreadPool; | ||
|
||
/** | ||
* Coda Hale Metrics (https://github.com/codahale/metrics) implementation of {@link HystrixMetricsPublisher}. | ||
*/ | ||
public class HystrixCodaHaleMetricsPublisher extends HystrixMetricsPublisher { | ||
private final MetricRegistry metricRegistry; | ||
|
||
public HystrixCodaHaleMetricsPublisher(MetricRegistry metricRegistry) { | ||
this.metricRegistry = metricRegistry; | ||
} | ||
|
||
@Override | ||
public HystrixMetricsPublisherCommand getMetricsPublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandGroupKey, HystrixCommandMetrics metrics, HystrixCircuitBreaker circuitBreaker, HystrixCommandProperties properties) { | ||
return new HystrixCodaHaleMetricsPublisherCommand(commandKey, commandGroupKey, metrics, circuitBreaker, properties, metricRegistry); | ||
} | ||
|
||
@Override | ||
public HystrixMetricsPublisherThreadPool getMetricsPublisherForThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolMetrics metrics, HystrixThreadPoolProperties properties) { | ||
return new HystrixCodaHaleMetricsPublisherThreadPool(threadPoolKey, metrics, properties, metricRegistry); | ||
} | ||
} |
Oops, something went wrong.