Skip to content
Get started

Get uptime metrics for an SLA data source

slas.get_uptime_metrics(strdata_source_urn, SlaGetUptimeMetricsParams**kwargs) -> SlaGetUptimeMetricsResponse
GET/v1/slas/{sla_urn}/data-sources/{data_source_urn}/uptime-metrics

Get uptime metrics for an SLA data source

ParametersExpand Collapse
sla_urn: str
data_source_urn: str
end: Union[str, datetime]

ISO-formatted datetime for the end of the evaluation period (e.g. 2024-01-31, 2024-01-31T23:59:59Z)

formatdate-time
start: Union[str, datetime]

ISO-formatted datetime for the start of the evaluation period (e.g. 2024-01-01, 2024-01-15T08:00:00Z)

formatdate-time
ReturnsExpand Collapse
class SlaGetUptimeMetricsResponse:
data_source_urn: str

The unique identifier of the data source

downtime_events: List[DowntimeEvent]

A non-deduplicated list of downtime events that occurred during the timeframe

duration_hours: float

The duration of the downtime event in hours

end_time: datetime

The end time of the downtime event

formatdate-time
name: str

The display name of the downtime event

start_time: datetime

The start time of the downtime event

formatdate-time
metrics: Metrics

The uptime metrics for the data source during the timeframe

downtime_hours: float

The total number of downtime hours during the timeframe

uptime_percentage: float

The percentage of uptime during the timeframe

metrics_deduplicated: MetricsDeduplicated

The uptime metrics for the data source during the timeframe, with overlapping windows of downtime (such as from different incidents that occurred simultaneously) counted only once

downtime_hours: float

The total number of downtime hours during the timeframe

uptime_percentage: float

The percentage of uptime during the timeframe

sla_urn: str

The unique identifier of the SLA

timeframe: Timeframe

The timeframe for which the uptime metrics are calculated

end: datetime

The ISO-formatted end datetime of the timeframe for which the metrics are calculated

formatdate-time
start: datetime

The ISO-formatted start datetime of the timeframe for which the metrics are calculated

formatdate-time
vendor_urn: str

The unique identifier of the vendor

Get uptime metrics for an SLA data source

import os
from datetime import datetime
from clarative import Clarative

client = Clarative(
    api_key=os.environ.get("CLARATIVE_API_KEY"),  # This is the default and can be omitted
)
response = client.slas.get_uptime_metrics(
    data_source_urn="data_source_urn",
    sla_urn="sla_urn",
    end=datetime.fromisoformat("2019-12-27T18:11:19.117"),
    start=datetime.fromisoformat("2019-12-27T18:11:19.117"),
)
print(response.data_source_urn)
{
  "data_source_urn": "data_source_urn",
  "downtime_events": [
    {
      "duration_hours": 0,
      "end_time": "2019-12-27T18:11:19.117Z",
      "name": "name",
      "start_time": "2019-12-27T18:11:19.117Z"
    }
  ],
  "metrics": {
    "downtime_hours": 0,
    "uptime_percentage": 0
  },
  "metrics_deduplicated": {
    "downtime_hours": 0,
    "uptime_percentage": 0
  },
  "sla_urn": "sla_urn",
  "timeframe": {
    "end": "2019-12-27T18:11:19.117Z",
    "start": "2019-12-27T18:11:19.117Z"
  },
  "vendor_urn": "vendor_urn"
}
Returns Examples
{
  "data_source_urn": "data_source_urn",
  "downtime_events": [
    {
      "duration_hours": 0,
      "end_time": "2019-12-27T18:11:19.117Z",
      "name": "name",
      "start_time": "2019-12-27T18:11:19.117Z"
    }
  ],
  "metrics": {
    "downtime_hours": 0,
    "uptime_percentage": 0
  },
  "metrics_deduplicated": {
    "downtime_hours": 0,
    "uptime_percentage": 0
  },
  "sla_urn": "sla_urn",
  "timeframe": {
    "end": "2019-12-27T18:11:19.117Z",
    "start": "2019-12-27T18:11:19.117Z"
  },
  "vendor_urn": "vendor_urn"
}