Skip to content

Conversation

simonpasquier
Copy link
Contributor

This is a very naive attempt to enrich metrics usage with statistics.

The PR adds a new TSDB collector which polls the /api/v1/status/tsdb endpoint for the top-N metrics and grabs the number of series broken down by label for the matched metrics.

Configuration example:

tsdb_collectors:
  - enable: true
    period: 1m
    limit: 100
    prometheus_client:
      url: "http://localhost:9090/"

Output example:

{
  "up": {
    "labels": [
      "instance",
      "job"
    ],
    "statistics": {
      "period": 60,
      "series_count": 6,
      "label_value_count_by_label_name": [
        {
          "name": "instance",
          "value": 6
        },
        {
          "name": "job",
          "value": 6
        }
      ]
    },
    "usage": {
      "alertRules": [
        {
          "prom_link": "http://localhost:9090/",
          "group_name": "node",
          "name": "InstancesPerJobDown",
          "expression": "1 - avg by (job) (up) >= 0.5"
        }
      ]
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant