Skip to content
This repository was archived by the owner on Nov 7, 2022. It is now read-only.

Commit a913fda

Browse files
author
Bogdan Drutu
authored
Remove unnecessary recording for number of batches received/dropped. (#421)
1 parent afdb3a1 commit a913fda

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

internal/collector/processor/processor.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (sp *debugSpanProcessor) ProcessSpans(batch *agenttracepb.ExportTraceServic
4646

4747
statsTags := StatsTagsForBatch("debug", ServiceNameForBatch(batch), spanFormat)
4848
numSpans := len(batch.Spans)
49-
stats.RecordWithTags(context.Background(), statsTags, StatReceivedBatchCount.M(1), StatReceivedSpanCount.M(int64(numSpans)))
49+
stats.RecordWithTags(context.Background(), statsTags, StatReceivedSpanCount.M(int64(numSpans)))
5050

5151
sp.logger.Debug("debugSpanProcessor", zap.String("originalFormat", spanFormat), zap.Int("#spans", numSpans))
5252
return 0, nil
@@ -63,9 +63,6 @@ var (
6363
TagServiceNameKey, _ = tag.NewKey("service")
6464
TagExporterNameKey, _ = tag.NewKey("exporter")
6565

66-
StatReceivedBatchCount = stats.Int64("batches_received", "counts the number of batches received", stats.UnitDimensionless)
67-
StatDroppedBatchCount = stats.Int64("batches_dropped", "counts the number of batches dropped", stats.UnitDimensionless)
68-
6966
StatReceivedSpanCount = stats.Int64("spans_received", "counts the number of spans received", stats.UnitDimensionless)
7067
StatDroppedSpanCount = stats.Int64("spans_dropped", "counts the number of spans dropped", stats.UnitDimensionless)
7168
)
@@ -99,15 +96,15 @@ func MetricViews(level telemetry.Level) []*view.View {
9996

10097
// There are some metrics enabled, return the views.
10198
receivedBatchesView := &view.View{
102-
Name: StatReceivedBatchCount.Name(),
103-
Measure: StatReceivedBatchCount,
99+
Name: "batches_received",
100+
Measure: StatReceivedSpanCount,
104101
Description: "The number of span batches received.",
105102
TagKeys: tagKeys,
106103
Aggregation: view.Count(),
107104
}
108105
droppedBatchesView := &view.View{
109-
Name: StatDroppedBatchCount.Name(),
110-
Measure: StatDroppedBatchCount,
106+
Name: "batches_dropped",
107+
Measure: StatDroppedSpanCount,
111108
Description: "The number of span batches dropped.",
112109
TagKeys: tagKeys,
113110
Aggregation: view.Count(),

internal/collector/processor/queued/queued_processor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (sp *queuedSpanProcessor) enqueueSpanBatch(batch *agenttracepb.ExportTraceS
128128

129129
statsTags := processor.StatsTagsForBatch(sp.name, processor.ServiceNameForBatch(batch), spanFormat)
130130
numSpans := len(batch.Spans)
131-
stats.RecordWithTags(context.Background(), statsTags, processor.StatReceivedBatchCount.M(1), processor.StatReceivedSpanCount.M(int64(numSpans)))
131+
stats.RecordWithTags(context.Background(), statsTags, processor.StatReceivedSpanCount.M(int64(numSpans)))
132132

133133
addedToQueue := sp.queue.Produce(item)
134134
if !addedToQueue {
@@ -192,7 +192,7 @@ func (sp *queuedSpanProcessor) processItemFromQueue(item *queueItem) {
192192

193193
func (sp *queuedSpanProcessor) onItemDropped(item *queueItem, statsTags []tag.Mutator) {
194194
numSpans := len(item.batch.Spans)
195-
stats.RecordWithTags(context.Background(), statsTags, processor.StatDroppedBatchCount.M(1), processor.StatDroppedSpanCount.M(int64(numSpans)))
195+
stats.RecordWithTags(context.Background(), statsTags, processor.StatDroppedSpanCount.M(int64(numSpans)))
196196

197197
sp.logger.Warn("Span batch dropped",
198198
zap.String("processor", sp.name),

0 commit comments

Comments
 (0)