Remove duplicate metrics from memorylimiter (#2841)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This commit is contained in:
parent
53832b5246
commit
a409f2a1da
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue