import requests
url = "https://platform.ankra.app/api/v1/org/applications/{application_id}/environments/{environment_id}/restarts-and-scaling"
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/applications/{application_id}/environments/{environment_id}/restarts-and-scaling', 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/applications/{application_id}/environments/{environment_id}/restarts-and-scaling \
--header 'Authorization: Bearer <token>'{
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"read_state": "ok",
"since": "2023-11-07T05:31:56Z",
"until": "2023-11-07T05:31:56Z",
"kept_days": 123,
"kept_from": "2023-11-07T05:31:56Z",
"starts_before_kept": true,
"placements": [
{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"namespace": "<string>",
"state": "read"
}
],
"placements_capped": true,
"changes": [
{
"observed_at": "2023-11-07T05:31:56Z",
"change": "restarted",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"namespace": "<string>",
"resource_kind": "Pod",
"resource_name": "<string>",
"restart": {
"restarts_before": 1,
"restarts_after": 1
},
"scaling": {
"copies_before": 1,
"copies_after": 1,
"ready_before": 1,
"ready_after": 1
}
}
],
"changes_capped": true,
"cluster_outside_projects": true
}Get an environment's restarts and scaling
One environment’s restarts and scaling over a window, for the marks on the Logs bars and the Metrics charts: the pods in its namespaces whose restart count rose, with the count before and after, and the Deployments and StatefulSets whose copy count changed, with the copies and ready copies before and after, newest first, at most 200. It reads what the platform recorded from the cluster’s watch stream and nothing else: no reason for a restart is kept or sent. A rollout’s surge copy is itself a scale (3 copies with 2 ready, then 2 again). The window runs from since (inclusive) to until (exclusive), both RFC 3339; until defaults to now and since to a day before until. The platform keeps 14 days: kept_days and kept_from say so, and starts_before_kept marks a window that starts earlier, whose earlier part is not known. The environment follows applications.read; a placement’s changes are read only on a cluster where the caller holds kubernetes.read, decided as the cluster read decides it, and elsewhere the placement reads withheld and the answer partial. A caller confined to a project is answered for an environment placed only outside it exactly as for one the application does not have (404). Nothing is written.
import requests
url = "https://platform.ankra.app/api/v1/org/applications/{application_id}/environments/{environment_id}/restarts-and-scaling"
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/applications/{application_id}/environments/{environment_id}/restarts-and-scaling', 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/applications/{application_id}/environments/{environment_id}/restarts-and-scaling \
--header 'Authorization: Bearer <token>'{
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"read_state": "ok",
"since": "2023-11-07T05:31:56Z",
"until": "2023-11-07T05:31:56Z",
"kept_days": 123,
"kept_from": "2023-11-07T05:31:56Z",
"starts_before_kept": true,
"placements": [
{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"namespace": "<string>",
"state": "read"
}
],
"placements_capped": true,
"changes": [
{
"observed_at": "2023-11-07T05:31:56Z",
"change": "restarted",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"namespace": "<string>",
"resource_kind": "Pod",
"resource_name": "<string>",
"restart": {
"restarts_before": 1,
"restarts_after": 1
},
"scaling": {
"copies_before": 1,
"copies_after": 1,
"ready_before": 1,
"ready_after": 1
}
}
],
"changes_capped": true,
"cluster_outside_projects": true
}Authorizations
Query Parameters
Response
The environment's restarts and scaling in the window
One environment's restarts and scaling over a window, as the platform recorded them, with what it keeps.
ok: every placement was read. partial: a placement was withheld, not read or has no namespace, the placements were cut, or the environment also runs outside the reader's project; changes lists only what was read. unknown: the read could not be made; placements and changes are empty, which says nothing about the environment.
ok, partial, unknown