From 61ad3191493e483befec58d6cc2de27bdccf2a1e Mon Sep 17 00:00:00 2001 From: Raja Kolli Date: Sun, 10 Sep 2023 12:41:28 +0000 Subject: [PATCH] feat: removes fluent bit and adds new panel --- docker/fluent-bit/fluent-bit.conf | 15 - .../dashboards/logs_traces_metrics.json | 476 +++++++++--------- docker/grafana/datasource.yml | 17 +- 3 files changed, 244 insertions(+), 264 deletions(-) delete mode 100644 docker/fluent-bit/fluent-bit.conf diff --git a/docker/fluent-bit/fluent-bit.conf b/docker/fluent-bit/fluent-bit.conf deleted file mode 100644 index 1087847a..00000000 --- a/docker/fluent-bit/fluent-bit.conf +++ /dev/null @@ -1,15 +0,0 @@ -[INPUT] - Name forward - Listen 0.0.0.0 - Port 24224 -[Output] - Name grafana-loki - Match * - Url ${LOKI_URL} - RemoveKeys source,container_id - Labels {job="fluent-bit"} - LabelKeys container_name - BatchWait 1s - BatchSize 1001024 - LineFormat json - LogLevel info \ No newline at end of file diff --git a/docker/grafana/dashboards/logs_traces_metrics.json b/docker/grafana/dashboards/logs_traces_metrics.json index a17f3b2a..cc6cc05d 100644 --- a/docker/grafana/dashboards/logs_traces_metrics.json +++ b/docker/grafana/dashboards/logs_traces_metrics.json @@ -1,256 +1,244 @@ { - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "grafana", - "uid": "-- Grafana --" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "target": { - "limit": 100, - "matchAny": false, - "tags": [], - "type": "dashboard" - }, - "type": "dashboard" - } - ] + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- 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, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "loki", + "uid": "loki-micro-service" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 7, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": true, + "showCommonLabels": true, + "showLabels": true, + "showTime": true, + "sortOrder": "Descending", + "wrapLogMessage": true + }, + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "loki-micro-service" + }, + "editorMode": "builder", + "expr": "{container=\"api-gateway\"} |= ``", + "queryType": "range", + "refId": "A" + } + ], + "title": "API-GATEWAY-LOGS", + "transparent": true, + "type": "logs" }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "id": 6, - "iteration": 1654517000502, - "links": [], - "liveNow": false, - "panels": [ + { + "datasource": { + "type": "loki", + "uid": "loki-micro-service" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 8, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": true, + "showCommonLabels": true, + "showLabels": true, + "showTime": true, + "sortOrder": "Descending", + "wrapLogMessage": true + }, + "targets": [ { - "datasource": { - "type": "loki", - "uid": "loki-micro-service" + "datasource": { + "type": "loki", + "uid": "loki-micro-service" + }, + "editorMode": "builder", + "expr": "{container=\"catalog-service\"} |= ``", + "queryType": "range", + "refId": "A" + } + ], + "title": "CATALOG-SERVICE-LOGS", + "type": "logs" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus-micro-service" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false }, - "description": "", - "gridPos": { - "h": 10, - "w": 23, - "x": 0, - "y": 0 + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" }, - "id": 2, - "options": { - "dedupStrategy": "none", - "enableLogDetails": true, - "prettifyLogMessage": true, - "showCommonLabels": true, - "showLabels": true, - "showTime": true, - "sortOrder": "Ascending", - "wrapLogMessage": true + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" }, - "targets": [ - { - "datasource": { - "type": "loki", - "uid": "loki-micro-service" - }, - "editorMode": "builder", - "expr": "{traceID=\"$traceID\"}", - "queryType": "range", - "refId": "A" - } - ], - "title": "Logs with trace ID $traceID", - "type": "logs" + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 23, + "x": 0, + "y": 8 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ { - "datasource": { - "type": "tempo", - "uid": "tempo" - }, - "description": "", - "gridPos": { - "h": 15, - "w": 23, - "x": 0, - "y": 10 - }, - "id": 6, - "targets": [ - { - "datasource": { - "type": "tempo", - "uid": "tempo" - }, - "query": "$traceID", - "queryType": "traceId", - "refId": "A" - } - ], - "title": "Trace View for trace with id $traceID", - "type": "traces" + "datasource": { + "type": "prometheus", + "uid": "prometheus-micro-service" + }, + "editorMode": "code", + "exemplar": true, + "expr": "histogram_quantile(1.00, sum(rate(http_server_requests_seconds_bucket{uri=~\".*\"}[$__rate_interval])) by (le))", + "legendFormat": "max", + "range": true, + "refId": "A" }, { - "datasource": { - "type": "prometheus", - "uid": "prometheus-micro-service" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "h": 10, - "w": 23, - "x": 0, - "y": 25 - }, - "id": 4, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus-micro-service" - }, - "editorMode": "code", - "exemplar": true, - "expr": "histogram_quantile(1.00, sum(rate(http_server_requests_seconds_bucket{uri=~\".*\"}[$__rate_interval])) by (le))", - "legendFormat": "max", - "range": true, - "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus-micro-service" - }, - "editorMode": "code", - "exemplar": true, - "expr": "histogram_quantile(0.99, sum(rate(http_server_requests_seconds_bucket{uri=~\".*\"}[$__rate_interval])) by (le))", - "hide": false, - "legendFormat": "tp99", - "range": true, - "refId": "B" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus-micro-service" - }, - "editorMode": "code", - "exemplar": true, - "expr": "histogram_quantile(0.95, sum(rate(http_server_requests_seconds_bucket{uri=~\".*\"}[$__rate_interval])) by (le))", - "hide": false, - "legendFormat": "tp95", - "range": true, - "refId": "C" - } - ], - "title": "latency for All", - "type": "timeseries" + "datasource": { + "type": "prometheus", + "uid": "prometheus-micro-service" + }, + "editorMode": "code", + "exemplar": true, + "expr": "histogram_quantile(0.99, sum(rate(http_server_requests_seconds_bucket{uri=~\".*\"}[$__rate_interval])) by (le))", + "hide": false, + "legendFormat": "tp99", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus-micro-service" + }, + "editorMode": "code", + "exemplar": true, + "expr": "histogram_quantile(0.95, sum(rate(http_server_requests_seconds_bucket{uri=~\".*\"}[$__rate_interval])) by (le))", + "hide": false, + "legendFormat": "tp95", + "range": true, + "refId": "C" } - ], - "schemaVersion": 36, - "style": "dark", - "tags": [], - "templating": { - "list": [ - { - "current": { - "selected": false, - "text": "0003776c79e02b6c", - "value": "0003776c79e02b6c" - }, - "datasource": { - "type": "loki", - "uid": "loki-micro-service" - }, - "definition": "label_values(traceID)", - "hide": 0, - "includeAll": false, - "label": "Trace ID", - "multi": false, - "name": "traceID", - "options": [], - "query": "label_values(traceID)", - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - } - ] - }, - "time": { - "from": "now-15m", - "to": "now" - }, - "timepicker": {}, - "timezone": "", - "title": "Logs, Traces, Metrics", - "uid": "szVLMe97z", - "version": 7, - "weekStart": "" + ], + "title": "latency for All", + "type": "timeseries" + } + ], + "refresh": "5s", + "schemaVersion": 38, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-15m", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Logs, Traces, Metrics", + "uid": "szVLMe97z", + "version": 1, + "weekStart": "" } \ No newline at end of file diff --git a/docker/grafana/datasource.yml b/docker/grafana/datasource.yml index 0044998a..fee129f0 100644 --- a/docker/grafana/datasource.yml +++ b/docker/grafana/datasource.yml @@ -10,7 +10,6 @@ datasources: type: prometheus uid: prometheus-micro-service access: proxy - orgId: 1 url: http://host.docker.internal:9090 basicAuth: false isDefault: false @@ -25,7 +24,6 @@ datasources: type: tempo uid: tempo-micro-service access: proxy - orgId: 1 url: http://tempo:3100 basicAuth: false isDefault: false @@ -33,6 +31,14 @@ datasources: editable: true jsonData: httpMethod: GET + tracesToMetrics: + datasourceUid: prometheus-micro-service + tags: [ { key: 'service.name', value: 'application' }, { key: 'org' }, { key: 'method' }, { key: 'uri' }, { key: 'outcome' }, { key: 'status' }, { key: 'exception' } ] + queries: + - name: 'Throughput' + query: 'sum(rate(http_server_requests_seconds_count{$$__tags}[$$__rate_interval]))' + - name: 'Latency' + query: 'histogram_quantile(1.00, sum(rate(http_server_requests_seconds_bucket{$$__tags}[$$__rate_interval])) by (le))' tracesToLogs: datasourceUid: 'loki-micro-service' tags: [ 'instance', 'pod', 'namespace', 'hostname' ] @@ -43,8 +49,10 @@ datasources: filterByTraceID: true filterBySpanID: false lokiSearch: true + lokiSearch: + datasourceUid: loki-micro-service serviceMap: - datasourceUid: 'prometheus-micro-service' + datasourceUid: prometheus-micro-service search: hide: false nodeGraph: @@ -53,7 +61,6 @@ datasources: type: loki uid: loki-micro-service access: proxy - orgId: 1 url: http://loki:3100 basicAuth: false isDefault: true @@ -63,5 +70,5 @@ datasources: derivedFields: - datasourceUid: tempo-micro-service matcherRegex: \[.+,(.+?), - name: TraceID + name: traceId url: $${__value.raw} \ No newline at end of file