Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
pankaj
2014-10-02 15:33:28 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5de8411733fece5bd871088b2af2e83e391be2f3
5de84117
1 parent
7665049b
create a default CSV reporter
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
utils/misc/src/main/java/org/onlab/metrics/MetricsManager.java
utils/misc/src/main/java/org/onlab/metrics/MetricsManager.java
View file @
5de8411
package
org
.
onlab
.
metrics
;
import
java.io.File
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentMap
;
import
java.util.concurrent.TimeUnit
;
import
com.codahale.metrics.Counter
;
import
com.codahale.metrics.CsvReporter
;
import
com.codahale.metrics.Gauge
;
import
com.codahale.metrics.Histogram
;
import
com.codahale.metrics.Meter
;
...
...
@@ -54,12 +59,24 @@ public final class MetricsManager implements MetricsService {
/**
* Registry for the Metrics objects created in the system.
*/
private
final
MetricRegistry
metricsRegistry
=
new
MetricRegistry
()
;
private
final
MetricRegistry
metricsRegistry
;
public
MetricsManager
(
ConcurrentMap
<
String
,
MetricsComponent
>
componentsRegistry
)
{
this
.
componentsRegistry
=
componentsRegistry
;
/**
* Default Reporter for this metrics manager.
*/
private
final
CsvReporter
reporter
;
public
MetricsManager
()
{
this
.
componentsRegistry
=
new
ConcurrentHashMap
<>();
this
.
metricsRegistry
=
new
MetricRegistry
();
this
.
reporter
=
CsvReporter
.
forRegistry
(
metricsRegistry
)
.
formatFor
(
Locale
.
US
)
.
convertRatesTo
(
TimeUnit
.
SECONDS
)
.
convertDurationsTo
(
TimeUnit
.
MICROSECONDS
)
.
build
(
new
File
(
"/tmp/"
));
reporter
.
start
(
10
,
TimeUnit
.
SECONDS
);
}
/**
...
...
Please
register
or
login
to post a comment