Add a metrics dashboard to Grafana
View your microservice metrics in Grafana and add a custom dashboard using the MDTP DSL.
Tip: pull the latest changes before you start. git checkout main && git pull
Build a Grafana dashboard
- Create a feature branch in the grafana-dashboards repository.
- Create a Scala file (or use an existing file) inside the dashboards folder and add your digital service. This file contains your dashboard definition. The path is:
grafana-dashboards/src/main/scala/uk/gov/hmrc/grafanadashboards/dashboards
- In that Scala file, create an object that extends
DigitalService
. Replace the placeholders and remove angle brackets:- <MyDigitalService>
- <my-digital-service>
- <microservice-name>
- <MicroserviceDeploymentZone>
object <MyDigitalService> extends DigitalService( digitalServiceDashboard("<MyDigitalService>", List("<microservice-name>", "<microservice-name>")), microserviceDashboard(microservice("<microservice-name>"), <MicroserviceDeploymentZone>), microserviceDashboard(microservice("<microservice-name>"), <MicroserviceDeploymentZone>) )
Test locally that your dashboard was generated
- Generate dashboards:
sbt run
- Verify output files exist:
ls target/output/grafana
Merge and deploy
Raise a pull request and get it reviewed/approved. After merge, the Jenkins job below generates and deploys the dashboards to each environment:
grafana-dashboards-pipeline (Jenkins)
Grafana URLs
Check you’ve completed this step successfully
Open the relevant Grafana environment above and search for your microservice dashboard.
Need support?
Ask in #team-telemetry on Slack.
Got feedback?
We’re always improving our documentation. Share your feedback using the team channel above.
Add a metrics dashboard to Grafana
View your microservice metrics in Grafana and add a custom dashboard using the MDTP DSL.
Tip: pull the latest changes before you start. git checkout main && git pull
Build a Grafana dashboard
- Create a feature branch in the grafana-dashboards repository.
- Create a Scala file (or use an existing file) inside the dashboards folder and add your digital service. This file contains your dashboard definition. The path is:
grafana-dashboards/src/main/scala/uk/gov/hmrc/grafanadashboards/dashboards
- In that Scala file, create an object that extends
DigitalService
. Replace the placeholders and remove angle brackets:- <MyDigitalService>
- <my-digital-service>
- <microservice-name>
- <MicroserviceDeploymentZone>
object <MyDigitalService> extends DigitalService( digitalServiceDashboard("<MyDigitalService>", List("<microservice-name>", "<microservice-name>")), microserviceDashboard(microservice("<microservice-name>"), <MicroserviceDeploymentZone>), microserviceDashboard(microservice("<microservice-name>"), <MicroserviceDeploymentZone>) )
Test locally that your dashboard was generated
- Generate dashboards:
sbt run
- Verify output files exist:
ls target/output/grafana
Merge and deploy
Raise a pull request and get it reviewed/approved. After merge, the Jenkins job below generates and deploys the dashboards to each environment:
grafana-dashboards-pipeline (Jenkins)
Grafana URLs
Check you’ve completed this step successfully
Open the relevant Grafana environment above and search for your microservice dashboard.
Need support?
Ask in #team-telemetry on Slack.
Got feedback?
We’re always improving our documentation. Share your feedback using the team channel above.
Add a metrics dashboard to Grafana
View your microservice metrics in Grafana and add a custom dashboard using the MDTP DSL.
Tip: pull the latest changes before you start. git checkout main && git pull
Build a Grafana dashboard
- Create a feature branch in the grafana-dashboards repository.
- Create a Scala file (or use an existing file) inside the dashboards folder and add your digital service. This file contains your dashboard definition. The path is:
grafana-dashboards/src/main/scala/uk/gov/hmrc/grafanadashboards/dashboards
- In that Scala file, create an object that extends
DigitalService
. Replace the placeholders and remove angle brackets:- <MyDigitalService>
- <my-digital-service>
- <microservice-name>
- <MicroserviceDeploymentZone>
object <MyDigitalService> extends DigitalService( digitalServiceDashboard("<MyDigitalService>", List("<microservice-name>", "<microservice-name>")), microserviceDashboard(microservice("<microservice-name>"), <MicroserviceDeploymentZone>), microserviceDashboard(microservice("<microservice-name>"), <MicroserviceDeploymentZone>) )
Test locally that your dashboard was generated
- Generate dashboards:
sbt run
- Verify output files exist:
ls target/output/grafana
Merge and deploy
Raise a pull request and get it reviewed/approved. After merge, the Jenkins job below generates and deploys the dashboards to each environment:
grafana-dashboards-pipeline (Jenkins)
Grafana URLs
Check you’ve completed this step successfully
Open the relevant Grafana environment above and search for your microservice dashboard.
Need support?
Ask in #team-telemetry on Slack.
Got feedback?
We’re always improving our documentation. Share your feedback using the team channel above.