Metrics

This section contains resources related to the Metric. The endpoints in this section enables you to interact with the metrics data collected by the app. Through the API you can create as well as retrieve metrics data.
For more information please refer to Getting Started With Metrics

Endpoints

Here is the list of endpoints for Metrics.

  
    
            POST $BASE_URL/v1/metrics/{bucketId}
            GET $BASE_URL/v1/metrics/{bucketId}
            GET $BASE_URL/v1/metrics_overall/{bucketId}
          
  

1. Create a metric entry

Creates metric entry. You can use Konso App to evaluate the metrics data. This is done using the endpoint:

  
    POST $BASE_URL/v1/metrics/{bucketId}
  
The request object

The request object contains an instance of an object that is to be sent to create a new metric entry. The object is transferred as part of the request's body.

Attributes

The attributes refers to elements that makes up the request object:

name required
string
Name of the function/method/call you collect metrics for.
timeStamp required
number
Time at which the event was created. It's measured in seconds in the Unix epoch format.
duration required
numeric
Execution time in milliseconds.
tags optional
object
Array of tags to be assigned to the entry.
responseCode optional
numeric
Response code if applicable.
correlationId optional
string
Unique identity for binding events, metrics and logs together.
appName optional
string
Application name useful for stream segmentation.
tags optional
strings array
Adding a tag(s) for the entry.
Sample Request Example
  
    POST $BASE_URL/v1/metrics/{bucketId}
  
  
    
           {
                "timeStamp":1621961380,
                "tags":null,
                "appName":"TestApp",
                "correlationId":null,
                "duration": 123,
                "name": "GET v1/testapi",
                "responseCode": 200,
                "tags": ["test", "mvp"]
            }
          
  

2. Get metric entries

Returns entries matching the query filters and sorting. The following endpoint is used for this:

  
    GET $BASE_URL/v1/metrics/{bucketId}
  
Filter parameters

Lists and filters metrics entries. Entries are kept in our storage according to retention days setting.

Attributes

The attributes refers to elements that makes up the filter parameters:

fromDate optional
number
A greater than or equals filter on the list timeStamp field, the value is in Unix epoch format.
toDate optional
number
A less than or equals filter on the list timeStamp field, the value is in Unix epoch format.
name optional
string
Search by name.
correlationId optional
string
Only return entries for the correlationId specified.
appName optional
string
Only return entries for the appName specified.
from optional
number
A cursor user in pagination. The Default value is 0
to optional
number
A cursor user in pagination. The Default value is 10
tags optional
string
Filter results by tag. Multiple values are supported.
sort optional
number
1 - timestamp asc, 2 - timestamp desc (default), 3 - response code asc, 4 - response code desc.
Sample Request Example
  
    
            GET $BASE_URL/v1/metrics/{bucketId}
            ?fromDate=1619636000
            &toDate=1619637000
            &name=GET
            &correlationId=
            &appName=testApp
            &tags=tag1
            &tags=tag2
            &sort=2
            &from=0
            &to=100