Transformations and Data Processing
You'll learn how to reshape, filter, and enhance query results in Grafana using built-in transformations before displaying them on your dashboards.
What Are Transformations?
When you query metrics from Prometheus or another data source, the raw results often need refinement before visualization. Transformations are Grafana's post-query processing tools that let you manipulate data after it's retrieved but before it's displayed. Think of them as a production line: raw data comes in, transformations reshape it, and polished visualizations come out.
Unlike variables (which modify queries) or panel settings (which change appearance), transformations work on the actual data structure.
Common Transformation Types
Merge combines multiple query results into a single table. If you're pulling CPU and memory metrics separately, merge unifies them by timestamp or label, creating a consolidated view.
Filter by name removes unwanted fields or series. Imagine querying ten microservices but only needing three—filter strips away the noise based on field names or patterns.
Add field from calculation creates new columns using math or logic. You might calculate percentage utilization by dividing used_memory by total_memory, or compute differences between consecutive values.
Organize fields lets you rename columns, reorder them, or hide unnecessary ones—essential for making data human-readable.
Why They Matter
Transformations solve the gap between "what your query returns" and "what your audience needs to see." Instead of writing complex PromQL for every edge case, you can use simple queries and let transformations handle the finesse—reducing query complexity and improving dashboard maintainability.
Key Takeaway:
Grafana transformations let you merge, filter, calculate, and reshape query results post-retrieval, turning raw metrics into precisely formatted data for your visualizations.