Skip to content

: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.

10.1 KB
Raw Blame
{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "properties": {
        "config": {
            "description": "Metric threshold configuration, including a bounded query, comparison, and required Monitoring definition.",
            "properties": {
                "baseline_value": {
                    "anyOf": [
                        {
                            "type": "number"
                        },
                        {
                            "type": "null"
                        }
                    ],
                    "description": "The value observed when the check was written, recorded on each result for context."
                },
                "comparison": {
                    "description": "What the measured value must satisfy to pass.",
                    "properties": {
                        "bounds": {
                            "anyOf": [
                                {
                                    "properties": {
                                        "lower": {
                                            "type": "number"
                                        },
                                        "upper": {
                                            "type": "number"
                                        }
                                    },
                                    "required": ["lower", "upper"],
                                    "type": "object"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "description": "The inclusive range for `between`; unused by `lte` and `gte`."
                        },
                        "operator": {
                            "description": "`lte`, `gte`, or `between`.",
                            "enum": ["lte", "gte", "between"],
                            "type": "string"
                        },
                        "value": {
                            "anyOf": [
                                {
                                    "type": "number"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "description": "The bound for `lte` and `gte`; unused by `between`."
                        }
                    },
                    "required": ["operator"],
                    "type": "object"
                },
                "metric_id": {
                    "anyOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ],
                    "description": "Identifier of a metric on the report whose query this check measures. The metric's query is copied into `query` when the check is created."
                },
                "metric_kind": {
                    "anyOf": [
                        {
                            "enum": [
                                "affected_users",
                                "affected_sessions",
                                "occurrences",
                                "conversion_rate",
                                "error_rate",
                                "duration",
                                "revenue",
                                "custom"
                            ],
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ],
                    "description": "How to draw this measurement; copied from a referenced metric."
                },
                "monitoring": {
                    "description": "Monitoring definition for the replacement, including the target reference period and scaling policy.",
                    "properties": {
                        "baseline_period_minutes": {
                            "anyOf": [
                                {
                                    "exclusiveMinimum": 0,
                                    "maximum": 527040,
                                    "type": "number"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "description": "The actual period measured by baseline_value, in minutes. Required when a baseline is supplied."
                        },
                        "purpose": {
                            "default": "expectation",
                            "description": "`expectation` evaluates whether the implementation met its target. `minimum_evidence` checks a fixed minimum sample count: meeting it passes the guard; missing it is inconclusive and requires assessment, never an implementation failure. Use a positive whole-number `gte` target on one unsampled raw count.",
                            "enum": ["expectation", "minimum_evidence"],
                            "type": "string"
                        },
                        "reference_period_minutes": {
                            "description": "The period the comparison target describes, in minutes. Independent of the soak and run schedule.",
                            "exclusiveMinimum": 0,
                            "maximum": 527040,
                            "type": "number"
                        },
                        "threshold_scaling": {
                            "description": "How the target applies to a measurement from Monitoring start to the observation time. `linear` multiplies the target by elapsed minutes / reference_period_minutes and requires an additive event count or property sum. `fixed` keeps the target unchanged, including for rates and averages. This definition does not enable Monitoring execution.",
                            "enum": ["linear", "fixed"],
                            "type": "string"
                        }
                    },
                    "required": ["reference_period_minutes", "threshold_scaling"],
                    "type": "object"
                },
                "query": {
                    "anyOf": [
                        {
                            "additionalProperties": {},
                            "propertyNames": {
                                "type": "string"
                            },
                            "type": "object"
                        },
                        {
                            "type": "null"
                        }
                    ],
                    "description": "Live InsightVizNode wrapping one TrendsQuery: supplied by the caller, or copied from the named metric when the check is created. `dateRange.date_from` must be a relative window such as `-13d`, and `date_to` must be empty, so the check measures the days before each run rather than the days before it was written. The query must produce exactly one output series: use one event or action series, or combine up to ten of them with exactly one formula. Use no breakdown and no compare mode. A `trendsFilter.display` of `Metric` turns compare mode on, so `metricShowChange` is switched off for you unless `metricSummary` is `latest`, which keeps compare mode off already."
                },
                "unit": {
                    "anyOf": [
                        {
                            "maxLength": 40,
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ],
                    "description": "Optional value suffix."
                },
                "value_format": {
                    "anyOf": [
                        {
                            "enum": ["number", "count", "percentage", "percentage_scaled", "duration", "currency"],
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ],
                    "description": "How to format measured values; copied from a referenced metric."
                }
            },
            "required": ["monitoring", "comparison"],
            "type": "object"
        },
        "id": {
            "description": "A UUID string identifying this Signal report check.",
            "type": "string"
        },
        "rationale": {
            "description": "Why this check is better.",
            "maxLength": 2000,
            "type": "string"
        },
        "report_id": {
            "type": "string"
        },
        "run_interval_minutes": {
            "description": "Minutes between interim Monitoring measurements. Must be at least six hours and shorter than the observation window. Omit to use a quarter of the window, bounded to six hours through one day. Windows of six hours or less have no interim samples.",
            "maximum": 129600,
            "minimum": 360,
            "type": "number"
        },
        "runs_remaining": {
            "description": "Monitoring performs one terminal evaluation. Omit or set to 1; higher counts are not supported. Interim measurements do not consume this count.",
            "maximum": 1,
            "minimum": 1,
            "type": "number"
        },
        "soak_minutes": {
            "description": "Observation window in minutes from Monitoring start. Omission preserves the existing window, including zero. Replacing a check during Monitoring restarts the period for all open checks.",
            "maximum": 43200,
            "minimum": 0,
            "type": "number"
        },
        "title": {
            "description": "Label for the new metric check.",
            "maxLength": 200,
            "type": "string"
        }
    },
    "required": ["id", "report_id", "title", "config"],
    "type": "object"
}