Metrics Ingestion
Send canonical metrics to ModularIoT. This section covers the ingestion workflow, mapping strategies, and best practices for high-quality metric data.
The Canonical Contract
When you send metrics to ModularIoT, you’re making a contract:
- Correct key from the metrics registry
- Correct unit (always canonical—km/h, °C, L)
- Valid timestamp (device time, ISO 8601)
- Plausible value (within expected ranges)
ModularIoT validates every metric against this contract. Invalid data is rejected with specific error codes.
Ingestion Workflow
Your Device → Driver/SDK → Canonical Metrics → ModularIoT API
↓
• Parse raw data
• Convert units
• Map to canonical keys
• Validate rangesThe driver or SDK is responsible for transformation. ModularIoT receives clean, canonical data.
Where Conversion Happens
Unit conversion and key mapping happen at the edge, not in ModularIoT:
| Responsibility | Where |
|---|---|
| Parse device protocol | Driver/SDK |
| Convert mph → km/h | Driver/SDK |
Map spd → vehicle.speed | Driver/SDK |
| Validate ranges | Driver/SDK + ModularIoT |
| Store and process | ModularIoT |
This design keeps ModularIoT simple and pushes complexity to where it belongs—close to the device.
Sparse Metrics
Send only what you have. Not all devices support all metrics.
A basic GPS tracker might send:
{
"metrics": [
{ "key": "position.latitude", "value": 37.7749 },
{ "key": "position.longitude", "value": -122.4194 },
{ "key": "vehicle.speed", "value": 65 }
]
}An OBD-II reader adds engine data:
{
"metrics": [
{ "key": "engine.rpm", "value": 2500 },
{ "key": "engine.coolant_temp", "value": 85 },
{ "key": "fuel.level", "value": 72 }
]
}Both are valid. ModularIoT accepts whatever canonical metrics are available.
In This Section
- MIOT Metrics Schema - The canonical JSON schema for metric payloads
- Canonical Keys - Complete registry of supported metric keys with mapping guidance
- Validation Rules - Range checks, timestamp rules, and error handling
Quick Reference
| Topic | Go Here |
|---|---|
| What metrics exist? | Reference > Metrics Registry |
| Schema specification | MIOT Metrics Schema |
| OBD-II PID mapping | Canonical Keys |
| Error codes | Reference > Error Codes |