Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save michal-kazmierczak/1538bd8df46e4a1fbf9c859bfa045126 to your computer and use it in GitHub Desktop.
Save michal-kazmierczak/1538bd8df46e4a1fbf9c859bfa045126 to your computer and use it in GitHub Desktop.
Prometheus Metrics Management
{
"__inputs": [
{
"name": "DS_EU02",
"label": "default",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__elements": {},
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "10.0.3"
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "stat",
"name": "Stat",
"version": ""
},
{
"type": "panel",
"id": "table",
"name": "Table",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "super-light-green",
"mode": "palette-classic-by-name"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 8,
"x": 0,
"y": 0
},
"id": 4,
"options": {
"colorMode": "background",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "10.0.3",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"editorMode": "code",
"exemplar": false,
"expr": "count({__name__!=\"\"})",
"format": "table",
"instant": true,
"range": false,
"refId": "A"
}
],
"title": "Total series",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic-by-name"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 8,
"x": 8,
"y": 0
},
"id": 2,
"options": {
"colorMode": "background",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "10.0.3",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"editorMode": "code",
"exemplar": false,
"expr": "count(count({__name__!=\"\"}) by (__name__))",
"format": "table",
"instant": true,
"range": false,
"refId": "A"
}
],
"title": "Total metrics",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic-by-name"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 8,
"x": 16,
"y": 0
},
"id": 6,
"options": {
"colorMode": "background",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "10.0.3",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"editorMode": "code",
"exemplar": false,
"expr": "count(count({__name__!=\"\"}) by (job))",
"format": "table",
"instant": true,
"range": false,
"refId": "A"
}
],
"title": "Total jobs",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Distinct Count"
},
"properties": [
{
"id": "color",
"value": {
"mode": "continuous-GrYlRd"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Distinct Count"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"mode": "basic",
"type": "gauge",
"valueDisplayMode": "text"
}
},
{
"id": "custom.align",
"value": "left"
}
]
},
{
"matcher": {
"id": "byName",
"options": "A sample observed value"
},
"properties": [
{
"id": "custom.align",
"value": "center"
}
]
}
]
},
"gridPos": {
"h": 19,
"w": 8,
"x": 0,
"y": 4
},
"id": 3,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"enablePagination": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Label"
}
]
},
"pluginVersion": "10.0.3",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"editorMode": "code",
"exemplar": false,
"expr": "$metric",
"format": "table",
"hide": false,
"instant": true,
"range": false,
"refId": "A"
}
],
"title": "Cardinality by label for selected metric",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"Value": true,
"__name__": false
},
"indexByName": {},
"renameByName": {}
}
},
{
"id": "reduce",
"options": {
"includeTimeField": false,
"labelsToFields": false,
"mode": "seriesToRows",
"reducers": [
"distinctCount",
"last"
]
}
},
{
"id": "organize",
"options": {
"excludeByName": {},
"indexByName": {
"Distinct Count": 1,
"Field": 0,
"Last": 2
},
"renameByName": {
"Distinct Count": "Cardinality (distinct values count)",
"Field": "Label",
"Last": "A sample observed value"
}
}
}
],
"type": "table"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"filterable": false,
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Metric"
},
"properties": [
{
"id": "links",
"value": [
{
"title": "",
"url": "/d/b0b89a23-8f37-4bfe-962a-f329a654e987/metrics-management?var-metric=${__data.fields[\"Metric\"]}&${datasource:queryparam}&${job:queryparam}"
}
]
},
{
"id": "custom.width",
"value": 329
}
]
},
{
"matcher": {
"id": "byName",
"options": "Series count"
},
"properties": [
{
"id": "custom.width",
"value": 139
}
]
},
{
"matcher": {
"id": "byName",
"options": "% of total"
},
"properties": [
{
"id": "custom.width",
"value": 130
}
]
}
]
},
"gridPos": {
"h": 19,
"w": 8,
"x": 8,
"y": 4
},
"id": 1,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"enablePagination": true,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"frameIndex": 124,
"showHeader": true,
"sortBy": []
},
"pluginVersion": "10.0.3",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"editorMode": "code",
"exemplar": false,
"expr": "topk(100, count({__name__!=\"\",job=~\"$job\"}) by (__name__))",
"format": "table",
"instant": true,
"range": false,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"editorMode": "code",
"exemplar": false,
"expr": "count({__name__!=\"\"})",
"format": "table",
"hide": false,
"instant": true,
"range": false,
"refId": "B"
}
],
"title": "Series by metric (top 100)",
"transformations": [
{
"id": "merge",
"options": {}
},
{
"id": "calculateField",
"options": {
"alias": "ratio",
"binary": {
"left": "Value #A",
"operator": "/",
"reducer": "sum",
"right": "Value #B"
},
"mode": "binary",
"reduce": {
"reducer": "sum"
},
"replaceFields": false
}
},
{
"id": "organize",
"options": {
"excludeByName": {},
"indexByName": {},
"renameByName": {
"Time": "",
"__name__": "Metric"
}
}
},
{
"id": "calculateField",
"options": {
"alias": "% of total",
"binary": {
"left": "ratio",
"operator": "*",
"reducer": "sum",
"right": "100"
},
"mode": "binary",
"reduce": {
"reducer": "sum"
}
}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"Value #B": true,
"ratio": true
},
"indexByName": {},
"renameByName": {
"Value #A": "Series count"
}
}
}
],
"type": "table"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Job"
},
"properties": [
{
"id": "links",
"value": [
{
"title": "",
"url": "/d/b0b89a23-8f37-4bfe-962a-f329a654e987/metrics-management?var-job=${__data.fields[\"Job\"]}&${datasource:queryparam}&${metric:queryparam}"
}
]
}
]
},
{
"matcher": {
"id": "byName",
"options": "Series count"
},
"properties": [
{
"id": "custom.width",
"value": 199
}
]
}
]
},
"gridPos": {
"h": 19,
"w": 8,
"x": 16,
"y": 4
},
"id": 5,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"enablePagination": true,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"frameIndex": 124,
"showHeader": true,
"sortBy": []
},
"pluginVersion": "10.0.3",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"editorMode": "code",
"exemplar": false,
"expr": "topk(100, count({__name__!=\"\"}) by (job))",
"format": "table",
"instant": true,
"range": false,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"editorMode": "code",
"exemplar": false,
"expr": "count({__name__!=\"\"})",
"format": "table",
"hide": false,
"instant": true,
"range": false,
"refId": "B"
}
],
"title": "Series by job (top 100)",
"transformations": [
{
"id": "merge",
"options": {}
},
{
"id": "calculateField",
"options": {
"alias": "ratio",
"binary": {
"left": "Value #A",
"operator": "/",
"reducer": "sum",
"right": "Value #B"
},
"mode": "binary",
"reduce": {
"reducer": "sum"
},
"replaceFields": false
}
},
{
"id": "organize",
"options": {
"excludeByName": {},
"indexByName": {},
"renameByName": {
"Time": "",
"__name__": "Metric"
}
}
},
{
"id": "calculateField",
"options": {
"alias": "% of total",
"binary": {
"left": "ratio",
"operator": "*",
"reducer": "sum",
"right": "100"
},
"mode": "binary",
"reduce": {
"reducer": "sum"
}
}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"Value #B": true,
"ratio": true
},
"indexByName": {},
"renameByName": {
"Value #A": "Series count",
"job": "Job"
}
}
}
],
"type": "table"
}
],
"refresh": "",
"schemaVersion": 38,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"current": {
"selected": false,
"text": "eu02",
"value": "eu02"
},
"hide": 0,
"includeAll": false,
"multi": false,
"name": "datasource",
"options": [],
"query": "prometheus",
"queryValue": "",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"type": "datasource"
},
{
"current": {},
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"definition": "label_values(__name__)",
"hide": 0,
"includeAll": false,
"multi": false,
"name": "metric",
"options": [],
"query": {
"query": "label_values(__name__)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
},
{
"allValue": ".+",
"current": {},
"datasource": {
"type": "prometheus",
"uid": "${DS_EU02}"
},
"definition": "label_values(job)",
"hide": 0,
"includeAll": true,
"label": "job (filter for metrics)",
"multi": false,
"name": "job",
"options": [],
"query": {
"query": "label_values(job)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
}
]
},
"time": {
"from": "now-15m",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Metrics management",
"uid": "b0b89a23-8f37-4bfe-962a-f329a654e987",
"version": 3,
"weekStart": ""
}
@michal-kazmierczak
Copy link
Author

michal-kazmierczak commented Aug 13, 2023

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