将单独的信号流合并为一个 table,每个时间间隔的每个信号都有一个聚合值

Combine separate signal streams into one table with an aggregated value for each signal per time interval

我有一个 InfluxDB 分别从设备接收数据点,用于每次测量,即对于 GPS 位置,latitude/longitude/altitude 是三个不同的流,必须单独查询。这部分应用程序我无法更改。

现在我想在 Grafana 中创建一个简单的 table,显示每个时间戳的组合 GPS 数据集。我已经设法将所有这些信号合并为一个 table,但现在每个信号都是它自己的行:

我的查询如下所示:

SELECT 
  median(Latitude) as "Lat", 
  median(Longitude) as "Long", 
  median(Altitude) as "Alt", 
  median(TheSpeed) as "Speed" 
FROM
  (SELECT value as "Latitude" FROM "signal-1" WHERE $timeFilter  AND deviceId =~/$DeviceID/),
  (SELECT value as "Longitude" FROM "signal-2" WHERE $timeFilter  AND deviceId =~/$DeviceID/),
  (SELECT value as "Altitude" FROM "signal-5" WHERE $timeFilter  AND deviceId =~/$DeviceID/),
  (SELECT value as "TheSpeed" FROM "signal-4" WHERE $timeFilter  AND deviceId =~/$DeviceID/)
WHERE $timeFilter 
GROUP BY time(1s)

如何将四个单独的信号合并为一个 table 行?

谢谢你的帮助,我卡在这上面了。

我找到了解决方案:

像这样更改了查询:

SELECT 
median(value)
FROM
(SELECT value FROM "signal-1" WHERE $timeFilter  AND deviceId =~/$DeviceID/),
(SELECT value FROM "signal-2" WHERE $timeFilter  AND deviceId =~/$DeviceID/),
(SELECT value FROM "signal-5" WHERE $timeFilter  AND deviceId =~/$DeviceID/),
(SELECT value FROM "signal-4" WHERE $timeFilter  AND deviceId =~/$DeviceID/),
WHERE $timeFilter 
GROUP BY time($timegap), "description" 
FILL(previous)

并将 table 格式化为时间序列(而不是“Table”)并使用“描述字段”作为 ALIAS BY。

现在看起来正是我所需要的:

我有点惊讶没有人回答这个问题,回想起来这似乎是一个菜鸟问题。 :(