Query metrics
curl --request POST \
--url https://api.alerty.ai/query/metrics \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start_time": "2023-01-01T00:00:00Z",
"end_time": "2023-01-02T00:00:00Z",
"service_name": "<string>",
"metric_name": "<string>",
"limit": 100
}
'import requests
url = "https://api.alerty.ai/query/metrics"
payload = {
"start_time": "2023-01-01T00:00:00Z",
"end_time": "2023-01-02T00:00:00Z",
"service_name": "<string>",
"metric_name": "<string>",
"limit": 100
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
start_time: '2023-01-01T00:00:00Z',
end_time: '2023-01-02T00:00:00Z',
service_name: '<string>',
metric_name: '<string>',
limit: 100
})
};
fetch('https://api.alerty.ai/query/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.alerty.ai/query/metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'start_time' => '2023-01-01T00:00:00Z',
'end_time' => '2023-01-02T00:00:00Z',
'service_name' => '<string>',
'metric_name' => '<string>',
'limit' => 100
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.alerty.ai/query/metrics"
payload := strings.NewReader("{\n \"start_time\": \"2023-01-01T00:00:00Z\",\n \"end_time\": \"2023-01-02T00:00:00Z\",\n \"service_name\": \"<string>\",\n \"metric_name\": \"<string>\",\n \"limit\": 100\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.alerty.ai/query/metrics")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_time\": \"2023-01-01T00:00:00Z\",\n \"end_time\": \"2023-01-02T00:00:00Z\",\n \"service_name\": \"<string>\",\n \"metric_name\": \"<string>\",\n \"limit\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.alerty.ai/query/metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_time\": \"2023-01-01T00:00:00Z\",\n \"end_time\": \"2023-01-02T00:00:00Z\",\n \"service_name\": \"<string>\",\n \"metric_name\": \"<string>\",\n \"limit\": 100\n}"
response = http.request(request)
puts response.read_body{
"exponential_histograms": [
{
"resource_attributes": {},
"resource_schema_url": "<string>",
"scope_name": "<string>",
"scope_version": "<string>",
"scope_attributes": {},
"scope_dropped_attr_count": 123,
"scope_schema_url": "<string>",
"metric_name": "<string>",
"metric_description": "<string>",
"metric_unit": "<string>",
"attributes": {},
"start_time_unix": "2023-11-07T05:31:56Z",
"time_unix": "2023-11-07T05:31:56Z",
"count": 123,
"sum": 123,
"scale": 123,
"zero_count": 123,
"positive_offset": 123,
"positive_bucket_counts": [
123
],
"negative_offset": 123,
"negative_bucket_counts": [
123
],
"exemplars": [
{
"filtered_attributes": {},
"time_unix": "2023-11-07T05:31:56Z",
"value": 123,
"span_id": "<string>",
"trace_id": "<string>"
}
],
"flags": 123,
"min": 123,
"max": 123
}
],
"gauges": [
{
"resource_attributes": {},
"resource_schema_url": "<string>",
"scope_name": "<string>",
"scope_version": "<string>",
"scope_attributes": {},
"scope_dropped_attr_count": 123,
"scope_schema_url": "<string>",
"metric_name": "<string>",
"metric_description": "<string>",
"metric_unit": "<string>",
"attributes": {},
"start_time_unix": "2023-11-07T05:31:56Z",
"time_unix": "2023-11-07T05:31:56Z",
"value": 123,
"flags": 123,
"exemplars": [
{
"filtered_attributes": {},
"time_unix": "2023-11-07T05:31:56Z",
"value": 123,
"span_id": "<string>",
"trace_id": "<string>"
}
]
}
],
"histograms": [
{
"resource_attributes": {},
"resource_schema_url": "<string>",
"scope_name": "<string>",
"scope_version": "<string>",
"scope_attributes": {},
"scope_dropped_attr_count": 123,
"scope_schema_url": "<string>",
"metric_name": "<string>",
"metric_description": "<string>",
"metric_unit": "<string>",
"attributes": {},
"start_time_unix": "2023-11-07T05:31:56Z",
"time_unix": "2023-11-07T05:31:56Z",
"count": 123,
"sum": 123,
"bucket_counts": [
123
],
"explicit_bounds": [
123
],
"exemplars": [
{
"filtered_attributes": {},
"time_unix": "2023-11-07T05:31:56Z",
"value": 123,
"span_id": "<string>",
"trace_id": "<string>"
}
],
"flags": 123,
"min": 123,
"max": 123
}
],
"sums": [
{
"resource_attributes": {},
"resource_schema_url": "<string>",
"scope_name": "<string>",
"scope_version": "<string>",
"scope_attributes": {},
"scope_dropped_attr_count": 123,
"scope_schema_url": "<string>",
"metric_name": "<string>",
"metric_description": "<string>",
"metric_unit": "<string>",
"attributes": {},
"start_time_unix": "2023-11-07T05:31:56Z",
"time_unix": "2023-11-07T05:31:56Z",
"value": 123,
"flags": 123,
"exemplars": [
{
"filtered_attributes": {},
"time_unix": "2023-11-07T05:31:56Z",
"value": 123,
"span_id": "<string>",
"trace_id": "<string>"
}
],
"agg_temp": 123,
"is_monotonic": true
}
],
"summaries": [
{
"resource_attributes": {},
"resource_schema_url": "<string>",
"scope_name": "<string>",
"scope_version": "<string>",
"scope_attributes": {},
"scope_dropped_attr_count": 123,
"scope_schema_url": "<string>",
"metric_name": "<string>",
"metric_description": "<string>",
"metric_unit": "<string>",
"attributes": {},
"start_time_unix": "2023-11-07T05:31:56Z",
"time_unix": "2023-11-07T05:31:56Z",
"count": 123,
"sum": 123,
"value_at_quantiles": [
{
"quantile": 123,
"value": 123
}
],
"flags": 123
}
]
}{
"description": "A descriptive error message",
"code": 1400,
"field": "name"
}{
"description": "A descriptive error message",
"code": 1400,
"field": "name"
}API Reference
Query metrics
Retrieve metrics based on the specified filters.
POST
/
query
/
metrics
Query metrics
curl --request POST \
--url https://api.alerty.ai/query/metrics \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start_time": "2023-01-01T00:00:00Z",
"end_time": "2023-01-02T00:00:00Z",
"service_name": "<string>",
"metric_name": "<string>",
"limit": 100
}
'import requests
url = "https://api.alerty.ai/query/metrics"
payload = {
"start_time": "2023-01-01T00:00:00Z",
"end_time": "2023-01-02T00:00:00Z",
"service_name": "<string>",
"metric_name": "<string>",
"limit": 100
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
start_time: '2023-01-01T00:00:00Z',
end_time: '2023-01-02T00:00:00Z',
service_name: '<string>',
metric_name: '<string>',
limit: 100
})
};
fetch('https://api.alerty.ai/query/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.alerty.ai/query/metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'start_time' => '2023-01-01T00:00:00Z',
'end_time' => '2023-01-02T00:00:00Z',
'service_name' => '<string>',
'metric_name' => '<string>',
'limit' => 100
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.alerty.ai/query/metrics"
payload := strings.NewReader("{\n \"start_time\": \"2023-01-01T00:00:00Z\",\n \"end_time\": \"2023-01-02T00:00:00Z\",\n \"service_name\": \"<string>\",\n \"metric_name\": \"<string>\",\n \"limit\": 100\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.alerty.ai/query/metrics")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_time\": \"2023-01-01T00:00:00Z\",\n \"end_time\": \"2023-01-02T00:00:00Z\",\n \"service_name\": \"<string>\",\n \"metric_name\": \"<string>\",\n \"limit\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.alerty.ai/query/metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_time\": \"2023-01-01T00:00:00Z\",\n \"end_time\": \"2023-01-02T00:00:00Z\",\n \"service_name\": \"<string>\",\n \"metric_name\": \"<string>\",\n \"limit\": 100\n}"
response = http.request(request)
puts response.read_body{
"exponential_histograms": [
{
"resource_attributes": {},
"resource_schema_url": "<string>",
"scope_name": "<string>",
"scope_version": "<string>",
"scope_attributes": {},
"scope_dropped_attr_count": 123,
"scope_schema_url": "<string>",
"metric_name": "<string>",
"metric_description": "<string>",
"metric_unit": "<string>",
"attributes": {},
"start_time_unix": "2023-11-07T05:31:56Z",
"time_unix": "2023-11-07T05:31:56Z",
"count": 123,
"sum": 123,
"scale": 123,
"zero_count": 123,
"positive_offset": 123,
"positive_bucket_counts": [
123
],
"negative_offset": 123,
"negative_bucket_counts": [
123
],
"exemplars": [
{
"filtered_attributes": {},
"time_unix": "2023-11-07T05:31:56Z",
"value": 123,
"span_id": "<string>",
"trace_id": "<string>"
}
],
"flags": 123,
"min": 123,
"max": 123
}
],
"gauges": [
{
"resource_attributes": {},
"resource_schema_url": "<string>",
"scope_name": "<string>",
"scope_version": "<string>",
"scope_attributes": {},
"scope_dropped_attr_count": 123,
"scope_schema_url": "<string>",
"metric_name": "<string>",
"metric_description": "<string>",
"metric_unit": "<string>",
"attributes": {},
"start_time_unix": "2023-11-07T05:31:56Z",
"time_unix": "2023-11-07T05:31:56Z",
"value": 123,
"flags": 123,
"exemplars": [
{
"filtered_attributes": {},
"time_unix": "2023-11-07T05:31:56Z",
"value": 123,
"span_id": "<string>",
"trace_id": "<string>"
}
]
}
],
"histograms": [
{
"resource_attributes": {},
"resource_schema_url": "<string>",
"scope_name": "<string>",
"scope_version": "<string>",
"scope_attributes": {},
"scope_dropped_attr_count": 123,
"scope_schema_url": "<string>",
"metric_name": "<string>",
"metric_description": "<string>",
"metric_unit": "<string>",
"attributes": {},
"start_time_unix": "2023-11-07T05:31:56Z",
"time_unix": "2023-11-07T05:31:56Z",
"count": 123,
"sum": 123,
"bucket_counts": [
123
],
"explicit_bounds": [
123
],
"exemplars": [
{
"filtered_attributes": {},
"time_unix": "2023-11-07T05:31:56Z",
"value": 123,
"span_id": "<string>",
"trace_id": "<string>"
}
],
"flags": 123,
"min": 123,
"max": 123
}
],
"sums": [
{
"resource_attributes": {},
"resource_schema_url": "<string>",
"scope_name": "<string>",
"scope_version": "<string>",
"scope_attributes": {},
"scope_dropped_attr_count": 123,
"scope_schema_url": "<string>",
"metric_name": "<string>",
"metric_description": "<string>",
"metric_unit": "<string>",
"attributes": {},
"start_time_unix": "2023-11-07T05:31:56Z",
"time_unix": "2023-11-07T05:31:56Z",
"value": 123,
"flags": 123,
"exemplars": [
{
"filtered_attributes": {},
"time_unix": "2023-11-07T05:31:56Z",
"value": 123,
"span_id": "<string>",
"trace_id": "<string>"
}
],
"agg_temp": 123,
"is_monotonic": true
}
],
"summaries": [
{
"resource_attributes": {},
"resource_schema_url": "<string>",
"scope_name": "<string>",
"scope_version": "<string>",
"scope_attributes": {},
"scope_dropped_attr_count": 123,
"scope_schema_url": "<string>",
"metric_name": "<string>",
"metric_description": "<string>",
"metric_unit": "<string>",
"attributes": {},
"start_time_unix": "2023-11-07T05:31:56Z",
"time_unix": "2023-11-07T05:31:56Z",
"count": 123,
"sum": 123,
"value_at_quantiles": [
{
"quantile": 123,
"value": 123
}
],
"flags": 123
}
]
}{
"description": "A descriptive error message",
"code": 1400,
"field": "name"
}{
"description": "A descriptive error message",
"code": 1400,
"field": "name"
}Authorizations
bearerAuthcookieAuth
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Start time for the query.
Example:
"2023-01-01T00:00:00Z"
End time for the query.
Example:
"2023-01-02T00:00:00Z"
Filter metrics by service name.
Filter metrics by name.
Limit the number of results.
⌘I

