From 1b4097d2c71c0fa1b8196eb02a0aafb7dd4e473f Mon Sep 17 00:00:00 2001 From: Vishal Sharma Date: Tue, 18 Jul 2023 10:22:22 +0530 Subject: [PATCH] fix: update usage collection to remove deprecated param (#158) * fix: update usage collection to remove deprecated param --- exporter/clickhousetracesexporter/writer.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/exporter/clickhousetracesexporter/writer.go b/exporter/clickhousetracesexporter/writer.go index ac386c5e..f8ea7e45 100644 --- a/exporter/clickhousetracesexporter/writer.go +++ b/exporter/clickhousetracesexporter/writer.go @@ -318,7 +318,7 @@ func (w *SpanWriter) writeTagBatch(batchSpans []*Span) error { ) if err != nil { logBatch := batchSpans[:int(math.Min(10, float64(len(batchSpans))))] - w.logger.Error("Could not write to span attributes table due to error: ", zap.Error(err),zap.Any("batch", logBatch)) + w.logger.Error("Could not write to span attributes table due to error: ", zap.Error(err), zap.Any("batch", logBatch)) return err } @@ -404,8 +404,10 @@ func (w *SpanWriter) writeModelBatch(batchSpans []*Span) error { metrics := map[string]usage.Metric{} for _, span := range batchSpans { var serialized []byte - + usageMap := span.TraceModel + usageMap.TagMap = map[string]string{} serialized, err = json.Marshal(span.TraceModel) + serializedUsage, err := json.Marshal(usageMap) if err != nil { return err @@ -417,7 +419,7 @@ func (w *SpanWriter) writeModelBatch(batchSpans []*Span) error { return err } - usage.AddMetric(metrics, *span.Tenant, 1, int64(len(serialized))) + usage.AddMetric(metrics, *span.Tenant, 1, int64(len(serializedUsage))) } start := time.Now()