New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Orbit Metrics Round 2 #73
Conversation
Initial implementation without configurability. Logs to SL4J by default.
Ganglia and Graphite comming soon :)
…o metricsredux
GraphiteReporter only supporting Integer, Long, String, Float,etc, not fancy things like AtomicLongs :(
Cleaning up an import incorrectly added to Stage Removing empty dependency that was accidentally added to commons POM
Initial implementation without configurability. Logs to SL4J by default.
Ganglia and Graphite comming soon :)
GraphiteReporter only supporting Integer, Long, String, Float,etc, not fancy things like AtomicLongs :(
Cleaning up an import incorrectly added to Stage Removing empty dependency that was accidentally added to commons POM
…ation of Actors Moved Stage Metrics to use "Instance Metrics"
Instead of isInstanceMetric how about "singleton" and default to true (or whatever makes sense)? |
|
||
public static String sanitizeMetricName(String name) | ||
{ | ||
return name.replaceAll("[\\[\\]\\.\\\\/]", ""); //strip illegal characters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract into static pattern / compile regex once?
Metrics Manager is now initialized using reflection in Stage.
I apparently reformatted Stage.java by mistake. Will attempt to fix. |
Should be better now. :) |
Looks good. I'll merge this shortly if there are no further comments :) |
{ | ||
try | ||
{ | ||
Class.forName("com.ea.orbit.metrics.MetricsManager"); //make sure the metrics manager is on the classpath. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo redundant check, if the user imports this class they should have the metrics module in the classpath (metrics should be pulled in via the extension pom), should be safe to remove the forname try catch.
I have removed the redundant checks for Class.ForName in a local commit. Will push after we come to a decision on the naming of instance metrics :) |
@FieldFlux if you want to push those last remaining items, I'll merge this today. |
Instance metrics are now "Prototype Metrics" and the scope is controlled via an enum on the ExportMetrics annotation. |
This PR provides a wrapper around Dropwizard's metrics library.
Fields or Methods tagged with @ExportMetric can be registered to emit metrics to a variety of sources via Reporters. In this PR, wrappers are provided for emitting metrics to SL4J, JMX, Graphite, and Ganglia. Reporters can be configured via orbit.yaml like so:
Standard configuration management tools can be used to modify the prefix on a host-by-host manner when deploying by modifying this file.
An Orbit Container Module is provided to setup metrics on the JVM if actors is not being used. The Actors Module will also attempt to setup metrics. If Container is not being used, MetricsManager can be provided a set of ReporterConfig objects using the initializeMetrics() method. This should be done before Stage startup if actors is being used.
Metrics must be registered using the MetricsManager registerExportedMetrics method. A instanceId may be provided so that instance metrics can be setup.
Metrics must be uniquely named. Currently, metrics are named using the name of the class they are defined in plus the name provided via the ExportMetric annotation. For example a metric in ca.fieldflux.awesomeapp.neatclass with a field annotated with
would generate a metric named:
Instance Metrics can be used where there may be more than one instance of a class and metrics must be tracked per-instance. To mark a metric as an instance metric use:
and provide an instanceId when registering the object instance. This will insert an instance identifier into the metric name hierarchy like so:
An Actors lifetime extension is also provided so that Actors can expose metrics and have them automatically registered and unregistered on actor activation and deactivation respectively.