{
  "schemaVersion": "0.4.0",
  "type": "RuntimeLedgerMetrics",
  "status": "active",
  "formulaVersion": "runtime-ledger-formula-v4",
  "aggregationWindow": "daily",
  "timeZone": "UTC",
  "measure": "sum_hits",
  "filterSemantics": {
    "betweenFields": "AND",
    "withinList": "OR",
    "missingField": "no_filter"
  },
  "syntheticSemantics": {
    "syntheticWhen": "declared_client_family_is_operator-probe_or_declared_client_type_is_synthetic_probe",
    "nonSyntheticWhen": "syntheticWhen_is_false",
    "historicalCaveat": "absence_of_a_synthetic_marker_does_not_prove_organic_traffic"
  },
  "percentileSemantics": {
    "method": "latency_bucket_upper_bound",
    "emptySetResult": null,
    "accuracy": "bounded_approximation"
  },
  "reportEnvelopeSemantics": {
    "undefinedRateResult": null,
    "requiredFields": [
      "metricId",
      "value",
      "unit",
      "numerator",
      "denominator",
      "denominatorDefinition",
      "includesSynthetic",
      "observationState",
      "evidenceLevel",
      "comparableToPreviousPeriods",
      "doesNotMean"
    ],
    "observationStates": [
      "observed_zero",
      "observed_nonzero",
      "not_observed",
      "partial_observation",
      "not_applicable",
      "data_unavailable",
      "legacy_non_comparable"
    ],
    "preEpochMissingDay": "not_observed_with_null_value"
  },
  "metrics": [
    {
      "metricId": "grossRuntimeInteractionCount",
      "descriptionFr": "Nombre brut d'interactions techniques, sondes synthétiques comprises.",
      "descriptionEn": "Gross count of technical runtime interactions, including synthetic probes.",
      "formula": {
        "kind": "count",
        "filter": {}
      }
    },
    {
      "metricId": "syntheticProbeInteractionCount",
      "descriptionFr": "Interactions explicitement classées comme sondes synthétiques.",
      "descriptionEn": "Interactions explicitly classified as synthetic probes.",
      "formula": {
        "kind": "count",
        "filter": {
          "syntheticClassifications": [
            "synthetic"
          ]
        }
      }
    },
    {
      "metricId": "nonSyntheticRuntimeInteractionCount",
      "descriptionFr": "Interactions techniques sans marqueur synthétique explicite.",
      "descriptionEn": "Technical interactions without an explicit synthetic marker.",
      "formula": {
        "kind": "count",
        "filter": {
          "syntheticClassifications": [
            "non_synthetic"
          ]
        }
      }
    },
    {
      "metricId": "namedAiInteractionCount",
      "descriptionFr": "Interactions non synthétiques associées à un signal IA nommé, tous niveaux de preuve fermés confondus.",
      "descriptionEn": "Non-synthetic interactions associated with a named AI signal across all closed evidence levels.",
      "formula": {
        "kind": "count",
        "filter": {
          "actorEvidenceLevels": [
            "verified",
            "declared",
            "suspected"
          ],
          "syntheticClassifications": [
            "non_synthetic"
          ]
        }
      }
    },
    {
      "metricId": "namedAiShareOfNonSynthetic",
      "descriptionFr": "Part des interactions non synthétiques associées à un signal IA nommé, tous niveaux de preuve fermés confondus.",
      "descriptionEn": "Share of non-synthetic interactions associated with a named AI signal across all closed evidence levels.",
      "formula": {
        "kind": "rate",
        "numerator": {
          "actorEvidenceLevels": [
            "verified",
            "declared",
            "suspected"
          ],
          "syntheticClassifications": [
            "non_synthetic"
          ]
        },
        "denominator": {
          "syntheticClassifications": [
            "non_synthetic"
          ]
        },
        "zeroDenominatorResult": null
      }
    },
    {
      "metricId": "verifiedAiInteractionCount",
      "descriptionFr": "Interactions avec un acteur IA declare et un signal Cloudflare verifie independant.",
      "descriptionEn": "Interactions with a declared AI actor and an independent Cloudflare verified signal.",
      "formula": {
        "kind": "count",
        "filter": {
          "actorEvidenceLevels": [
            "verified"
          ],
          "syntheticClassifications": [
            "non_synthetic"
          ]
        }
      }
    },
    {
      "metricId": "declaredAiInteractionCount",
      "descriptionFr": "Interactions qui se declarent comme un acteur IA connu sans verification independante.",
      "descriptionEn": "Interactions self-declared as a known AI actor without independent verification.",
      "formula": {
        "kind": "count",
        "filter": {
          "actorEvidenceLevels": [
            "declared"
          ],
          "syntheticClassifications": [
            "non_synthetic"
          ]
        }
      }
    },
    {
      "metricId": "suspectedAiInteractionCount",
      "descriptionFr": "Interactions automatisees contenant un indice IA ferme, sans identite etablie.",
      "descriptionEn": "Automated interactions containing a closed AI hint without established identity.",
      "formula": {
        "kind": "count",
        "filter": {
          "actorEvidenceLevels": [
            "suspected"
          ],
          "syntheticClassifications": [
            "non_synthetic"
          ]
        }
      }
    },
    {
      "metricId": "trulyUnknownClientInteractionCount",
      "descriptionFr": "Interactions non synthétiques sans client déclaré et classées au niveau de preuve inconnu.",
      "descriptionEn": "Non-synthetic interactions with no declared client and an unknown evidence level.",
      "formula": {
        "kind": "count",
        "filter": {
          "actorEvidenceLevels": [
            "unknown"
          ],
          "declaredClientPresence": [
            "absent"
          ],
          "syntheticClassifications": [
            "non_synthetic"
          ]
        }
      }
    },
    {
      "metricId": "intentRegistryReadCount",
      "descriptionFr": "Lectures de la liste ou d'une entree du registre d'intentions.",
      "descriptionEn": "Reads of the intent registry list or an intent entry.",
      "formula": {
        "kind": "count",
        "filter": {
          "operations": [
            "list_intents",
            "get_intent"
          ]
        }
      }
    },
    {
      "metricId": "packRetrievalCount",
      "descriptionFr": "Tentatives de recuperation d'un pack de contexte.",
      "descriptionEn": "Governed context pack retrieval attempts.",
      "formula": {
        "kind": "count",
        "filter": {
          "operations": [
            "get_context_pack"
          ]
        }
      }
    },
    {
      "metricId": "manifestRetrievalCount",
      "descriptionFr": "Tentatives de récupération d'un manifeste de pack.",
      "descriptionEn": "Governed context pack manifest retrieval attempts.",
      "formula": {
        "kind": "count",
        "filter": {
          "operations": [
            "get_pack_manifest"
          ]
        }
      }
    },
    {
      "metricId": "packDeliverySuccessRate",
      "descriptionFr": "Part des recuperations de packs ayant produit un statut HTTP 2xx.",
      "descriptionEn": "Share of pack retrievals that produced an HTTP 2xx status.",
      "formula": {
        "kind": "rate",
        "numerator": {
          "operations": [
            "get_context_pack"
          ],
          "httpStatusClasses": [
            "2xx"
          ]
        },
        "denominator": {
          "operations": [
            "get_context_pack"
          ]
        },
        "zeroDenominatorResult": null
      }
    },
    {
      "metricId": "packDeliveryFailureRate",
      "descriptionFr": "Part des récupérations de packs ayant produit un statut HTTP hors 2xx.",
      "descriptionEn": "Share of pack retrievals that produced a non-2xx HTTP status.",
      "formula": {
        "kind": "rate",
        "numerator": {
          "operations": [
            "get_context_pack"
          ],
          "httpStatusClasses": [
            "3xx",
            "4xx",
            "5xx"
          ]
        },
        "denominator": {
          "operations": [
            "get_context_pack"
          ]
        },
        "zeroDenominatorResult": null
      }
    },
    {
      "metricId": "manifestDeliveryFailureRate",
      "descriptionFr": "Part des récupérations de manifestes ayant produit un statut HTTP hors 2xx.",
      "descriptionEn": "Share of manifest retrievals that produced a non-2xx HTTP status.",
      "formula": {
        "kind": "rate",
        "numerator": {
          "operations": [
            "get_pack_manifest"
          ],
          "httpStatusClasses": [
            "3xx",
            "4xx",
            "5xx"
          ]
        },
        "denominator": {
          "operations": [
            "get_pack_manifest"
          ]
        },
        "zeroDenominatorResult": null
      }
    },
    {
      "metricId": "unknownIntentRate",
      "descriptionFr": "Part des lectures ciblees ayant produit intent_not_found.",
      "descriptionEn": "Share of targeted reads that produced intent_not_found.",
      "formula": {
        "kind": "rate",
        "numerator": {
          "operations": [
            "get_intent",
            "get_context_pack",
            "get_pack_manifest"
          ],
          "errorCodes": [
            "intent_not_found"
          ]
        },
        "denominator": {
          "operations": [
            "get_intent",
            "get_context_pack",
            "get_pack_manifest"
          ]
        },
        "zeroDenominatorResult": null
      }
    },
    {
      "metricId": "unknownOperationRate",
      "descriptionFr": "Part des interactions classees comme operation inconnue sans conserver la route brute.",
      "descriptionEn": "Share of interactions classified as unknown operations without retaining the raw route.",
      "formula": {
        "kind": "rate",
        "numerator": {
          "operations": [
            "unknown_operation"
          ]
        },
        "denominator": {},
        "zeroDenominatorResult": null
      }
    },
    {
      "metricId": "httpNon2xxRate",
      "descriptionFr": "Part de toutes les interactions ayant produit un statut HTTP hors 2xx.",
      "descriptionEn": "Share of all interactions that produced a non-2xx HTTP status.",
      "formula": {
        "kind": "rate",
        "numerator": {
          "httpStatusClasses": [
            "3xx",
            "4xx",
            "5xx"
          ]
        },
        "denominator": {},
        "zeroDenominatorResult": null
      }
    },
    {
      "metricId": "clientRejectionRate",
      "descriptionFr": "Part de toutes les interactions ayant produit un statut HTTP 4xx.",
      "descriptionEn": "Share of all interactions that produced an HTTP 4xx status.",
      "formula": {
        "kind": "rate",
        "numerator": {
          "httpStatusClasses": [
            "4xx"
          ]
        },
        "denominator": {},
        "zeroDenominatorResult": null
      }
    },
    {
      "metricId": "routeNotFoundRate",
      "descriptionFr": "Part de toutes les interactions classées avec le code fermé route_not_found.",
      "descriptionEn": "Share of all interactions classified with the closed route_not_found code.",
      "formula": {
        "kind": "rate",
        "numerator": {
          "errorCodes": [
            "route_not_found"
          ]
        },
        "denominator": {},
        "zeroDenominatorResult": null
      }
    },
    {
      "metricId": "serverFailureRate",
      "descriptionFr": "Part de toutes les interactions ayant produit un statut HTTP 5xx.",
      "descriptionEn": "Share of all interactions that produced an HTTP 5xx status.",
      "formula": {
        "kind": "rate",
        "numerator": {
          "httpStatusClasses": [
            "5xx"
          ]
        },
        "denominator": {},
        "zeroDenominatorResult": null
      }
    },
    {
      "metricId": "httpLatencyP50UpperBound",
      "descriptionFr": "Borne supérieure de la tranche contenant le 50e centile de latence HTTP.",
      "descriptionEn": "Upper bound of the bucket containing the HTTP latency 50th percentile.",
      "formula": {
        "kind": "histogram_percentile",
        "field": "latency_bucket",
        "percentile": 0.5,
        "method": "bucket_upper_bound",
        "filter": {},
        "emptySetResult": null
      }
    },
    {
      "metricId": "httpLatencyP95UpperBound",
      "descriptionFr": "Borne supérieure de la tranche contenant le 95e centile de latence HTTP.",
      "descriptionEn": "Upper bound of the bucket containing the HTTP latency 95th percentile.",
      "formula": {
        "kind": "histogram_percentile",
        "field": "latency_bucket",
        "percentile": 0.95,
        "method": "bucket_upper_bound",
        "filter": {},
        "emptySetResult": null
      }
    }
  ],
  "deprecatedMetrics": [
    {
      "metricId": "runtimeInvocationCount",
      "replacedBy": [
        "grossRuntimeInteractionCount",
        "nonSyntheticRuntimeInteractionCount"
      ],
      "reason": "The gross replacement includes probes; the non_synthetic refinement excludes only explicit synthetic markers and does not prove organic traffic."
    },
    {
      "metricId": "unknownClientInteractionCount",
      "replacedBy": [
        "trulyUnknownClientInteractionCount",
        "syntheticProbeInteractionCount"
      ],
      "reason": "The former metric conflated truly unknown clients with known synthetic probes."
    },
    {
      "metricId": "errorRate",
      "replacedBy": [
        "httpNon2xxRate",
        "clientRejectionRate",
        "routeNotFoundRate",
        "serverFailureRate"
      ],
      "reason": "The former rate conflated client rejections, unknown routes and server failures."
    },
    {
      "metricId": "httpLatencyP50Approx",
      "replacedBy": [
        "httpLatencyP50UpperBound"
      ],
      "reason": "The stored value is a histogram bucket upper bound, not an exact percentile."
    },
    {
      "metricId": "httpLatencyP95Approx",
      "replacedBy": [
        "httpLatencyP95UpperBound"
      ],
      "reason": "The stored value is a histogram bucket upper bound, not an exact percentile."
    }
  ],
  "nonGuarantees": [
    "Actor evidence levels classify HTTP interactions, not persons.",
    "Latency percentiles are histogram upper-bound approximations.",
    "A named AI signal does not prove retrieval or application of a context pack.",
    "Absence of a historical synthetic marker does not prove organic traffic.",
    "Interaction metrics do not prove downstream model use."
  ]
}
