From 7102b27c949b6a1bc4e95261d3a5ca82a54b799e Mon Sep 17 00:00:00 2001 From: Joel Takvorian Date: Wed, 10 May 2023 15:08:58 +0200 Subject: [PATCH] Use trace level for error logs in processing loop --- pkg/pipeline/ingest/ingest_grpc.go | 3 ++- pkg/pipeline/ingest/ingest_kafka.go | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pkg/pipeline/ingest/ingest_grpc.go b/pkg/pipeline/ingest/ingest_grpc.go index 15de43c11..2edaa88a0 100644 --- a/pkg/pipeline/ingest/ingest_grpc.go +++ b/pkg/pipeline/ingest/ingest_grpc.go @@ -105,7 +105,8 @@ func instrumentGRPC(m *metrics) grpc2.UnaryServerInterceptor { resp, err = handler(ctx, req) if err != nil { - glog.Errorf("Reporting metric error: %v", err) + // "trace" level used to minimize performance impact + glog.Tracef("Reporting metric error: %v", err) m.error(fmt.Sprint(status.Code(err))) } diff --git a/pkg/pipeline/ingest/ingest_kafka.go b/pkg/pipeline/ingest/ingest_kafka.go index 185048780..dc4a7ccfe 100644 --- a/pkg/pipeline/ingest/ingest_kafka.go +++ b/pkg/pipeline/ingest/ingest_kafka.go @@ -113,19 +113,21 @@ func (k *ingestKafka) isStopped() bool { } func (k *ingestKafka) processRecordDelay(record config.GenericMap) { - TimeFlowEndInterface, ok := record["TimeFlowEndMs"] + timeFlowEndInterface, ok := record["TimeFlowEndMs"] if !ok { - klog.Errorf("TimeFlowEndMs missing in record %v", record) + // "trace" level used to minimize performance impact + klog.Tracef("TimeFlowEndMs missing in record %v", record) k.metrics.error("TimeFlowEndMs missing") return } - TimeFlowEnd, ok := TimeFlowEndInterface.(int64) + timeFlowEnd, ok := timeFlowEndInterface.(int64) if !ok { - klog.Errorf("Cannot parse TimeFlowEndMs of record %v", record) + // "trace" level used to minimize performance impact + klog.Tracef("Cannot parse TimeFlowEndMs of record %v", record) k.metrics.error("Cannot parse TimeFlowEndMs") return } - delay := time.Since(time.UnixMilli(TimeFlowEnd)).Seconds() + delay := time.Since(time.UnixMilli(timeFlowEnd)).Seconds() k.metrics.latency.Observe(delay) }