:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
from products.warehouse_sources.sources.sdk import frozen, incremental_field
BASE_URL = "https://api.checklyhq.com"
API_VERSION_V2 = "v2"
API_VERSION_V3 = "v3"
SUPPORTED_API_VERSIONS = (API_VERSION_V2, API_VERSION_V3)
DEFAULT_API_VERSION = API_VERSION_V3
PAGE_SIZE = 100
RESULT_HISTORY_SECONDS = 30 * 24 * 60 * 60
RESULT_FIELDS = (
"id,name,checkId,created_at,startedAt,stoppedAt,hasFailures,hasErrors,isDegraded,"
"isCancelled,overMaxResponseTime,runLocation,responseTime,checkRunId,attempts,resultType"
)
@frozen
class ChecklyEndpoint:
path: str
primary_keys: tuple[str, ...] = ("id",)
paginated: bool = True
ENDPOINTS = {
"checks": ChecklyEndpoint(path="/{api_version}/checks"),
"check_groups": ChecklyEndpoint(path="/v1/check-groups"),
"alert_channels": ChecklyEndpoint(path="/v1/alert-channels"),
"check_statuses": ChecklyEndpoint(path="/v1/check-statuses", primary_keys=("checkId",), paginated=False),
# v3 has no check-results route, so every version reads results from /v2.
"check_results": ChecklyEndpoint(path="/v2/check-results/{checkId}", primary_keys=("checkId", "id")),
"locations": ChecklyEndpoint(path="/v1/locations", primary_keys=("region",), paginated=False),
"private_locations": ChecklyEndpoint(path="/v1/private-locations", paginated=False),
"error_groups": ChecklyEndpoint(path="/v1/error-groups"),
}
INCREMENTAL_FIELDS = {"check_results": [incremental_field("created_at")]}
AUTH_ERRORS = {
401: "Checkly rejected your API key. Create a new key and reconnect.",
403: "Your API key cannot read this Checkly account. Check the account ID and key permissions.",
}