New

The executive guide to generative AI

Read more

Create or update annotation

edit

Request

edit

POST /api/apm/services/:serviceName/annotation

Request body

edit
service

(required, object) Service identifying the configuration to create or update.

Properties of service
version
(required, string) Version of service.
environment
(optional, string) Environment of service.
@timestamp
(required, string) The date and time of the annotation. Must be in ISO 8601 format.
message
(optional, string) The message displayed in the annotation. Defaults to service.version.
tags
(optional, array) Tags are used by the APM UI to distinguish APM annotations from other annotations. Tags may have additional functionality in future releases. Defaults to [apm]. While you can add additional tags, you cannot remove the apm tag.

Example

edit

The following example creates an annotation for a service named opbeans-java.

curl -X POST \
  http://localhost:5601/api/apm/services/opbeans-java/annotation \
-H 'Content-Type: application/json' \
-H 'kbn-xsrf: true' \
-H 'Authorization: Basic YhUlubWZhM0FDbnlQeE6WRtaW49FQmSGZ4RUWXdX' \
-d '{
      "@timestamp": "2020-05-08T10:31:30.452Z",
      "service": {
        "version": "1.2"
      },
      "message": "Deployment 1.2"
    }'

Response body

edit
{
  "_index": "observability-annotations",
  "_id": "Lc9I93EBh6DbmkeV7nFX",
  "_version": 1,
  "_seq_no": 12,
  "_primary_term": 1,
  "found": true,
  "_source": {
    "message": "Deployment 1.2",
    "@timestamp": "2020-05-08T10:31:30.452Z",
    "service": {
      "version": "1.2",
      "name": "opbeans-java"
    },
    "tags": [
      "apm",
      "elastic.co",
      "customer"
    ],
    "annotation": {
      "type": "deployment"
    },
    "event": {
      "created": "2020-05-09T02:34:43.937Z"
    }
  }
}
Was this helpful?
Feedback