Vega

Lissage côté serveur : pipeline moving_fn

Moyenne mobile façon pipeline moving_fn d'Elasticsearch superposée à la métrique brute : la spec lit les objets avg_lat.value et smooth.value du bucket — données d'exemple inline.

Cas d'usage

Tendance de latence lissée sur 24 buckets sans surcharger le rendu client.

Prérequis

Kibana 7.10+, Elasticsearch 6.4+

Vega-Lite
{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {
    "values": [
      { "key": "2026-06-08T00:00:00", "avg_lat": { "value": 210 }, "smooth": { "value": 205 } },
      { "key": "2026-06-08T01:00:00", "avg_lat": { "value": 260 }, "smooth": { "value": 225 } },
      { "key": "2026-06-08T02:00:00", "avg_lat": { "value": 195 }, "smooth": { "value": 222 } },
      { "key": "2026-06-08T03:00:00", "avg_lat": { "value": 310 }, "smooth": { "value": 248 } },
      { "key": "2026-06-08T04:00:00", "avg_lat": { "value": 285 }, "smooth": { "value": 258 } },
      { "key": "2026-06-08T05:00:00", "avg_lat": { "value": 240 }, "smooth": { "value": 255 } },
      { "key": "2026-06-08T06:00:00", "avg_lat": { "value": 330 }, "smooth": { "value": 270 } },
      { "key": "2026-06-08T07:00:00", "avg_lat": { "value": 375 }, "smooth": { "value": 295 } },
      { "key": "2026-06-08T08:00:00", "avg_lat": { "value": 290 }, "smooth": { "value": 293 } },
      { "key": "2026-06-08T09:00:00", "avg_lat": { "value": 255 }, "smooth": { "value": 288 } },
      { "key": "2026-06-08T10:00:00", "avg_lat": { "value": 300 }, "smooth": { "value": 292 } },
      { "key": "2026-06-08T11:00:00", "avg_lat": { "value": 270 }, "smooth": { "value": 287 } }
    ]
  },
  "transform": [
    { "calculate": "datum.avg_lat.value", "as": "brut" },
    { "calculate": "datum.smooth.value", "as": "lisse" }
  ],
  "layer": [
    { "mark": { "type": "line", "opacity": 0.3 },
      "encoding": { "x": { "field": "key", "type": "temporal" }, "y": { "field": "brut", "type": "quantitative" } } },
    { "mark": { "type": "line", "strokeWidth": 2.5 },
      "encoding": { "x": { "field": "key", "type": "temporal" }, "y": { "field": "lisse", "type": "quantitative", "title": "Latence (ms)" } } }
  ]
}
Kibanamoving_fnPipeline aggLissage

Snippets liés

Retour au Data Lab