Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
- "title": "Heatmap: Avg duration per method and status_code",
- "data": {
- "url": {
- "%context%": true,
- "%timefield%": "@timestamp",
- "index": "logs-*",
- "body": {
- "size": 0,
- "aggs": {
- "combo": {
- "composite": {
- "size": 2000,
- "sources": [
- { "method": { "terms": { "field": "method" } } },
- { "status": { "terms": { "field": "status_code" } } }
- ]
- },
- "aggs": {
- "avg_duration": { "avg": { "field": "duration_ms" } },
- "p95": { "percentiles": { "field": "duration_ms", "percents": [95] } }
- }
- }
- }
- }
- },
- "format": { "property": "aggregations.combo.buckets" }
- },
- "transform": [
- { "calculate": "datum.key.method", "as": "method" },
- { "calculate": "toNumber(datum.key.status)", "as": "status" },
- { "calculate": "datum.avg_duration.value", "as": "duration" },
- { "calculate": "datum['p95']['values']['95.0']", "as": "p95" },
- { "filter": "isValid(datum.duration)" }
- ],
- "mark": {
- "type": "rect",
- "stroke": "#ffffff",
- "strokeWidth": 0.8
- },
- "encoding": {
- "x": {
- "field": "method",
- "type": "nominal",
- "title": "Method",
- "sort": ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]
- },
- "y": {
- "field": "status",
- "type": "ordinal",
- "title": "Status code",
- "sort": "ascending"
- },
- "color": {
- "field": "duration",
- "type": "quantitative",
- "title": "Avg duration (ms)",
- "scale": {
- "type": "sqrt",
- "scheme": "redyellowgreen",
- "reverse": true
- }
- },
- "tooltip": [
- { "field": "method", "title": "Method" },
- { "field": "status", "title": "Status code" },
- { "field": "duration", "title": "Avg", "format": ".2f" },
- { "field": "p95", "title": "p95 (ms)", "format": ".2f" }
- ]
- }
- }
Advertisement