{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/observeinc/json-schema/observeinc-metric-list-response-schema.json",
  "title": "MetricListResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/observeinc-metrics-api-openapi.yml#/components/schemas/Metric-ListResponse",
  "type": "object",
  "required": [
    "metrics",
    "meta"
  ],
  "properties": {
    "metrics": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Metric-Resource"
      }
    },
    "meta": {
      "$ref": "#/$defs/Meta"
    }
  },
  "$defs": {
    "Dataset-CorrelationTag": {
      "title": "CorrelationTag",
      "type": "object",
      "required": [
        "tag",
        "path"
      ],
      "properties": {
        "tag": {
          "type": "string"
        },
        "path": {
          "$ref": "#/$defs/Dataset-FieldPath"
        }
      }
    },
    "Dataset-FieldPath": {
      "title": "FieldPath",
      "type": "object",
      "required": [
        "field",
        "path"
      ],
      "properties": {
        "field": {
          "type": "string"
        },
        "path": {
          "type": "string"
        }
      }
    },
    "DatasetBrief": {
      "title": "DatasetBrief",
      "type": "object",
      "description": "Brief record fields for a DatasetRef (label, description, iconUrl, contentType). Field naming mirrors ObjectBrief in this same file (iconUrl, not icon) for consistency across reference-brief pairs.\n",
      "required": [
        "label",
        "description",
        "iconUrl",
        "contentType"
      ],
      "properties": {
        "label": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "iconUrl": {
          "type": "string"
        },
        "contentType": {
          "$ref": "#/$defs/DatasetContentType",
          "description": "The type of data the referenced dataset contains — Resource, Log,\nMetric, OTelSpan, OTelTrace, or Unknown. Derived from the dataset's\nkind and interface bindings.\n"
        }
      }
    },
    "DatasetContentType": {
      "title": "DatasetContentType",
      "type": "string",
      "description": "The type of data a dataset contains. For Resource datasets, this is\ndetermined by the dataset kind. For other kinds, it is derived from the\ndataset's interface bindings. Returns Unknown if no recognized interface\nis found.\n",
      "enum": [
        "Unknown",
        "Resource",
        "Log",
        "Metric",
        "OTelSpan",
        "OTelTrace"
      ]
    },
    "DatasetRef": {
      "title": "DatasetRef",
      "type": "object",
      "description": "A reference to a dataset. Always carries the id; the optional `record` field carries the brief metadata, populated when expand=true. Mirrors ObjectRef (see ObjectRef / ObjectBrief in this file).\n",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/ObjectId"
        },
        "record": {
          "$ref": "#/$defs/DatasetBrief"
        }
      }
    },
    "Meta": {
      "description": "List Response Metadata",
      "type": "object",
      "required": [
        "totalCount"
      ],
      "properties": {
        "totalCount": {
          "description": "The total number of resources available, independent of pagination.\nThe API may return -1 if the total count is unknown or cannot be computed\nin reasonable time.\n",
          "type": "integer",
          "format": "int64"
        }
      }
    },
    "Metric-Resource": {
      "title": "MetricResource",
      "type": "object",
      "description": "A metric resource. Metrics do not have a globally unique ObjectId —\nthey are identified by the tuple (dataset.id, name).\n",
      "required": [
        "name",
        "dataset",
        "type",
        "unit",
        "description",
        "rollup",
        "aggregate",
        "intervalMillis",
        "suggestedBucketSizeMillis",
        "userDefined",
        "status",
        "lastReported",
        "pointCount",
        "cardinality",
        "linkLabels",
        "metricTags",
        "correlationTags"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "The metric's name within its dataset."
        },
        "dataset": {
          "$ref": "#/$defs/DatasetRef",
          "description": "Reference to the dataset that owns this metric. With ?expand=true,\n`record` is populated with the dataset brief (label, description,\niconUrl, contentType).\n"
        },
        "type": {
          "$ref": "#/$defs/Metric-Type"
        },
        "unit": {
          "type": [
            "string",
            "null"
          ],
          "description": "Unit the metric values are reported in (e.g. \"ms\", \"bytes\",\n\"requests/s\"). Null when not specified.\n"
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "Free-form description of what the metric measures. Null when\nnot specified.\n"
        },
        "rollup": {
          "type": "string",
          "description": "How values are combined when reducing along the time axis (e.g.\n\"sum\", \"avg\", \"max\", \"min\", \"rate\"). Drives the default temporal\naggregation when querying this metric.\n"
        },
        "aggregate": {
          "type": "string",
          "description": "How values are combined when reducing along non-time dimensions\n(e.g. \"sum\", \"avg\", \"max\", \"min\"). Drives the default spatial\naggregation across tag groupings.\n"
        },
        "intervalMillis": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "description": "Reporting interval, in milliseconds (e.g. 60000 for a metric\nreported every 60 seconds). If the user declared an interval\nfor this metric (via the `set_metric` OPAL verb), this field reflects\nthe declared value. Otherwise, this field is the observed cadence\nderived from metric discovery sampling. Null when neither a declaration nor sufficient\nobservations are available.\n"
        },
        "suggestedBucketSizeMillis": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "description": "Suggested bucket size for queries against this metric, in\nmilliseconds. Null when not enough samples have been observed.\n"
        },
        "userDefined": {
          "type": "boolean",
          "description": "Whether the metric has been defined explicitly by the user.\nNon-user-defined metrics are discovered by scanning metric data.\n"
        },
        "status": {
          "$ref": "#/$defs/Metric-Status"
        },
        "lastReported": {
          "$ref": "#/$defs/NullableTime",
          "description": "Last time this metric was reported, derived from metric\ndiscovery sampling. May be underreported by up to an hour.\nNull when no observations are available.\n"
        },
        "pointCount": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "description": "Number of data points observed for this metric in the\ndiscovery sampling window. Null when no observations are\navailable.\n"
        },
        "cardinality": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "description": "Number of distinct tag combinations observed for this metric\nin the discovery sampling window. Null when no observations\nare available.\n"
        },
        "linkLabels": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Link labels on the metric dataset that are useful for\ngrouping/filtering this metric, ranked by usefulness and\ncardinality. Derived from metric discovery sampling.\n"
        },
        "metricTags": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Dataset-FieldPath"
          },
          "description": "Tag paths observed for this metric, ranked by cardinality.\nDerived from metric discovery sampling.\n"
        },
        "correlationTags": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Dataset-CorrelationTag"
          },
          "description": "Correlation tags on the metric dataset filtered to those\nrelevant to this metric. Derived from metric discovery\nsampling.\n"
        }
      }
    },
    "Metric-Status": {
      "title": "MetricStatus",
      "type": "string",
      "description": "Active: usable and currently reporting.\nInactive: usable, but not currently reporting.\nError: unusable because the metric dataset has errors in its\ndefinition.\n",
      "enum": [
        "Active",
        "Inactive",
        "Error"
      ]
    },
    "Metric-Type": {
      "title": "MetricType",
      "type": "string",
      "description": "Metric semantic type.\n\n* `CumulativeCounter`: A metric that represents a non-decreasing counter with possible resets.\n* `Delta`: A metric that represents a change in a value over time\n* `Gauge`: A metric that represents a value that can increase or decrease\n* `TDigest`: A metric that represents a t-digest of values\n* `Sample`: A metric that represents a sample of values\n* `Histogram`: A metric that represents an OpenTelemetry explicit bucket histogram\n* `ExponentialHistogram`: A metric that represents an OpenTelemetry exponential histogram\n",
      "enum": [
        "CumulativeCounter",
        "Delta",
        "Gauge",
        "TDigest",
        "Sample",
        "Histogram",
        "ExponentialHistogram"
      ]
    },
    "NullableTime": {
      "type": [
        "string",
        "null"
      ],
      "format": "RFC3339"
    },
    "ObjectId": {
      "type": "string",
      "format": "ObjectId"
    }
  }
}