feat: use mountpoint label for NAS metrics display
CI/CD / build-and-push (push) Failing after 4s
Details
CI/CD / build-and-push (push) Failing after 4s
Details
This commit is contained in:
parent
cc5b715286
commit
cc8b58d5dd
|
|
@ -7,11 +7,11 @@ function parseValues(values: [number, string][]): DataPoint[] {
|
||||||
return values.map(([ts, val]) => ({ timestamp: ts, value: parseFloat(val) }));
|
return values.map(([ts, val]) => ({ timestamp: ts, value: parseFloat(val) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
function processResults(results: { metric: Record<string, string>; values: [number, string][] }[]) {
|
function processResults(results: { metric: Record<string, string>; values: [number, string][] }[], labelKey?: string) {
|
||||||
return results.map((r) => {
|
return results.map((r) => {
|
||||||
const dataPoints = parseValues(r.values);
|
const dataPoints = parseValues(r.values);
|
||||||
return {
|
return {
|
||||||
instance: r.metric.node || r.metric.instance || '',
|
instance: labelKey ? (r.metric[labelKey] || '') : (r.metric.node || r.metric.instance || ''),
|
||||||
metric: r.metric,
|
metric: r.metric,
|
||||||
dataPoints,
|
dataPoints,
|
||||||
stats: calculateStats(dataPoints),
|
stats: calculateStats(dataPoints),
|
||||||
|
|
@ -63,7 +63,7 @@ export async function GET(request: NextRequest) {
|
||||||
cpu: processResults(cpuData),
|
cpu: processResults(cpuData),
|
||||||
memory: processResults(memData),
|
memory: processResults(memData),
|
||||||
disk: processResults(diskData),
|
disk: processResults(diskData),
|
||||||
nas: processResults(nasData),
|
nas: processResults(nasData, 'mountpoint'),
|
||||||
ingress: {
|
ingress: {
|
||||||
receive: processResults(ingressRxData),
|
receive: processResults(ingressRxData),
|
||||||
transmit: processResults(ingressTxData),
|
transmit: processResults(ingressTxData),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue