1

I am adding attonations to my grafana dashboard via the API api/annotations with the request body:

{
 "time": 167419909,
 "tags": ["tag1", "tag2"],
 "text" : "My annotations"
}

As a response, I am getting 200 OK with response body:

{
 "id": 24,
 "message": "Annotation Added"
}

Setting wise I have done the following:

  1. In my dashboard setting I went to Annotations -> "+New Query"
  2. Entered the name of annotation as "Events", datasource as --Grafana--
  3. Ticked the Enabled Checkbox and Unticked the disabled Checkbox
  4. Show In: All Panels
  5. Query Type: Annotations and Alerts
  6. Filter By: Tags
  7. Max Limit: 100
  8. Many Any: Toggled On
  9. Tags: tag1,tag2,etc

But I still dont see any annotation on my graphs.

markalex
  • 8,623
  • 2
  • 7
  • 32
Ankit Sahay
  • 1,710
  • 8
  • 14

1 Answers1

1

After spending 2 days on the issue, finally found the problem :)

The timestamp in the request body has to be in millisecond and not in seconds. Once I used the millisecond timestamp, the annotation appeared on the dashboard.

The strange thing is the response though. If timestamp in second is not acceptable, Grafana should not respond with a 200. A simple warning could have saved so much time.

Ankit Sahay
  • 1,710
  • 8
  • 14