James comes with built in integration with the Prometheus ecosystem, and a plugin to export metrics directly to ElasticSearch exist.
However, one might be willing to integrate with arbitrary metric system.
This project demonstrate how to leverage dropwizard metrics built in extensions to connect Apache James with Graphite.
For this we build a GraphiteExporter implementing the UserDefinedStartable
interface.
Build the project:
mvn clean install
Drop the jar with dependencies in the James extensions-jars
folder.
Register it in James configuration, in extensions.properties
:
guice.extension.startable=org.apache.james.examples.GraphiteExporter
Then start James.
Metrics can be retrieved in Graphite:
curl -XGET http://192.168.64.2:80/metrics/find?query=* | jq
Compile:
mvn clean install
Then start James:
docker-compose up