This is a repository accompanying a blogs post about how to create custom metrics in Neo4j and publish them to Prometheus, and visualise them in Grafana.
Monitoring Neo4j and Procedures with Prometheus and Grafana - Part 1
Monitoring Neo4j and Procedures with Prometheus and Grafana - Part 2
This repository contains a single module, where we have an example procedure with our own custom metrics published to Prometheus on the same URl as the Neo4j metrics. The integration test starts a Neo4j Testcontainer where we have Neo4j Enterprise edition. If you want to read more about Neo4j and Testcontainers then read this blog post.
We use a Neo4jContainer and modified it to expose the Prometheus port. To be able to use Prometheus with Neo4j we need to call the withEnterpriseEdition method, and you have to add a container-license-acceptance.txt file to the root directory of your test resources, containing the text "neo4j:3.5.0-enterprise" in one line. With this you will accept the license terms and conditions. You'll find more information about licensing Neo4j here: About Neo4j Licenses. If you are interested in a license, you can contact us directly at GraphAware.
This project uses maven, to build a jar-file with the example procedure. To produce the jar simply package the project with maven:
mvn clean package
This will produce a jar-file,target/monitoring-procedure-examle.jar,
that can be deployed into the plugin directory of your Neo4j instance.
When you deployed the procedure, you can call it from the Neo4j browser:
call example.monitoring