Post Time Series Data Points - Anodot 2.0 Protocol

DESCRIPTION

Anodot 2.0 metric protocol works with a structured name schema, it expects key-value pairs of properties instead of one single-name string.

This allows us to understand the metric dimensions and what is being measured (the "what" property). 

Note: In cases where the metrics cannot be represented in Metric 2.0 Format, Anodot continues to support legacy formats such as Graphite and Graphite collectors, see  Post Time Series Data Points - Anodot 1.0 Protocol.  

DEFINITION 

POST https://api.anodot.com/api/v1/metrics?token=<api token>&protocol=anodot20

HEADERS

Content-type=application/json

BODY

[
{
    "properties": {
        "what": "<what_is_measured>", [mandatory]
        "PropertyName1": "<PropertyValue>", 
        "PropertyName2": "<PropertyValue>", 
        "target_type": "<gauge or counter>" [optional]
    },
    "tags": {
         "tagName1": ["v1"],
         "tagName2": ["v2", "v3"]
    },
    "timestamp": <epochtime>, [in seconds]
    "value": <value>
  }
]

 ARGUMENT DEFINITION

properties  

Key value pairs of properties:

  • key and value should contain ascii characters only. "." and space characters are not allowed.
  • The "what" property must be set ("what" represents what is actually being measured).
  • A metric may contain up to 20 properties.
  • property key must be a non empty string no longer than 50 characters.
  • property value must be a non empty string no longer than 150 characters.
  • The combination of all property names and values determines the uniqueness of the metric in Anodot. 
  • The target_type property represents how samples of the same metric are aggregated in Anodot 
    valid values are: gauge (average aggregation), counter (sum aggregation).    (default is gauge). 

tags [optional]  

Key value pairs
Tags are metadata of the metric and do not affect its uniqueness

  • metric may contain up to 40 tags.
  • tag key must be a non-empty string, no longer than 50 characters.
  • tag value must be a non-empty, string no longer than 150 characters. It may be an array of values that match the same key.

timestamp

Timestamp of when the metric sample was measured [Unix epoch time  in seconds].
Timestamp should be at the most 1 hour in the future

 value

decimal double precision number

EXAMPLE REQUEST [1]

curl \
-X POST \
-d "[{"properties":{"what":"NumberPurchases","Geo":"US", "Device":"Mobile","ProductCategory":"Shoes","target_type":"counter"},"tags":{"ActiveCampaignID":["1234"],"AccountManagers":["JohnDoe", "MaryJane"]},"timestamp":143876178,"value":58}]" \
-H "Content-Type: application/json" \
'https://api.anodot.com/api/v1/metrics?token=<api token>&protocol=anodot20'

 EXAMPLE REQUEST [2]  Includes 2 metric samples

curl \
-X POST \
-d "[{"properties":{"what":"NumberPurchases","Geo":"US", "Device":"Mobile","ProductCategory":"Shoes","target_type":"counter"},"tags":{"ActiveCampaignID":["1234"],"AccountManagers":["JohnDoe", "MaryJane"]},"timestamp":143876178,"value":58},{"properties":{"what":"Revenue","Geo":"US", "Device":"Mobile","ProductCategory":"Shoes"},"tags":{"ActiveCampaignID":["1234"],"AccountManagers":["JohnDoe", "MaryJane"]},"timestamp":143876191,"value":3458.423}]" \
-H "Content-Type: application/json" \
'https://api.anodot.com/api/v1/metrics?token=<api token>&protocol=anodot20'

Note:  Expect the sample array to be sorted by the sample timestamp; samples are processed in the order they appear in the given JSON array - out-of-order samples (in the context of the same metric) will be discarded.

EXAMPLE RESPONSE 

{
    "errors": []
}

 
For more details about example responses, see Success and Errors
Was this article helpful?
2 out of 2 found this helpful