metrics - Documentation

# metrics

### Methods

#### (route) retrieveAggregations(:id)

##### Route:

Method | Path
--- | ---
POST | /api/bucket/:id/data/metrics/aggregations

Retrieve metrics aggregations

##### Authentication

A authentication is needed to access this endpoint

##### Body Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
aggregations | Object |  | array of aggregations to compute
aggregations[].start | Date | optional | oldest documents to aggregate on
aggregations[].end | Date | optional | newest documents to aggregate on
aggregations[].interval | Number | optional | interval between two points
aggregations[].name | String | optional | the name of metric to compute the graph
aggregations[].servers | Array | optional | filter source server to aggregate on
aggregations[].apps | Array | optional | filter source applications to aggregate on
aggregations[].initiator | String | optional | filter source initiator to aggregate on
aggregations[].webcheck | String | optional | filter source webcheck to aggregate on
aggregations[].collector | String | optional | filter source collector to aggregate on
aggregations[].tags | Array | optional | filter tags to aggregate on
aggregations[].types | Array | optional | type of aggregation

##### Header Parameters:

Name | Type | Description
--- | --- | ---
Authorization | String | bearer access token issued for the user

##### Route Parameters:

Name | Type | Description
--- | --- | ---
:id | String | bucket id

##### Response:

Name | Type | Description
--- | --- | ---
. | Array | aggregations

##### Response Code:

Type | Description
--- | ---
500 | database error
200 | succesfully retrieved data

##### Example

    km.data.metrics.retrieveAggregations(bucket._id, {
      aggregations: [
        {
         'end': 'now-1d',
         'apps': ['INTERACTION', 'WEB-API', 'WORKER'],
         'types': ['histogram', 'apps', 'servers'],
         'name': 'HTTP'
        }
      ]
    })

##### Parameters:

Name | Type | Description
--- | --- | ---
`:id` |  | bucket id

#### (route) retrieveHistogram(:id)

##### Route:

Method | Path
--- | ---
POST | /api/bucket/:id/data/metrics/histogram

Retrieve metrics histograms (DEPRECATED)

##### Authentication

A authentication is needed to access this endpoint

##### Body Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
app_name | String | optional |  | filter probes by app source
server_name | String | optional |  | filter probes by server source
interval | String | optional | minute | interval of time between two point
before | String | optional | 60 | filter out probes that are after X minute

##### Header Parameters:

Name | Type | Description
--- | --- | ---
Authorization | String | bearer access token issued for the user

##### Route Parameters:

Name | Type | Description
--- | --- | ---
:id | String | bucket id

##### Response:

Name | Type | Description
--- | --- | ---
server_name | Object |
server_name.app_name | Object |
server_name.app_name.metrics | Object |
server_name.app_name.metrics.agg_type | String | the type of aggregation for this probe
server_name.app_name.metrics_name.timestamps_and_stats | Array | array of point

##### Response Code:

Type | Description
--- | ---
500 | database error
200 | succesfully retrieved data

##### Parameters:

Name | Type | Description
--- | --- | ---
`:id` |  | bucket id

#### (route) retrieveList(:id)

##### Route:

Method | Path
--- | ---
POST | /api/bucket/:id/data/metrics/list

Retrieve metrics list

##### Authentication

A authentication is needed to access this endpoint

##### Body Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
servers | Object | optional | filter metrics by app name
apps | Object | optional | filter metrics by server name
initiator | String | optional | filter metrics by a specific initiator
source | String | optional | filter metrics by a specific source
collector | String | optional | filter metrics by a specific collector
webcheck | String | optional | filter metrics by a specific webcheck

##### Header Parameters:

Name | Type | Description
--- | --- | ---
Authorization | String | bearer access token issued for the user

##### Route Parameters:

Name | Type | Description
--- | --- | ---
:id | String | bucket id

##### Response Code:

Type | Description
--- | ---
500 | database error
200 | succesfully retrieved data

##### Parameters:

Name | Type | Description
--- | --- | ---
`:id` |  | bucket id

#### (route) retrieveMetadatas(:id)

##### Route:

Method | Path
--- | ---
POST | /api/bucket/:id/data/metrics

Retrieve metrics name

##### Authentication

A authentication is needed to access this endpoint

##### Body Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
app_name | String |  |  | filter metrics by app source
server_name | String | optional |  | filter metrics by server source
before | String | optional | 720 | filter out metrics that are after X minute

##### Header Parameters:

Name | Type | Description
--- | --- | ---
Authorization | String | bearer access token issued for the user

##### Route Parameters:

Name | Type | Description
--- | --- | ---
:id | String | bucket id

##### Response Code:

Type | Description
--- | ---
500 | database error
200 | succesfully retrieved data

##### Parameters:

Name | Type | Description
--- | --- | ---
`:id` |  | bucket id