From e91957af56b08f8ea7a567c2d6f2720cd462e6e7 Mon Sep 17 00:00:00 2001 From: Pagan Gazzard Date: Fri, 20 Dec 2024 18:02:45 +0000 Subject: [PATCH] Loki: reduce unnecessary recreation of structured metadata Change-type: patch --- src/features/device-logs/lib/backends/loki.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/device-logs/lib/backends/loki.ts b/src/features/device-logs/lib/backends/loki.ts index f4f9fa5a5..3f80d25c1 100644 --- a/src/features/device-logs/lib/backends/loki.ts +++ b/src/features/device-logs/lib/backends/loki.ts @@ -398,6 +398,7 @@ export class LokiBackend implements DeviceLogsBackend { ctx: LogContext, logs: Array, ) { + const structuredMetadata = this.getStructuredMetadata(ctx); return logs.map((log) => { this.validateLog(log); const timestamp = new loki.Timestamp(); @@ -408,7 +409,6 @@ export class LokiBackend implements DeviceLogsBackend { { ...log, version: VERSION }, omitNanoTimestamp, ); - const structuredMetadata = this.getStructuredMetadata(ctx); // create entry with labels, line and timestamp return new loki.EntryAdapter() .setLine(logJson)