What You'll Learn
Use the productivity-metrics POST endpoint for aggregated OEE data
Handle the 10-minute alignment requirement for datetime ranges
Create hidden time variables that round to valid intervals
Build department overview tables with multiple machines
Use gauge cells and continuous color scales for visualization
Completed Tutorials 4.1-4.4
Understanding of Infinity POST requests
Familiarity with dashboard variables
The productivity-metrics endpoint provides aggregated OEE metrics for custom time ranges:
Productivity (OEE) – Overall Equipment Effectiveness
Availability – Uptime vs downtime
Performance – Actual vs theoretical output
Quality – Good output vs scrap
When to Use Each Endpoint
Per-run OEE, flexible time ranges
Aggregated OEE over custom periods (shifts, days, weeks)
Use production-runs (Tutorial 4.2) for:
Quick queries with ${__from:date:iso} and ${__to:date:iso}
Use productivity-metrics (this tutorial) for:
Aggregated metrics across shifts or custom periods
Department-level summaries
When you need more control over time alignment
The 10-Minute Alignment Requirement
Important: The productivity-metrics endpoint requires datetime ranges with 10-minute alignment:
Valid examples:
Invalid examples:
2024-01-15T08:05:00.000Z (minutes not aligned)
2024-01-15T14:30:45.000Z (seconds not zero)
Why This Matters
When users select time ranges in Grafana, the values often include arbitrary seconds and milliseconds:
User clicks "Last 8 hours" at 14:37:23 -> ${__from} = 1705323443000
This converts to 2024-01-15T06:37:23.000Z – not 10-minute aligned!
Solution: Create hidden variables that round times to valid intervals.
Creating Time-Aligned Variables
Option A: Round to the Hour (Simplest)
Use Grafana's date formatting to round to full hours:
${__from:date:YYYY-MM-DDTHH:00:00}+00:00
Result: 2024-01-15T06:00:00+00:00 (always valid)
However, constant variables don't update when the time range changes.
Option B: Round to 10-Minute Intervals (Advanced)
Create a Query variable with inline data and JSONata:
Variable: start
Query configuration:
JSONata for 10-minute rounding:
This JSONata:
Takes the millisecond timestamp from Grafana
Rounds down to the nearest 10 minutes (600000 ms = 10 min)
Converts back to ISO format
Variable: end
Create a second variable with the same configuration, but use ${__to} instead:
[SCREENSHOT: Hidden time variable configuration]
Querying Productivity Metrics
Basic POST Request
The productivity-metrics endpoint requires a POST request with datetime ranges:
URL:
Method: POST
Body:
Infinity Query Configuration
machines/${machine}/productivity-metrics
Root selector for extracting scores:
Note: Quality may not exist for all machines, so we default to 1 if missing.
[SCREENSHOT: POST request configuration in Infinity]
Building a Department OEE Table
A department overview shows all machines in a table with OEE scores side-by-side.
Step 1: Create Multiple Machine Queries
For each machine, create a separate query (Query A, B, C, etc.):
Query A (Kiefel):
machines/141e0927-62b3-4e76-8398-ad82d20f397f/productivity-metrics
{"datetime_ranges": [{"start": "${start}", "end": "${end}"}]}
JSONata for scores (see above)
Add computed columns to identify the machine:
"141e0927-62b3-4e76-8398-ad82d20f397f"
Note: The selector uses quoted string literals to add fixed values.
Query B (Macchi):
Same configuration with:
URL: machines/cc0d2dcb-564b-48cd-a342-71765a536058/productivity-metrics
Computed columns: "cc0d2dcb-..." and "Macchi"
Repeat for all machines in the department.
[SCREENSHOT: Multiple queries with computed columns]
Transformations combine the multiple query results:
Add transformation -> Merge
This combines all machine queries into a single table.
[SCREENSHOT: Merge transformation result]
Step 3: Organize Columns
Add another transformation to clean up the table:
Add transformation -> Organize fields
Hide: machine_uuid (keep only for filtering)
Rename:
availability -> Availability
performance -> Performance
Reorder: Machine, OEE, Availability, Performance, Quality
[SCREENSHOT: Organize fields configuration]
Gauge Cells for OEE Columns
Make each score column display as a gauge:
Add override -> Fields with name -> OEE
Add property -> Cell type -> Gauge
Repeat for Availability, Performance, and Quality.
Continuous Color Scale
Use a red-yellow-green gradient for instant visual feedback:
In Defaults (Standard options):
Color scheme -> Continuous - RdYlGr (From thresholds)
Or use field overrides for specific columns
Configure thresholds if using threshold-based colors:
[SCREENSHOT: Color scale configuration]
Unit Configuration
Set the unit to display as percentages:
Show department averages in the table footer:
This displays the average OEE across all machines at the bottom.
[SCREENSHOT: Table with gauge cells and footer]
Complete Example: Department Overview
Sites endpoint, display name/uuid
Inline with 10-min rounding JSONata
Inline with 10-min rounding JSONata
Panel Configuration
Visualization: Table
Queries: One per machine with computed columns for name
Transformations:
Organize fields (hide uuid, rename columns)
Field Config:
Color mode: continuous-RdYlGr
Overrides:
OEE, Availability, Performance, Quality: Cell type = Gauge
Options:
Footer: Show with Mean calculation
Sort: By Machine name (ascending)
Comparison: Production Runs vs Productivity Metrics
Feature
production-runs
productivity-metrics
Aggregated over time range
Requires aligned time variables
Supported (array of ranges)
Shift reports, daily summaries
When to use each:
Simple dashboards with time picker: Use production-runs with ${__from:date:iso}
Shift-based reports: Use productivity-metrics with aligned time variables
Historical comparisons: Use productivity-metrics with multiple datetime_ranges
Practical Exercise
Build a department OEE dashboard with:
Variables:
Hidden start and end variables with 10-minute rounding
OEE Table:
Queries for 5 machines (Kiefel, Macchi, Alpine, Reifenhauser, W&H Varex)
Gauge cells with RdYlGr color scale
Footer with mean averages
Summary Stats:
Department average OEE (single stat panel)
Calculated using same queries with Reduce transformation
You've learned to build OEE dashboards with aggregated metrics:
The productivity-metrics endpoint requires 10-minute aligned datetime ranges
Create hidden variables with JSONata to round times automatically
Use multiple queries with computed columns for multi-machine tables
Apply Merge transformation to combine results
Style with gauge cells and continuous color scales
Show department averages with table footers
Continue with:
Quick Reference
10-Minute Rounding JSONata
POST Request Body
JSONata for OEE Extraction
Computed Column for Machine Name
Field Overrides for Gauge Cells