{
  "$id": "https://firefox-ci-tc.services.mozilla.com/schemas/common/metrics-reference-v0.json#",
  "$schema": "https://firefox-ci-tc.services.mozilla.com/schemas/common/metadata-metaschema.json#",
  "additionalProperties": false,
  "description": "Reference of prometheus metrics exposed by Taskcluster services",
  "metadata": {
    "name": "metrics",
    "version": 0
  },
  "properties": {
    "$schema": {
      "description": "Link to schema for this reference. That is a link to this very document. Typically used to identify what kind of reference this file is.",
      "format": "uri",
      "title": "Metrics Reference",
      "type": "string"
    },
    "metrics": {
      "description": "Array of metrics",
      "items": {
        "additionalProperties": false,
        "properties": {
          "buckets": {
            "description": "For histogram metrics, the bucket boundaries.",
            "items": {
              "type": "number"
            },
            "type": "array"
          },
          "description": {
            "description": "A description of this metric",
            "type": "string"
          },
          "labels": {
            "additionalProperties": true,
            "description": "The set of labels with their descriptions that can be attached to this metric. Each key should be a valid prometheus label: ^[a-zA-Z][a-zA-Z0-9_]*$",
            "type": "object"
          },
          "name": {
            "description": "The service-specific name of this metric.",
            "pattern": "^[a-z][a-zA-Z0-9_]*",
            "type": "string"
          },
          "percentiles": {
            "description": "For summary metrics, the percentiles to calculate.",
            "items": {
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "type": "array"
          },
          "registers": {
            "description": "Metric can belong to one or several registries that can be used to separate metrics aggregation.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "title": {
            "description": "Title of this metric",
            "type": "string"
          },
          "type": {
            "description": "The type of metric (counter, gauge, histogram, summary).",
            "enum": [
              "counter",
              "gauge",
              "histogram",
              "summary"
            ]
          }
        },
        "required": [
          "name",
          "type",
          "description"
        ],
        "title": "Metric Definition",
        "type": "object"
      },
      "title": "Metrics",
      "type": "array",
      "uniqueItems": true
    },
    "serviceName": {
      "description": "Name of the taskcluster service",
      "pattern": "^[a-z][a-z0-9_-]*$",
      "title": "Service Name",
      "type": "string"
    }
  },
  "required": [
    "serviceName",
    "$schema",
    "metrics"
  ],
  "title": "Metrics Reference File",
  "type": "object"
}