Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
readd ReporterFactory, so we can write lazier spring configs
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
fcrepo-metrics/src/main/java/org/fcrepo/metrics/ReporterFactory.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,40 @@ | ||
/** | ||
* The contents of this file are subject to the license and copyright terms | ||
* detailed in the license directory at the root of the source tree (also | ||
* available online at http://fedora-commons.org/license/). | ||
*/ | ||
|
||
package org.fcrepo.metrics; | ||
|
||
import static com.codahale.metrics.graphite.GraphiteReporter.forRegistry; | ||
import static java.util.concurrent.TimeUnit.MINUTES; | ||
import static org.fcrepo.metrics.RegistryService.getMetrics; | ||
|
||
import com.codahale.metrics.ScheduledReporter; | ||
import com.codahale.metrics.graphite.Graphite; | ||
import com.codahale.metrics.graphite.GraphiteReporter; | ||
|
||
/** | ||
* @todo Add Documentation. | ||
* @author cbeer | ||
* @date Mar 22, 2013 | ||
*/ | ||
public class ReporterFactory { | ||
|
||
/** | ||
* @todo Add Documentation. | ||
*/ | ||
public ScheduledReporter registerGraphiteReporter(final Graphite g, | ||
final String prefix) { | ||
final GraphiteReporter r = forRegistry(getMetrics()).build(g); | ||
r.start(1, MINUTES); | ||
return r; | ||
} | ||
|
||
/** | ||
* @todo Add Documentation. | ||
*/ | ||
public static ReporterFactory buildDefaultReporterFactory() { | ||
return new ReporterFactory(); | ||
} | ||
} |