curl --request GET \
--url https://api.timbal.ai/orgs/{org_id}/metrics/definitions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.timbal.ai/orgs/{org_id}/metrics/definitions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.timbal.ai/orgs/{org_id}/metrics/definitions', 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.timbal.ai/orgs/{org_id}/metrics/definitions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.timbal.ai/orgs/{org_id}/metrics/definitions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.timbal.ai/orgs/{org_id}/metrics/definitions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.timbal.ai/orgs/{org_id}/metrics/definitions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"definitions": [
{
"created_at": "2023-11-07T05:31:56Z",
"enabled": true,
"id": 123,
"label_source": "<string>",
"metric_name": "<string>",
"name": "<string>",
"source": "trace_span",
"value_source": "<string>",
"has_error": true,
"min_duration_ms": 123,
"project_id": 123,
"span_name": "<string>",
"span_name_prefix": "<string>",
"status_code": "<string>"
}
]
}{
"code": "<string>",
"message": "<string>"
}List Metric Definitions
The org’s custom metric definitions and their current predicates.
project_id filters to what is in effect for that project, which includes org-wide definitions (those with no project_id) since they run against that project’s runs too.
This lists configuration, not data. A definition that has never matched a span appears here but not in GET /orgs/{org_id}/metrics/catalog.
Filtered per definition the same way GET /orgs/{org_id}/alarms is: org-wide definitions need alarms.read, project ones need projects.alarms.read on the owner. So a project-scoped caller sees their own definitions but not the org-wide ones that also run against their runs, even with project_id set.
curl --request GET \
--url https://api.timbal.ai/orgs/{org_id}/metrics/definitions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.timbal.ai/orgs/{org_id}/metrics/definitions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.timbal.ai/orgs/{org_id}/metrics/definitions', 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.timbal.ai/orgs/{org_id}/metrics/definitions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.timbal.ai/orgs/{org_id}/metrics/definitions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.timbal.ai/orgs/{org_id}/metrics/definitions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.timbal.ai/orgs/{org_id}/metrics/definitions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"definitions": [
{
"created_at": "2023-11-07T05:31:56Z",
"enabled": true,
"id": 123,
"label_source": "<string>",
"metric_name": "<string>",
"name": "<string>",
"source": "trace_span",
"value_source": "<string>",
"has_error": true,
"min_duration_ms": 123,
"project_id": 123,
"span_name": "<string>",
"span_name_prefix": "<string>",
"status_code": "<string>"
}
]
}{
"code": "<string>",
"message": "<string>"
}Authorizations
Timbal API key. Obtain your API key from the Timbal platform settings. See Authentication for more information.
Path Parameters
Query Parameters
Only definitions in effect for this project. Omit for every definition in the org.
Response
List of definitions
Wrapper for GET /orgs/{org_id}/metrics/definitions.
Show child attributes
Show child attributes