Skip to content

Commit

Permalink
fix: update usage collection to remove deprecated param (#158)
Browse files Browse the repository at this point in the history
* fix: update usage collection to remove deprecated param
  • Loading branch information
makeavish committed Jul 18, 2023
1 parent 8d74730 commit 1b4097d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions exporter/clickhousetracesexporter/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand All @@ -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()

Expand Down

0 comments on commit 1b4097d

Please sign in to comment.