Skip to content

Commit

Permalink
Remove duplicate metrics from memorylimiter
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu committed Mar 29, 2021
1 parent 38e5761 commit adaf8ae
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 85 deletions.
3 changes: 1 addition & 2 deletions processor/batchprocessor/batch_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"go.opentelemetry.io/collector/config/configtelemetry"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/consumer/pdata"
"go.opentelemetry.io/collector/processor"
)

// batch_processor is a component that accepts spans and metrics, places them
Expand Down Expand Up @@ -199,7 +198,7 @@ func (bp *batchProcessor) resetTimer() {

func (bp *batchProcessor) sendItems(measure *stats.Int64Measure) {
// Add that it came form the trace pipeline?
statsTags := []tag.Mutator{tag.Insert(processor.TagProcessorNameKey, bp.name)}
statsTags := []tag.Mutator{tag.Insert(processorTagKey, bp.name)}
_ = stats.RecordWithTags(context.Background(), statsTags, measure.M(1), statBatchSendSize.M(int64(bp.batch.itemCount())))

if bp.telemetryLevel == configtelemetry.LevelDetailed {
Expand Down
4 changes: 2 additions & 2 deletions processor/batchprocessor/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
"go.opencensus.io/tag"

"go.opentelemetry.io/collector/obsreport"
"go.opentelemetry.io/collector/processor"
)

var (
processorTagKey = tag.MustNewKey(obsreport.ProcessorKey)
statBatchSizeTriggerSend = stats.Int64("batch_size_trigger_send", "Number of times the batch was sent due to a size trigger", stats.UnitDimensionless)
statTimeoutTriggerSend = stats.Int64("timeout_trigger_send", "Number of times the batch was sent due to a timeout trigger", stats.UnitDimensionless)
statBatchSendSize = stats.Int64("batch_send_size", "Number of units in the batch", stats.UnitDimensionless)
Expand All @@ -32,7 +32,7 @@ var (

// MetricViews returns the metrics views related to batching
func MetricViews() []*view.View {
processorTagKeys := []tag.Key{processor.TagProcessorNameKey}
processorTagKeys := []tag.Key{processorTagKey}

countBatchSizeTriggerSendView := &view.View{
Name: statBatchSizeTriggerSend.Name(),
Expand Down
7 changes: 0 additions & 7 deletions processor/memorylimiter/memorylimiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ import (
"sync/atomic"
"time"

"go.opencensus.io/stats"
"go.uber.org/zap"

"go.opentelemetry.io/collector/config/configtelemetry"
"go.opentelemetry.io/collector/consumer/pdata"
"go.opentelemetry.io/collector/obsreport"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/collector/processor/memorylimiter/internal/iruntime"
)

Expand Down Expand Up @@ -155,11 +153,6 @@ func (ml *memoryLimiter) shutdown(context.Context) error {
func (ml *memoryLimiter) ProcessTraces(ctx context.Context, td pdata.Traces) (pdata.Traces, error) {
numSpans := td.SpanCount()
if ml.forcingDrop() {
stats.Record(
ctx,
processor.StatDroppedSpanCount.M(int64(numSpans)),
processor.StatTraceBatchesDroppedCount.M(1))

// TODO: actually to be 100% sure that this is "refused" and not "dropped"
// it is necessary to check the pipeline to see if this is directly connected
// to a receiver (ie.: a receiver is on the call stack). For now it
Expand Down
72 changes: 0 additions & 72 deletions processor/metrics.go

This file was deleted.

2 changes: 0 additions & 2 deletions service/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"go.opentelemetry.io/collector/exporter/jaegerexporter"
"go.opentelemetry.io/collector/internal/collector/telemetry"
"go.opentelemetry.io/collector/obsreport"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/collector/processor/batchprocessor"
"go.opentelemetry.io/collector/receiver/kafkareceiver"
telemetry2 "go.opentelemetry.io/collector/service/internal/telemetry"
Expand Down Expand Up @@ -67,7 +66,6 @@ func (tel *appTelemetry) init(asyncErrorChannel chan<- error, ballastSizeBytes u
views = append(views, kafkareceiver.MetricViews()...)
views = append(views, obsreport.Configure(level)...)
views = append(views, processMetricsViews.Views()...)
views = append(views, processor.MetricViews()...)

tel.views = views
if err = view.Register(views...); err != nil {
Expand Down

0 comments on commit adaf8ae

Please sign in to comment.