VictoriaMetrics als zusätzliche Datenbank-Option für Messwerte ergänzt (STORE/DBASE=victoria)
Dritte, zu mongo/influx exklusive Auswahl für die laufenden Messwerte. Schreibpfad nutzt das bestehende Influx-Line-Protocol unverändert (common/victoria_post.js); Lesepfad (sensorapi/databases/victoria.js + victoria2json.js) holt Rohdaten per VictoriaMetrics' /api/v1/export und bucketet/aggregiert stundenweise clientseitig, nach Mongo-Konvention (Stunden-Start als Label, kein Zeit-Shift nötig wie bei Influx). Scope bewusst auf die schon heute per DBASE umschaltbaren Funktionen begrenzt (getActData/getNoiseAVGData) - getAvgData/getLongAvg/getGeigerData bleiben wie bisher. Docker-Compose um victoriametrics-Service ergänzt (Retention explizit auf 100y gesetzt, da VictoriaMetrics sonst nach 1 Monat Daten löscht). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@ import {DateTime} from 'luxon'
|
||||
import { translate as trans } from '../routes/api.js'
|
||||
import * as influx from "../databases/influx.js"
|
||||
import * as mongo from "../databases/mongo.js"
|
||||
import * as victoria from "../databases/victoria.js"
|
||||
import { setoptionfromtable } from "../utilities/chartoptions.js"
|
||||
|
||||
export const getNoiseData = async (params, possibles, props) => {
|
||||
@@ -451,6 +452,9 @@ const getNoiseAVGData = async (opts) => {
|
||||
for (let x=0; x < ret.values.length; x++) {
|
||||
ret.values[x].datetime = DateTime.fromISO(ret.values[x].datetime).toUTC().minus({hours:1}).toFormat("yyyy-LL-dd'T'HH:mm:ss'Z'")
|
||||
}
|
||||
} else if (DBASE === 'victoria') {
|
||||
// victoria.js buckets by hour-start itself (like mongo), so no shift is needed here
|
||||
ret = await victoria.fetchNoiseAVGData(opts)
|
||||
} else {
|
||||
ret.err = 'DBASEUNKNOWN'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user