Grafana Integraion Guide
Overview
The SPC CI/CD Pipeline collects the logs and the metrics for each job during the execution of each CI/CD steps and these raw data are reorganized as high-level CI/CD events - Build, Test and Deploy. The CI/CD events are stored in the dedicated storage and for the deploy event, especially, the CI/CD pipeline generates Grafana native annotations so that you can show the deploy events on your dashboard.
Deploy Annotation
The deploy annotation is defined as a region annotation, which means it has the start time and the end time. - start time: the time that the related jenkins deploy job begins - end time: the time that the related jenkins deploy job ends
The annotation message has a link to the related jenkins console log page. And for the deployment context, it includes several tag values.
- jenkins build number: ex) #19
- version of the deployed binary: ex) v0.0.6
- service name: ex) spc-ci-example
- deploy result: success or failure
Here is an example of the deploy annotation.
[Deploy Success]

[Deploy Failure]

Configuration
You can configure the deploy annotation on Dashboard settings > Annotations menu on your dashboard. The deploy annotation does not belong to any dashboard or panel, which means it has no dashboard id and panel id and you can query and show it in any dashboard or panel.
You can use tags field to filter deploy annotations but it supports Match any or Match all opertions for multiple tag values. In the primitive requirements, you can customize the deploy annotation as you want by using this feature. For example,
- You can define separate annotations for the success and failure deployement by adding deploy result success or failure (with Matah all operation if there are multiple tag values).
- You might display the deploy events only for the limited services which you are interested in by using Match any operation with the service name list for the tags field.

Cautions : You have to set up one or more tag fields to represent annotations.
Please, refer to the Grafana documentation for the details for querying by tag for the native annotations.
| ❗️ For the more complex annotations You might be interested in querying CI/CD events with the more complex conditions based on the multiple combination of AND/OR operators with multiple fields and values, which the Grafana native annotation doesn’t support. For the more complex annotation query, you might need an additional datasource for the annotations. Currently, all CI/CD events are stored in CI/CD ElasticSearch and it might be considered as the alternative datasource for the complex annotations after upgrading Grafana to the later version of v6.5.0-beta release which supports region annotations with ElasticSearch datasource. |
|---|
We have setup for the the deploy annotation for SPC-VM Dashboard as an example, so you can refer to it for your configuration.
Enabling/Disabling Deploy Annotations
You can enable or disable the deploy annotation with the trigger on upper area of your dashboard after the configuration.
