AEM: Integrate Graphite Metrics
Contents
Contents
Especially when you have larger services running in your Adobe Experience Manager an metrics database can become quite handy (for both developers and the customer).
We decided to use Graphite as database and visualize the data with Grafana.
Integration in your project
The wcm.io Caravan project provides a Maven Module you can use in your project.
<dependency>
<groupId>io.wcm.caravan</groupId>
<artifactId>io.wcm.caravan.commons.metrics</artifactId>
<version>0.6.0</version>
</dependency>
Depending on your project, you might need to include the Dropwizard Metrics Libraries.
Configuration
After deploying the packages, you’ll find a new Configuration in your OSGi console.
Usage
You can now inject the MetricRegistry into your components and use it as described in Dropwizard’s Manual
@Reference
private MetricRegistry metricRegistry;
public void someThingWithTimer() {
Context timer = metricRegistry.timer("myTimerName").time();
// Do some stuff...
timer.close();
}
Note: Although this posts describes how to use Graphite in AEM, it’s also no problem to use this for a plain OSGi project.
Comments