diff --git a/CHANGELOG.md b/CHANGELOG.md index ebfda3c7175..919da800a73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ## 🛑 Breaking changes 🛑 +- Remove legacy internal metrics for memorylimiter processor, `spans_dropped` and `trace_batches_dropped` (#2841) + - For `spans_dropped` use `processor/refused_spans` with `processor=memorylimiter` - Rename pdata.*.[Start|End]Time to pdata.*.[Start|End]Timestamp (#2847) - Rename pdata.DoubleExemplar to pdata.Exemplar (#2804) - Rename pdata.DoubleHistogram to pdata.Histogram (#2797) diff --git a/processor/batchprocessor/batch_processor.go b/processor/batchprocessor/batch_processor.go index 43045f263c1..6f146e66eef 100644 --- a/processor/batchprocessor/batch_processor.go +++ b/processor/batchprocessor/batch_processor.go @@ -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 @@ -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 { diff --git a/processor/batchprocessor/metrics.go b/processor/batchprocessor/metrics.go index 6852b334053..6dbeee02569 100644 --- a/processor/batchprocessor/metrics.go +++ b/processor/batchprocessor/metrics.go @@ -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) @@ -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(), diff --git a/processor/memorylimiter/memorylimiter.go b/processor/memorylimiter/memorylimiter.go index ae33b9c58ac..239fca29146 100644 --- a/processor/memorylimiter/memorylimiter.go +++ b/processor/memorylimiter/memorylimiter.go @@ -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" ) @@ -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 diff --git a/processor/metrics.go b/processor/metrics.go deleted file mode 100644 index 1615b73d9bb..00000000000 --- a/processor/metrics.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package processor - -import ( - "go.opencensus.io/stats" - "go.opencensus.io/stats/view" - "go.opencensus.io/tag" - - "go.opentelemetry.io/collector/obsreport" -) - -// Keys and stats for telemetry. -var ( - TagServiceNameKey, _ = tag.NewKey("service") - TagProcessorNameKey, _ = tag.NewKey(obsreport.ProcessorKey) - - StatDroppedSpanCount = stats.Int64( - "spans_dropped", - "counts the number of spans dropped", - stats.UnitDimensionless) - - StatTraceBatchesDroppedCount = stats.Int64( - "trace_batches_dropped", - "counts the number of trace batches dropped", - stats.UnitDimensionless) -) - -// MetricTagKeys returns the metric tag keys according to the given telemetry level. -func MetricTagKeys() []tag.Key { - return []tag.Key{ - TagProcessorNameKey, - TagServiceNameKey, - } -} - -// MetricViews return the metrics views according to given telemetry level. -func MetricViews() []*view.View { - tagKeys := MetricTagKeys() - droppedBatchesView := &view.View{ - Measure: StatTraceBatchesDroppedCount, - Description: "The number of span batches dropped.", - TagKeys: tagKeys, - Aggregation: view.Sum(), - } - droppedSpansView := &view.View{ - Name: StatDroppedSpanCount.Name(), - Measure: StatDroppedSpanCount, - Description: "The number of spans dropped.", - TagKeys: tagKeys, - Aggregation: view.Sum(), - } - - legacyViews := []*view.View{ - droppedBatchesView, - droppedSpansView, - } - - return obsreport.ProcessorMetricViews("", legacyViews) -} diff --git a/service/telemetry.go b/service/telemetry.go index d0bb65b2715..8ac6c91913b 100644 --- a/service/telemetry.go +++ b/service/telemetry.go @@ -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" @@ -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 {