import requests
url = "https://platform.ankra.app/api/v1/org/canvas-datasets/source-metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/api/v1/org/canvas-datasets/source-metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://platform.ankra.app/api/v1/org/canvas-datasets/source-metrics \
--header 'Authorization: Bearer <token>'{
"state": "ok",
"observed_at": "2023-11-07T05:31:56Z",
"source_flavour": "self_hosted",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"namespace": "<string>",
"window": {
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
},
"metrics": [
{
"name": "<string>",
"type": "counter",
"help": "<string>",
"histogram": true
}
],
"metrics_truncated": true,
"metric_cap": 123,
"metrics_left_out": 1,
"metadata_state": "read",
"labels": [
"<string>"
],
"labels_state": "read",
"labels_truncated": true,
"label_cap": 123,
"reason": "<string>",
"reason_code": "no_source",
"metadata_reason": "<string>",
"metadata_reason_code": "no_source",
"labels_reason": "<string>",
"labels_reason_code": "no_source"
}{
"detail": "<string>"
}List the metrics of an application's connected source
Lists the metric names the metrics source connected to the application’s cluster (a Prometheus, VictoriaMetrics or Grafana Cloud) holds for the application’s namespace in your source over the last 24 hours, at most 500, with the type and help the source declares and which are histograms, so a card of the application.source_metric dataset can name one. Needs applications.read, and clusters.read and kubernetes.read on that cluster.
import requests
url = "https://platform.ankra.app/api/v1/org/canvas-datasets/source-metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/api/v1/org/canvas-datasets/source-metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://platform.ankra.app/api/v1/org/canvas-datasets/source-metrics \
--header 'Authorization: Bearer <token>'{
"state": "ok",
"observed_at": "2023-11-07T05:31:56Z",
"source_flavour": "self_hosted",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"namespace": "<string>",
"window": {
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
},
"metrics": [
{
"name": "<string>",
"type": "counter",
"help": "<string>",
"histogram": true
}
],
"metrics_truncated": true,
"metric_cap": 123,
"metrics_left_out": 1,
"metadata_state": "read",
"labels": [
"<string>"
],
"labels_state": "read",
"labels_truncated": true,
"label_cap": 123,
"reason": "<string>",
"reason_code": "no_source",
"metadata_reason": "<string>",
"metadata_reason_code": "no_source",
"labels_reason": "<string>",
"labels_reason_code": "no_source"
}{
"detail": "<string>"
}Authorizations
Query Parameters
Response
The list was answered. Its state says whether names came back: ok, empty (your source holds no metric for the application's namespace in the last 24 hours), unavailable (no source is connected, the cluster cannot be reached, or the source did not answer within 10 seconds; reason says why) or denied (reason names the missing permission).
How many names the source sent that the list cannot offer (a dotted OpenTelemetry name, a name outside the Prometheus name pattern, a name starting __). Above 0, a reason says so with reason_code names_unusable; when no name could be listed the state is unavailable, never empty.
x >= 0Names, for a program, the case a reason sentence describes; the sentence is for people and may be reworded. A closed set: no_source, sandbox_cluster, source_kind_unreadable, credential_unreadable, cluster_offline, no_agent (the source cannot be reached); source_timeout; read_budget_spent (the organisation spent its reads against its metrics sources for this minute; try again shortly); source_refused; source_answer_unreadable; not_wired; platform_failed (a fault on Ankra's side, not the source's); denied; not_deployed; several_places; namespace_unusable; range_not_started; nothing_found; no_number; nothing_observed; not_a_histogram; over_cap; list_may_be_incomplete; names_unusable; answer_too_large; above_highest_bound; missing_samples; placements_unreadable (where the application runs could not be read); request_cancelled (the request was cancelled before the answer was read; nothing failed); source_flagged_answer (the source sent data but warned or said its answer is incomplete: the answer is ok, its reason quotes the source, and it may miss what the source could not read); source_flagged_empty (the source sent nothing but warned or said its answer is incomplete, so Ankra does not say there is none: the answer is unavailable). When a reason joins several sentences, the code names the first.
no_source, sandbox_cluster, source_kind_unreadable, credential_unreadable, cluster_offline, no_agent, source_timeout, read_budget_spent, source_refused, source_answer_unreadable, not_wired, platform_failed, denied, not_deployed, several_places, namespace_unusable, range_not_started, nothing_found, no_number, nothing_observed, not_a_histogram, over_cap, list_may_be_incomplete, names_unusable, answer_too_large, above_highest_bound, missing_samples, placements_unreadable, request_cancelled, source_flagged_answer, source_flagged_empty Names, for a program, the case a reason sentence describes; the sentence is for people and may be reworded. A closed set: no_source, sandbox_cluster, source_kind_unreadable, credential_unreadable, cluster_offline, no_agent (the source cannot be reached); source_timeout; read_budget_spent (the organisation spent its reads against its metrics sources for this minute; try again shortly); source_refused; source_answer_unreadable; not_wired; platform_failed (a fault on Ankra's side, not the source's); denied; not_deployed; several_places; namespace_unusable; range_not_started; nothing_found; no_number; nothing_observed; not_a_histogram; over_cap; list_may_be_incomplete; names_unusable; answer_too_large; above_highest_bound; missing_samples; placements_unreadable (where the application runs could not be read); request_cancelled (the request was cancelled before the answer was read; nothing failed); source_flagged_answer (the source sent data but warned or said its answer is incomplete: the answer is ok, its reason quotes the source, and it may miss what the source could not read); source_flagged_empty (the source sent nothing but warned or said its answer is incomplete, so Ankra does not say there is none: the answer is unavailable). When a reason joins several sentences, the code names the first.
no_source, sandbox_cluster, source_kind_unreadable, credential_unreadable, cluster_offline, no_agent, source_timeout, read_budget_spent, source_refused, source_answer_unreadable, not_wired, platform_failed, denied, not_deployed, several_places, namespace_unusable, range_not_started, nothing_found, no_number, nothing_observed, not_a_histogram, over_cap, list_may_be_incomplete, names_unusable, answer_too_large, above_highest_bound, missing_samples, placements_unreadable, request_cancelled, source_flagged_answer, source_flagged_empty Names, for a program, the case a reason sentence describes; the sentence is for people and may be reworded. A closed set: no_source, sandbox_cluster, source_kind_unreadable, credential_unreadable, cluster_offline, no_agent (the source cannot be reached); source_timeout; read_budget_spent (the organisation spent its reads against its metrics sources for this minute; try again shortly); source_refused; source_answer_unreadable; not_wired; platform_failed (a fault on Ankra's side, not the source's); denied; not_deployed; several_places; namespace_unusable; range_not_started; nothing_found; no_number; nothing_observed; not_a_histogram; over_cap; list_may_be_incomplete; names_unusable; answer_too_large; above_highest_bound; missing_samples; placements_unreadable (where the application runs could not be read); request_cancelled (the request was cancelled before the answer was read; nothing failed); source_flagged_answer (the source sent data but warned or said its answer is incomplete: the answer is ok, its reason quotes the source, and it may miss what the source could not read); source_flagged_empty (the source sent nothing but warned or said its answer is incomplete, so Ankra does not say there is none: the answer is unavailable). When a reason joins several sentences, the code names the first.
no_source, sandbox_cluster, source_kind_unreadable, credential_unreadable, cluster_offline, no_agent, source_timeout, read_budget_spent, source_refused, source_answer_unreadable, not_wired, platform_failed, denied, not_deployed, several_places, namespace_unusable, range_not_started, nothing_found, no_number, nothing_observed, not_a_histogram, over_cap, list_may_be_incomplete, names_unusable, answer_too_large, above_highest_bound, missing_samples, placements_unreadable, request_cancelled, source_flagged_answer, source_flagged_empty