GET /api/v1/metrics
Authenticate with Authorization: Bearer YOUR_API_KEY and X-Project-Id: YOUR_PROJECT_ID. Replace path placeholders and example values with your project's values.
Parameters
| Name | Location | Type | Presence | Description |
|---|---|---|---|---|
X-Project-Id | header | string (uuid) | Required | Project UUID. Use the project associated with your API key. |
query | query | string | Optional | KQL over the metrics source, e.g. metrics | where metric_name == "http.server.requests" | summarize rate(value) by bin_auto(timestamp). Use rate(value) (per second) or increase(value) (per bin) for counters, last(value) for gauges; they are computed per series and reset-aware. rateif/increaseif/lastif(value, predicate) aggregate only the matching series, for ratios. |
data_type | query | metric | json | float | text | Optional | |
since | query | string | Optional | |
from | query | string | Optional | |
to | query | string | Optional | |
source | query | string | Optional | |
environment | query | string | Optional | |
service | query | string | Optional |
Examples
curl --request GET 'https://api.monoscope.tech/api/v1/metrics' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'X-Project-Id: YOUR_PROJECT_ID'import requests
response = requests.get(
"https://api.monoscope.tech/api/v1/metrics",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"X-Project-Id": "YOUR_PROJECT_ID"
},
timeout=30,
)
response.raise_for_status()
print(response.text)const response = await fetch("https://api.monoscope.tech/api/v1/metrics", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"X-Project-Id": "YOUR_PROJECT_ID"
},
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
console.log(await response.text());Responses
HTTP 200
Response defined by the API schema.
| Field | Type | Presence | Description |
|---|---|---|---|
data_float | number (double) | Optional | |
data_json | object[][] | Required | |
data_text | string[][] | Required | |
dataset | number (double)[][] | Required | |
error | string | Optional | |
from | integer | Optional | |
headers | string[] | Required | |
rows_count | number (double) | Required | |
rows_per_min | number (double) | Optional | |
stats | object | Optional | |
to | integer | Optional |
JSON schema
{
"properties": {
"data_float": {
"format": "double",
"type": "number"
},
"data_json": {
"items": {
"items": {
"$ref": "#/components/schemas/JSONValue"
},
"type": "array"
},
"type": "array"
},
"data_text": {
"items": {
"items": {
"type": "string"
},
"type": "array"
},
"type": "array"
},
"dataset": {
"items": {
"items": {
"format": "double",
"type": "number"
},
"type": "array"
},
"type": "array"
},
"error": {
"type": "string"
},
"from": {
"maximum": 9223372036854776000,
"minimum": -9223372036854776000,
"type": "integer"
},
"headers": {
"items": {
"type": "string"
},
"type": "array"
},
"rows_count": {
"format": "double",
"type": "number"
},
"rows_per_min": {
"format": "double",
"type": "number"
},
"stats": {
"$ref": "#/components/schemas/MetricsStats"
},
"to": {
"maximum": 9223372036854776000,
"minimum": -9223372036854776000,
"type": "integer"
}
},
"required": [
"dataset",
"data_json",
"data_text",
"headers",
"rows_count"
],
"type": "object"
}HTTP 400
Refused; error.code says why
| Field | Type | Presence | Description |
|---|---|---|---|
error | object | Required |
JSON schema
{
"properties": {
"error": {
"$ref": "#/components/schemas/ApiProblem"
}
},
"required": [
"error"
],
"type": "object"
}HTTP 401
Refused; error.code says why
| Field | Type | Presence | Description |
|---|---|---|---|
error | object | Required |
JSON schema
{
"properties": {
"error": {
"$ref": "#/components/schemas/ApiProblem"
}
},
"required": [
"error"
],
"type": "object"
}