﻿# Expose missing model observations with an inventory set difference

Use an inventory set difference on exact model/location keys to expose missing observations, preserving inventory freshness and unknown capacity.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/guide-dc-promql-inventory-unless/
Language: en

A model vanishes from the capacity panel when its exporter stops reporting, making the remaining fleet look healthier. A report built only from observed series cannot show an expected model that has disappeared. Compare a maintained inventory of expected observations with current observations through an explicit set difference, and preserve missing data as missing.

## Define the expected inventory

Choose a trusted source for the model and location keys that should currently be observed. This inventory describes expectation, not proof of running capacity. Retain its own update time and ownership. A stale desired-state list can produce false missing entries after a legitimate retirement, while an incomplete list can hide the very model whose observation the report should notice.

## Match the full boundary

Include the keys required to distinguish models at independent sites or serving locations. A model name alone may match an observation from another location and conceal the missing local series. Normalize names only under a documented identity contract. Do not discard a distinguishing label merely because it makes the join easier or produces fewer entries on the dashboard.

## Use presence as a set question

PromQL unless selects entries from the left vector without matching entries on the right. With the appropriate on keys, it can expose expected inventory entries lacking an observation. Set operators compare presence rather than deciding whether a sample value is healthy. A present observation reporting failure remains a different condition from no matching observation at all.

## Preserve freshness independently

A selected sample can reflect lookback behavior rather than a measurement acquired at the current evaluation instant. Consider observation age and inventory age alongside the set result. Do not zero-fill missing capacity and then label that invented value as measured failure or measured success. Likewise, a stale but still selectable series should not silently satisfy a requirement for a fresh model observation.

## Test disappearance and retirement

Create offline fixtures for a reporting model, a missing model, a same-named model elsewhere and an intentionally retired inventory entry. Verify output keys and the separate missing-data category. This checks report completeness without measuring actual service availability. A useful panel retains the distinction between expected deployment, observed response and confirmed capacity rather than averaging away models that no longer contribute telemetry.

## Primary references

[PromQL Binary Operators and Vector Matching](https://prometheus.io/docs/prometheus/latest/querying/operators/).

[PromQL Evaluation Timestamps and Selectors](https://prometheus.io/docs/prometheus/latest/querying/basics/).

[Prometheus Rule Unit Testing](https://prometheus.io/docs/prometheus/latest/configuration/unit_testing_rules/).

Related reading: [A metric disappeared from the graph: staleness, up and zero values](/journal/prometheus-scrape-staleness/); [GPU monitoring without excess charts: five observation levels](/journal/gpu-monitoring-scorecard/).
