Hosted Graphite now supports Annotations and Graphite Events. The Annotations feature is designed as a simpler interface to create events with tags.
An annotation relates your metrics to intermittent events for example when you deploy code, run some tests (hopefully successfully), or a long-running job completes.
This snippet of code will create an annotation with the tags “deployment” and “feature”, titled “New Super-duper Feature”. It’ll be timestamped at the time the event is received.
curl -X POST https://YOUR-API-KEY@api.hostedgraphite.com/api/v1/annotations/events/ -d \
"&title=New Super-duper Feature\
&tag=deployment\
&tag=feature"
Annotations have the following properties:
super-duper feature updated to v0.0.12
Slow rollout of new super-duper feature: 9b562b2. Relies on old version: 4ec124b4.
Enables the new super-duper feature in production.
There’s no restriction on having annotations with the same time stamps, but the combination of start time and title must be unique.
The API uses basic HTTP authorization. An example using curl:
curl -X POST https://YOUR-API-KEY@api.hostedgraphite.com/api/v1/annotations/events/
or
curl -u 'YOUR-API-KEY:' -X POST https://api.hostedgraphite.com/api/v1/annotations/events/
Deleting an annotation via the API is as simple as this:
curl -X DELETE https://YOUR-API-KEY@api.hostedgraphite.com/api/v1/annotations/events/ \
-d '{"title": "New Super-duper Feature", "timestamp": 1431607046}'
Events as per the Graphite project are fully supported. Insertion and rendering of Graphite Events works the same as the annotations endpoint, though the Graphite events API takes a JSON formatted data structure.
curl -X POST https://YOUR-API-KEY@api.hostedgraphite.com/api/v1/graphite/events/ \
-d '{"what": "New Super-duper Feature", "when":1431607046, "tags":"deployment feature"}
To support the display of Annotations, there is a function annotations() available in graphite to query and display the events. There are two options:
annotations("*")
This first option with a wildcard queries all available annotations for the time period selected
annotations("restart", "deployment")
This version queries all annotations with the tags “restart” and “deployment” for the time period selected.
The graphite events function events() is also available:
drawAsInfinite(events("*")
drawAsInfinite(events("restart", "deployment")
The primary dashboard annotations feature works exactly as specified in the documentation. It can be used to query by tags (not graphite targets).