diff --git a/examples/grafana-integration/README.md b/examples/grafana-integration/README.md new file mode 100644 index 0000000000..a3097f8137 --- /dev/null +++ b/examples/grafana-integration/README.md @@ -0,0 +1,20 @@ +# Pyroscope Grafana Integration +This example shows pyroscope + grafana + prometheus integration + +# Running + +```bash +docker-compose up +``` + +Then access grafana at http://localhost:3000 +Pyroscope is also available at http://localhost:4040 + + +# Development + +To start from scratch, use +``` +yes | docker-compose rm +docker-compose rm +``` diff --git a/examples/grafana-integration/docker-compose.yml b/examples/grafana-integration/docker-compose.yml new file mode 100644 index 0000000000..b929b55129 --- /dev/null +++ b/examples/grafana-integration/docker-compose.yml @@ -0,0 +1,37 @@ +version: "3.9" +services: + prometheus: + image: prom/prometheus:latest + volumes: + - ./prometheus:/etc/prometheus/ + - data-prometheus:/prometheus + + grafana: + image: grafana/grafana:8.1.1 + volumes: + - ./grafana-provisioning:/etc/grafana/provisioning + - ./grafana/grafana.ini:/etc/grafana/grafana.ini + - ./grafana/home.json:/default-dashboard.json + environment: + - "GF_INSTALL_PLUGINS=pyroscope-datasource,pyroscope-panel" + ports: + - 3000:3000 + + pyroscope: + image: "pyroscope/pyroscope:latest" + ports: + - 4040:4040 + command: + - server + environment: + - PYROSCOPE_LOG_LEVEL=info + - PYROSCOPE_WAIT_AFTER_STOP=true + + + go-agent: + build: + context: ../golang + +volumes: + data-prometheus: + driver: local diff --git a/examples/grafana-integration/grafana-provisioning/dashboards/main.yml b/examples/grafana-integration/grafana-provisioning/dashboards/main.yml new file mode 100644 index 0000000000..b61231fa2e --- /dev/null +++ b/examples/grafana-integration/grafana-provisioning/dashboards/main.yml @@ -0,0 +1,8 @@ +apiVersion: 1 + +providers: +- name: dashboards + type: file + updateIntervalSeconds: 5 + options: + path: /etc/grafana/provisioning/dashboards diff --git a/examples/grafana-integration/grafana-provisioning/dashboards/server-prometheus.json b/examples/grafana-integration/grafana-provisioning/dashboards/server-prometheus.json new file mode 100644 index 0000000000..73e9fc6dbe --- /dev/null +++ b/examples/grafana-integration/grafana-provisioning/dashboards/server-prometheus.json @@ -0,0 +1,1469 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "Prometheus", + "enable": true, + "expr": "changes(benchmark[5s]) > 0", + "hide": true, + "iconColor": "rgba(87, 148, 242, 0.24)", + "limit": 100, + "name": "Annotations & Alerts", + "showIn": 0, + "step": "5s", + "titleFormat": "start/stop", + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 1, + "links": [], + "panels": [ + { + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 26, + "targets": [ + { + "queryType": "randomWalk", + "refId": "A" + } + ], + "title": "CPU", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 1 + }, + "hiddenSeries": false, + "id": 3, + "interval": "1", + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "cpu_utilization{}", + "interval": "", + "legendFormat": "{{__name__}}", + "queryType": "randomWalk", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "CPU Utilization", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:81", + "format": "percent", + "label": null, + "logBase": 1, + "max": "100", + "min": "0", + "show": true + }, + { + "$$hashKey": "object:82", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 8, + "y": 1 + }, + "hiddenSeries": false, + "id": 10, + "interval": "1", + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "{__name__=~\"go_goroutines\", instance=\"pyroscope:4040\"}", + "interval": "", + "legendFormat": "{{__name__}}", + "queryType": "randomWalk", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Goroutines", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:42", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:43", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 16, + "y": 1 + }, + "hiddenSeries": false, + "id": 29, + "interval": "1", + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "rate(storage_reads_total{}[1m])", + "hide": false, + "interval": "", + "legendFormat": "reads", + "queryType": "randomWalk", + "refId": "A" + }, + { + "exemplar": true, + "expr": "rate(storage_writes_total{}[1m])", + "hide": false, + "interval": "", + "legendFormat": "writes", + "queryType": "randomWalk", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Throughput", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:42", + "format": "reqps", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:43", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 9 + }, + "id": 24, + "panels": [], + "title": "Memory", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 10 + }, + "hiddenSeries": false, + "id": 6, + "interval": "1", + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "{__name__=~\"go_memstats_.+bytes\", instance=\"pyroscope:4040\"}", + "interval": "", + "legendFormat": "{{__name__}}", + "queryType": "randomWalk", + "refId": "A" + }, + { + "exemplar": true, + "expr": "evictions_total_bytes{}", + "hide": false, + "interval": "", + "legendFormat": "RAM total", + "queryType": "randomWalk", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Memory", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "go_memstats_(.*)_bytes", + "renamePattern": "$1" + } + } + ], + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:123", + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:124", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "description": "Number of objects in cache", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 8, + "y": 10 + }, + "hiddenSeries": false, + "id": 1, + "interval": "1", + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "{__name__=~\"cache_.+_size\"}", + "instant": false, + "interval": "", + "legendFormat": "{{__name__}}", + "queryType": "randomWalk", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Cache Size", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "cache_(.*)_size", + "renamePattern": "$1" + } + } + ], + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:560", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:561", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "description": "", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 16, + "y": 10 + }, + "hiddenSeries": false, + "id": 15, + "interval": "1", + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "cache_dicts_hit / (cache_dicts_hit+cache_dicts_miss)", + "instant": false, + "interval": "", + "legendFormat": "cache_dicts_hit_rate", + "queryType": "randomWalk", + "refId": "A" + }, + { + "exemplar": true, + "expr": "cache_trees_hit / (cache_trees_hit+cache_trees_miss)", + "hide": false, + "instant": false, + "interval": "", + "legendFormat": "cache_trees_hit_rate", + "queryType": "randomWalk", + "refId": "B" + }, + { + "exemplar": true, + "expr": "cache_segments_hit / (cache_segments_hit+cache_segments_miss)", + "hide": false, + "instant": false, + "interval": "", + "legendFormat": "cache_segments_hit_rate", + "queryType": "randomWalk", + "refId": "C" + }, + { + "exemplar": true, + "expr": "cache_dimensions_hit / (cache_dimensions_hit+cache_dimensions_miss)", + "hide": false, + "instant": false, + "interval": "", + "legendFormat": "cache_dimensions_hit_rate", + "queryType": "randomWalk", + "refId": "D" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Cache Hit Ratios", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "cache_(.*)_hit_rate", + "renamePattern": "$1" + } + } + ], + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:560", + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:561", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 18 + }, + "hiddenSeries": false, + "id": 12, + "interval": "1", + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "evictions", + "yaxis": 2 + }, + { + "alias": "evictions_count", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "{__name__=~\"evictions_timer\", instance=\"pyroscope:4040\"}", + "interval": "", + "legendFormat": "{{__name__}}", + "queryType": "randomWalk", + "refId": "A" + }, + { + "exemplar": true, + "expr": "{__name__=~\"evictions_count\", instance=\"pyroscope:4040\"}", + "hide": false, + "interval": "", + "legendFormat": "{{__name__}}", + "queryType": "randomWalk", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Cache Evictions Timer", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:42", + "format": "ns", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:43", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 8, + "y": 18 + }, + "hiddenSeries": false, + "id": 20, + "interval": "1", + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "evictions", + "yaxis": 2 + }, + { + "alias": "write_back_count", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "{__name__=~\"write_back_timer\", instance=\"pyroscope:4040\"}", + "interval": "", + "legendFormat": "{{__name__}}", + "queryType": "randomWalk", + "refId": "A" + }, + { + "exemplar": true, + "expr": "{__name__=~\"write_back_count\", instance=\"pyroscope:4040\"}", + "hide": false, + "interval": "", + "legendFormat": "{{__name__}}", + "queryType": "randomWalk", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Cache Write Back Timer", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:42", + "format": "ns", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:43", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "datasource": null, + "gridPos": { + "h": 8, + "w": 8, + "x": 16, + "y": 18 + }, + "id": 28, + "options": { + "content": "
\n<<< Evictions & Write Back\n
\n\nCache objects have two ways of getting persisted:\n* via evictions when there's memory pressure\n* via write-back mechanism that's continiuosly saving data on disk", + "mode": "markdown" + }, + "pluginVersion": "8.1.1", + "targets": [ + { + "queryType": "randomWalk", + "refId": "A" + } + ], + "timeFrom": null, + "timeShift": null, + "transparent": true, + "type": "text" + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 26 + }, + "id": 22, + "panels": [], + "targets": [ + { + "queryType": "randomWalk", + "refId": "A" + } + ], + "title": "Storage", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 27 + }, + "hiddenSeries": false, + "id": 2, + "interval": "1", + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "{__name__=~\"disk_.+\"}", + "interval": "", + "legendFormat": "{{__name__}}", + "queryType": "randomWalk", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Badger Space Breakdown", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "disk_(.*)", + "renamePattern": "$1" + } + } + ], + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:74", + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:75", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 5, + "x": 8, + "y": 27 + }, + "hiddenSeries": false, + "id": 17, + "interval": "1", + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "{__name__=~\"storage_.+_read\"}", + "interval": "", + "legendFormat": "{{__name__}}", + "queryType": "randomWalk", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Badger Reads", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "storage_(.*)_read", + "renamePattern": "$1" + } + } + ], + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:66", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:67", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 5, + "x": 13, + "y": 27 + }, + "hiddenSeries": false, + "id": 18, + "interval": "1", + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "{__name__=~\"storage_.+_write\"}", + "interval": "", + "legendFormat": "{{__name__}}", + "queryType": "randomWalk", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Badger Writes", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "storage_(.*)_write", + "renamePattern": "$1" + } + } + ], + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:66", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:67", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 5, + "x": 18, + "y": 27 + }, + "hiddenSeries": false, + "id": 14, + "interval": "1", + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "evictions_used_perc", + "yaxis": 1 + }, + { + "alias": "retention_count", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "exemplar": true, + "expr": "retention_timer", + "hide": false, + "interval": "", + "legendFormat": "{{__name__}}", + "queryType": "randomWalk", + "refId": "D" + }, + { + "exemplar": true, + "expr": "retention_count", + "hide": false, + "interval": "", + "legendFormat": "{{__name__}}", + "queryType": "randomWalk", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Retention", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:42", + "format": "ns", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "$$hashKey": "object:43", + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "refresh": "", + "schemaVersion": 30, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-30m", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "browser", + "title": "Pyroscope Server (Prometheus)", + "uid": "65gjqY3Mk", + "version": 25 +} diff --git a/examples/grafana-integration/grafana-provisioning/dashboards/server-pyroscope.json b/examples/grafana-integration/grafana-provisioning/dashboards/server-pyroscope.json new file mode 100644 index 0000000000..67f8f15f88 --- /dev/null +++ b/examples/grafana-integration/grafana-provisioning/dashboards/server-pyroscope.json @@ -0,0 +1,153 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "id": 3, + "links": [], + "panels": [ + { + "datasource": "Pyroscope", + "gridPos": { + "h": 6, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 2, + "targets": [ + { + "format": "json", + "from": "now-1h", + "name": "pyroscope.server.cpu", + "queryType": "randomWalk", + "refId": "A", + "until": "now" + } + ], + "title": "pyroscope.server.cpu", + "type": "pyroscope-panel" + }, + { + "datasource": "Pyroscope", + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 6 + }, + "id": 5, + "targets": [ + { + "format": "json", + "from": "now-1h", + "name": "pyroscope.server.alloc_objects", + "queryType": "randomWalk", + "refId": "A", + "until": "now" + } + ], + "title": "pyroscope.server.alloc_objects", + "type": "pyroscope-panel" + }, + { + "datasource": "Pyroscope", + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 13 + }, + "id": 6, + "targets": [ + { + "format": "json", + "from": "now-1h", + "name": "pyroscope.server.alloc_space", + "queryType": "randomWalk", + "refId": "A", + "until": "now" + } + ], + "title": "pyroscope.server.alloc_space", + "type": "pyroscope-panel" + }, + { + "datasource": "Pyroscope", + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 20 + }, + "id": 3, + "targets": [ + { + "format": "json", + "from": "now-1h", + "name": "pyroscope.server.inuse_objects", + "queryType": "randomWalk", + "refId": "A", + "until": "now" + } + ], + "title": "pyroscope.server.inuse_objects", + "type": "pyroscope-panel" + }, + { + "datasource": "Pyroscope", + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 27 + }, + "id": 4, + "targets": [ + { + "format": "json", + "from": "now-1h", + "name": "pyroscope.server.inuse_space", + "queryType": "randomWalk", + "refId": "A", + "until": "now" + } + ], + "title": "pyroscope.server.inuse_space", + "type": "pyroscope-panel" + } + ], + "schemaVersion": 30, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Pyroscope Server (Pyroscope)", + "uid": "J5dv1uG7z", + "version": 2 +} diff --git a/examples/grafana-integration/grafana-provisioning/dashboards/simple-go-app.json b/examples/grafana-integration/grafana-provisioning/dashboards/simple-go-app.json new file mode 100644 index 0000000000..3a87f7de83 --- /dev/null +++ b/examples/grafana-integration/grafana-provisioning/dashboards/simple-go-app.json @@ -0,0 +1,152 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "links": [], + "panels": [ + { + "datasource": "Pyroscope", + "gridPos": { + "h": 6, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 2, + "targets": [ + { + "format": "json", + "from": "now-1h", + "name": "simple.golang.app.cpu", + "queryType": "randomWalk", + "refId": "A", + "until": "now" + } + ], + "title": "simple.golang.app.cpu", + "type": "pyroscope-panel" + }, + { + "datasource": "Pyroscope", + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 6 + }, + "id": 5, + "targets": [ + { + "format": "json", + "from": "now-1h", + "name": "simple.golang.app.alloc_objects", + "queryType": "randomWalk", + "refId": "A", + "until": "now" + } + ], + "title": "simple.golang.app.alloc_objects", + "type": "pyroscope-panel" + }, + { + "datasource": "Pyroscope", + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 13 + }, + "id": 6, + "targets": [ + { + "format": "json", + "from": "now-1h", + "name": "simple.golang.app.alloc_space", + "queryType": "randomWalk", + "refId": "A", + "until": "now" + } + ], + "title": "simple.golang.app.alloc_space", + "type": "pyroscope-panel" + }, + { + "datasource": "Pyroscope", + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 20 + }, + "id": 3, + "targets": [ + { + "format": "json", + "from": "now-1h", + "name": "simple.golang.app.inuse_objects", + "queryType": "randomWalk", + "refId": "A", + "until": "now" + } + ], + "title": "simple.golang.app.inuse_objects", + "type": "pyroscope-panel" + }, + { + "datasource": "Pyroscope", + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 27 + }, + "id": 4, + "targets": [ + { + "format": "json", + "from": "now-1h", + "name": "simple.golang.app.inuse_space", + "queryType": "randomWalk", + "refId": "A", + "until": "now" + } + ], + "title": "simple.golang.app.inuse_space", + "type": "pyroscope-panel" + } + ], + "schemaVersion": 30, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Simple Go App (Pyroscope)", + "uid": "aLlBhXM7z", + "version": 1 +} diff --git a/examples/grafana-integration/grafana-provisioning/datasources/datasources.yml b/examples/grafana-integration/grafana-provisioning/datasources/datasources.yml new file mode 100644 index 0000000000..e0c1bbec41 --- /dev/null +++ b/examples/grafana-integration/grafana-provisioning/datasources/datasources.yml @@ -0,0 +1,18 @@ +--- +apiVersion: 1 + +datasources: + - name: Prometheus + type: prometheus + access: proxy + orgId: 1 + uid: prometheus + url: http://prometheus:9090 + + - name: Pyroscope + type: pyroscope-datasource + access: proxy + orgId: 1 + uid: pyroscope + jsonData: + path: http://pyroscope:4040 diff --git a/examples/grafana-integration/grafana/grafana.ini b/examples/grafana-integration/grafana/grafana.ini new file mode 100644 index 0000000000..65cc3376e0 --- /dev/null +++ b/examples/grafana-integration/grafana/grafana.ini @@ -0,0 +1,975 @@ +##################### Grafana Configuration Example ##################### +# +# Everything has defaults so you only need to uncomment things you want to +# change + +# possible values : production, development +;app_mode = production + +# instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty +;instance_name = ${HOSTNAME} + +#################################### Paths #################################### +[paths] +# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used) +;data = /var/lib/grafana + +# Temporary files in `data` directory older than given duration will be removed +;temp_data_lifetime = 24h + +# Directory where grafana can store logs +;logs = /var/log/grafana + +# Directory where grafana will automatically scan and look for plugins +;plugins = /var/lib/grafana/plugins + +# folder that contains provisioning config files that grafana will apply on startup and while running. +provisioning = /etc/grafana/provisioning + +#################################### Server #################################### +[server] +# Protocol (http, https, h2, socket) +;protocol = http + +# The ip address to bind to, empty will bind to all interfaces +;http_addr = + +# The http port to use +;http_port = 3000 + +# The public facing domain name used to access grafana from a browser +;domain = localhost + +# Redirect to correct domain if host header does not match domain +# Prevents DNS rebinding attacks +;enforce_domain = false + +# The full public facing url you use in browser, used for redirects and emails +# If you use reverse proxy and sub path specify full url (with sub path) +;root_url = %(protocol)s://%(domain)s:%(http_port)s/ + +# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons. +;serve_from_sub_path = false + +# Log web requests +;router_logging = false + +# the path relative working path +;static_root_path = public + +# enable gzip +;enable_gzip = false + +# https certs & key file +;cert_file = +;cert_key = + +# Unix socket path +;socket = + +# CDN Url +;cdn_url = + +# Sets the maximum time using a duration format (5s/5m/5ms) before timing out read of an incoming request and closing idle connections. +# `0` means there is no timeout for reading the request. +;read_timeout = 0 + +#################################### Database #################################### +[database] +# You can configure the database connection by specifying type, host, name, user and password +# as separate properties or as on string using the url properties. + +# Either "mysql", "postgres" or "sqlite3", it's your choice +;type = sqlite3 +;host = 127.0.0.1:3306 +;name = grafana +;user = root +# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;""" +;password = + +# Use either URL or the previous fields to configure the database +# Example: mysql://user:secret@host:port/database +;url = + +# For "postgres" only, either "disable", "require" or "verify-full" +;ssl_mode = disable + +# Database drivers may support different transaction isolation levels. +# Currently, only "mysql" driver supports isolation levels. +# If the value is empty - driver's default isolation level is applied. +# For "mysql" use "READ-UNCOMMITTED", "READ-COMMITTED", "REPEATABLE-READ" or "SERIALIZABLE". +;isolation_level = + +;ca_cert_path = +;client_key_path = +;client_cert_path = +;server_cert_name = + +# For "sqlite3" only, path relative to data_path setting +;path = grafana.db + +# Max idle conn setting default is 2 +;max_idle_conn = 2 + +# Max conn setting default is 0 (mean not set) +;max_open_conn = + +# Connection Max Lifetime default is 14400 (means 14400 seconds or 4 hours) +;conn_max_lifetime = 14400 + +# Set to true to log the sql calls and execution times. +;log_queries = + +# For "sqlite3" only. cache mode setting used for connecting to the database. (private, shared) +;cache_mode = private + +################################### Data sources ######################### +[datasources] +# Upper limit of data sources that Grafana will return. This limit is a temporary configuration and it will be deprecated when pagination will be introduced on the list data sources API. +;datasource_limit = 5000 + +#################################### Cache server ############################# +[remote_cache] +# Either "redis", "memcached" or "database" default is "database" +;type = database + +# cache connectionstring options +# database: will use Grafana primary database. +# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0,ssl=false`. Only addr is required. ssl may be 'true', 'false', or 'insecure'. +# memcache: 127.0.0.1:11211 +;connstr = + +#################################### Data proxy ########################### +[dataproxy] + +# This enables data proxy logging, default is false +;logging = false + +# How long the data proxy waits to read the headers of the response before timing out, default is 30 seconds. +# This setting also applies to core backend HTTP data sources where query requests use an HTTP client with timeout set. +;timeout = 30 + +# How long the data proxy waits to establish a TCP connection before timing out, default is 10 seconds. +;dialTimeout = 10 + +# How many seconds the data proxy waits before sending a keepalive probe request. +;keep_alive_seconds = 30 + +# How many seconds the data proxy waits for a successful TLS Handshake before timing out. +;tls_handshake_timeout_seconds = 10 + +# How many seconds the data proxy will wait for a server's first response headers after +# fully writing the request headers if the request has an "Expect: 100-continue" +# header. A value of 0 will result in the body being sent immediately, without +# waiting for the server to approve. +;expect_continue_timeout_seconds = 1 + +# The maximum number of idle connections that Grafana will keep alive. +;max_idle_connections = 100 + +# The maximum number of idle connections per host that Grafana will keep alive. +;max_idle_connections_per_host = 2 + +# How many seconds the data proxy keeps an idle connection open before timing out. +;idle_conn_timeout_seconds = 90 + +# If enabled and user is not anonymous, data proxy will add X-Grafana-User header with username into the request, default is false. +;send_user_header = false + +#################################### Analytics #################################### +[analytics] +# Server reporting, sends usage counters to stats.grafana.org every 24 hours. +# No ip addresses are being tracked, only simple counters to track +# running instances, dashboard and error counts. It is very helpful to us. +# Change this option to false to disable reporting. +;reporting_enabled = true + +# The name of the distributor of the Grafana instance. Ex hosted-grafana, grafana-labs +;reporting_distributor = grafana-labs + +# Set to false to disable all checks to https://grafana.net +# for new versions (grafana itself and plugins), check is used +# in some UI views to notify that grafana or plugin update exists +# This option does not cause any auto updates, nor send any information +# only a GET request to http://grafana.com to get latest versions +;check_for_updates = true + +# Google Analytics universal tracking code, only enabled if you specify an id here +;google_analytics_ua_id = + +# Google Tag Manager ID, only enabled if you specify an id here +;google_tag_manager_id = + +#################################### Security #################################### +[security] +# disable creation of admin user on first start of grafana +;disable_initial_admin_creation = false + +# default admin user, created on startup +;admin_user = admin + +# default admin password, can be changed before first start of grafana, or in profile settings +;admin_password = admin + +# used for signing +;secret_key = SW2YcwTIb9zpOOhoPsMm + +# disable gravatar profile images +;disable_gravatar = false + +# data source proxy whitelist (ip_or_domain:port separated by spaces) +;data_source_proxy_whitelist = + +# disable protection against brute force login attempts +;disable_brute_force_login_protection = false + +# set to true if you host Grafana behind HTTPS. default is false. +;cookie_secure = false + +# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict", "none" and "disabled" +;cookie_samesite = lax + +# set to true if you want to allow browsers to render Grafana in a ,