The two plugins expose different query editors because their underlying query languages are different. Both editors share the same template-variable interpolation and time-range macro contracts, so a dashboard that mixes panels backed by both plugins behaves consistently as the operator changes variables or pans the time range.
The oninit-json-datasource editor mirrors the MongoDB® find-document shape. A query is built from up to five fields:
| Field | Example | Description |
|---|---|---|
| Collection | orders | Target collection name. Resolves against the database configured on the data source unless qualified. |
| Filter | { "status": "open", "ts": { "$gte": { "$date": "$__from" } } } | JSON document selecting matching rows. Supports the standard MongoDB comparison and logical operators. |
| Projection | { "ts": 1, "amount": 1 } | JSON document selecting which fields to return. Omit for all fields. |
| Sort | { "ts": 1 } | JSON document ordering the result. Required for time-series panels to render correctly. |
| Limit | 10000 | Maximum number of documents to return. The default ceiling is 10000; raise per data source if the listener and panel both tolerate it. |
The $date tag inside a filter signals a timestamp value — the plugin coerces the wrapped value into the Grafana time-series time field automatically. The Grafana time-range macros ($__from, $__to) are interpolated to millisecond-since-epoch values before the JSON document is parsed, so the listener sees a normal numeric value.
The oninit-wire-datasource editor exposes a single SQL text area. The query is interpolated, then issued verbatim against the wire listener — the plugin does not rewrite the query. What the operator types is what the listener executes. For a time-series panel the first column of the result must be a timestamp (or coercible to one); subsequent numeric columns become metric series. For a table panel the column order is preserved verbatim.
SELECT
DATE(ts) AS time,
SUM(amount) AS total_amount,
COUNT(*) AS order_count
FROM orders
WHERE ts BETWEEN $__timeFrom() AND $__timeTo()
AND region = '$region'
GROUP BY DATE(ts)
ORDER BY DATE(ts);
Informix exposes its TimeSeries data through a set of SQL routines (Calendar, GetRange, Apply, Hits, Recombine, …) that operate directly on a TimeSeries column. Because these are SQL routines, they ride the same wire-datasource editor as relational SQL:
SELECT
sensor_id,
Apply('SUM($value)/24', 'cal_hourly', GetRange(readings,
$__timeFrom()::DATETIME YEAR TO FRACTION(3),
$__timeTo()::DATETIME YEAR TO FRACTION(3)))::LVARCHAR
AS daily_avg
FROM sensors
WHERE sensor_id = '$sensor';
The same TimeSeries data is also reachable through Informix's Virtual Table (VT) interface, which presents a TimeSeries column as a relational view of one row per timestamp. The DBA defines the VT once via EXECUTE PROCEDURE TSCreateVirtualTab(…); panels then SELECT from it like any other table:
SELECT tstamp AS time, value FROM v_sensor_readings WHERE sensor_id = '$sensor' AND tstamp BETWEEN $__timeFrom() AND $__timeTo() ORDER BY tstamp;
Both surfaces — routine calls and the VT — are SQL, so the choice between them is per-query ergonomic preference, not a plugin choice.
Both plugins interpolate Grafana template variables before the query is issued. The standard variable forms ($var, ${var}, [[var]]) are recognised; format selectors (${var:csv}, ${var:pipe}, ${var:singlequote}) control how multi-value variables expand. For wire SQL, prefer ${var:singlequote} when the variable lands inside a string literal; for JSON filters the value is JSON-quoted by the plugin already, so no format selector is needed in the common case.
The Grafana panel time range is exposed to both plugins as named macros that interpolate to the appropriate native form:
| Macro | JSON expansion | SQL expansion |
|---|---|---|
| $__from | milliseconds since epoch (number) | milliseconds since epoch (number) |
| $__to | milliseconds since epoch (number) | milliseconds since epoch (number) |
| $__timeFrom() | n/a | DATETIME literal in the connection's locale |
| $__timeTo() | n/a | DATETIME literal in the connection's locale |
| $__interval | panel-suggested bucket width (number, ms) | panel-suggested bucket width (number, ms) |
The $__timeFrom() / $__timeTo() SQL forms produce an Informix-native DATETIME YEAR TO FRACTION(3) literal suitable for direct comparison against an Informix DATETIME column without further casting.
To discuss how Oninit ® can assist please call on +1-913-732-8892 or alternatively just send an email specifying your requirements.
You get all this for free.. think about what you get if you pay us