Remove obsreportconfig package, reduce dependencies (#11148)
Small issue that the `SpanNameSep` is duplicated, but is a very small duplicate. Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This commit is contained in:
parent
eb0a4b6388
commit
1245955ccf
|
|
@ -78,12 +78,8 @@ replace go.opentelemetry.io/collector/receiver => ../../receiver
|
|||
|
||||
replace go.opentelemetry.io/collector/semconv => ../../semconv
|
||||
|
||||
replace go.opentelemetry.io/collector/featuregate => ../../featuregate
|
||||
|
||||
replace go.opentelemetry.io/collector/consumer => ../../consumer
|
||||
|
||||
replace go.opentelemetry.io/collector => ../..
|
||||
|
||||
replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry
|
||||
|
||||
retract (
|
||||
|
|
@ -98,6 +94,4 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume
|
|||
|
||||
replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest
|
||||
|
||||
replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus
|
||||
|
||||
replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receiver/receiverprofiles
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ require (
|
|||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common v0.59.1 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
go.opentelemetry.io/collector v0.109.0 // indirect
|
||||
go.opentelemetry.io/collector/config/configretry v1.15.0 // indirect
|
||||
go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect
|
||||
go.opentelemetry.io/collector/consumer/consumertest v0.109.0 // indirect
|
||||
|
|
@ -66,8 +65,6 @@ require (
|
|||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
replace go.opentelemetry.io/collector => ../../
|
||||
|
||||
replace go.opentelemetry.io/collector/component => ../../component
|
||||
|
||||
replace go.opentelemetry.io/collector/confmap => ../../confmap
|
||||
|
|
@ -76,8 +73,6 @@ replace go.opentelemetry.io/collector/consumer => ../../consumer
|
|||
|
||||
replace go.opentelemetry.io/collector/exporter => ../
|
||||
|
||||
replace go.opentelemetry.io/collector/featuregate => ../../featuregate
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata => ../../pdata
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
|
||||
|
|
@ -98,8 +93,6 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume
|
|||
|
||||
replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest
|
||||
|
||||
replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus
|
||||
|
||||
replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receiver/receiverprofiles
|
||||
|
||||
replace go.opentelemetry.io/collector/exporter/exporterprofiles => ../exporterprofiles
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJ
|
|||
github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0=
|
||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package obsmetrics // import "go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
package internal // import "go.opentelemetry.io/collector/exporter/exporterhelper/internal"
|
||||
|
||||
const (
|
||||
// spanNameSep is duplicate between receiver and exporter.
|
||||
spanNameSep = "/"
|
||||
|
||||
// ExporterKey used to identify exporters in metrics and traces.
|
||||
ExporterKey = "exporter"
|
||||
|
||||
|
|
@ -24,12 +27,9 @@ const (
|
|||
SentLogRecordsKey = "sent_log_records"
|
||||
// FailedToSendLogRecordsKey used to track logs that failed to be sent by exporters.
|
||||
FailedToSendLogRecordsKey = "send_failed_log_records"
|
||||
)
|
||||
|
||||
var (
|
||||
ExporterPrefix = ExporterKey + SpanNameSep
|
||||
ExporterMetricPrefix = ExporterKey + MetricNameSep
|
||||
ExportTraceDataOperationSuffix = SpanNameSep + "traces"
|
||||
ExportMetricsOperationSuffix = SpanNameSep + "metrics"
|
||||
ExportLogsOperationSuffix = SpanNameSep + "logs"
|
||||
ExporterPrefix = ExporterKey + spanNameSep
|
||||
ExportTraceDataOperationSuffix = spanNameSep + "traces"
|
||||
ExportMetricsOperationSuffix = spanNameSep + "metrics"
|
||||
ExportLogsOperationSuffix = spanNameSep + "logs"
|
||||
)
|
||||
|
|
@ -25,9 +25,9 @@ import (
|
|||
"go.opentelemetry.io/collector/consumer/consumererror"
|
||||
"go.opentelemetry.io/collector/consumer/consumertest"
|
||||
"go.opentelemetry.io/collector/exporter"
|
||||
"go.opentelemetry.io/collector/exporter/exporterhelper/internal"
|
||||
"go.opentelemetry.io/collector/exporter/exportertest"
|
||||
"go.opentelemetry.io/collector/exporter/internal/queue"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
"go.opentelemetry.io/collector/pdata/plog"
|
||||
"go.opentelemetry.io/collector/pdata/testdata"
|
||||
)
|
||||
|
|
@ -432,7 +432,7 @@ func checkWrapSpanForLogsExporter(t *testing.T, sr *tracetest.SpanRecorder, trac
|
|||
sentLogRecords = 0
|
||||
failedToSendLogRecords = numLogRecords
|
||||
}
|
||||
require.Containsf(t, sd.Attributes(), attribute.KeyValue{Key: obsmetrics.SentLogRecordsKey, Value: attribute.Int64Value(sentLogRecords)}, "SpanData %v", sd)
|
||||
require.Containsf(t, sd.Attributes(), attribute.KeyValue{Key: obsmetrics.FailedToSendLogRecordsKey, Value: attribute.Int64Value(failedToSendLogRecords)}, "SpanData %v", sd)
|
||||
require.Containsf(t, sd.Attributes(), attribute.KeyValue{Key: internal.SentLogRecordsKey, Value: attribute.Int64Value(sentLogRecords)}, "SpanData %v", sd)
|
||||
require.Containsf(t, sd.Attributes(), attribute.KeyValue{Key: internal.FailedToSendLogRecordsKey, Value: attribute.Int64Value(failedToSendLogRecords)}, "SpanData %v", sd)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ import (
|
|||
"go.opentelemetry.io/collector/consumer/consumererror"
|
||||
"go.opentelemetry.io/collector/consumer/consumertest"
|
||||
"go.opentelemetry.io/collector/exporter"
|
||||
"go.opentelemetry.io/collector/exporter/exporterhelper/internal"
|
||||
"go.opentelemetry.io/collector/exporter/exportertest"
|
||||
"go.opentelemetry.io/collector/exporter/internal/queue"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
"go.opentelemetry.io/collector/pdata/pmetric"
|
||||
"go.opentelemetry.io/collector/pdata/testdata"
|
||||
)
|
||||
|
|
@ -438,7 +438,7 @@ func checkWrapSpanForMetricsExporter(t *testing.T, sr *tracetest.SpanRecorder, t
|
|||
sentMetricPoints = 0
|
||||
failedToSendMetricPoints = numMetricPoints
|
||||
}
|
||||
require.Containsf(t, sd.Attributes(), attribute.KeyValue{Key: obsmetrics.SentMetricPointsKey, Value: attribute.Int64Value(sentMetricPoints)}, "SpanData %v", sd)
|
||||
require.Containsf(t, sd.Attributes(), attribute.KeyValue{Key: obsmetrics.FailedToSendMetricPointsKey, Value: attribute.Int64Value(failedToSendMetricPoints)}, "SpanData %v", sd)
|
||||
require.Containsf(t, sd.Attributes(), attribute.KeyValue{Key: internal.SentMetricPointsKey, Value: attribute.Int64Value(sentMetricPoints)}, "SpanData %v", sd)
|
||||
require.Containsf(t, sd.Attributes(), attribute.KeyValue{Key: internal.FailedToSendMetricPointsKey, Value: attribute.Int64Value(failedToSendMetricPoints)}, "SpanData %v", sd)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ import (
|
|||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/exporter"
|
||||
"go.opentelemetry.io/collector/exporter/exporterhelper/internal"
|
||||
"go.opentelemetry.io/collector/exporter/exporterhelper/internal/metadata"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
)
|
||||
|
||||
// obsReport is a helper to add observability to an exporter.
|
||||
|
|
@ -41,11 +41,11 @@ func newExporter(cfg obsReportSettings) (*obsReport, error) {
|
|||
}
|
||||
|
||||
return &obsReport{
|
||||
spanNamePrefix: obsmetrics.ExporterPrefix + cfg.exporterID.String(),
|
||||
spanNamePrefix: internal.ExporterPrefix + cfg.exporterID.String(),
|
||||
tracer: cfg.exporterCreateSettings.TracerProvider.Tracer(cfg.exporterID.String()),
|
||||
dataType: cfg.dataType,
|
||||
otelAttrs: []attribute.KeyValue{
|
||||
attribute.String(obsmetrics.ExporterKey, cfg.exporterID.String()),
|
||||
attribute.String(internal.ExporterKey, cfg.exporterID.String()),
|
||||
},
|
||||
telemetryBuilder: telemetryBuilder,
|
||||
}, nil
|
||||
|
|
@ -55,21 +55,21 @@ func newExporter(cfg obsReportSettings) (*obsReport, error) {
|
|||
// The returned context should be used in other calls to the Exporter functions
|
||||
// dealing with the same export operation.
|
||||
func (or *obsReport) startTracesOp(ctx context.Context) context.Context {
|
||||
return or.startOp(ctx, obsmetrics.ExportTraceDataOperationSuffix)
|
||||
return or.startOp(ctx, internal.ExportTraceDataOperationSuffix)
|
||||
}
|
||||
|
||||
// endTracesOp completes the export operation that was started with startTracesOp.
|
||||
func (or *obsReport) endTracesOp(ctx context.Context, numSpans int, err error) {
|
||||
numSent, numFailedToSend := toNumItems(numSpans, err)
|
||||
or.recordMetrics(context.WithoutCancel(ctx), component.DataTypeTraces, numSent, numFailedToSend)
|
||||
endSpan(ctx, err, numSent, numFailedToSend, obsmetrics.SentSpansKey, obsmetrics.FailedToSendSpansKey)
|
||||
endSpan(ctx, err, numSent, numFailedToSend, internal.SentSpansKey, internal.FailedToSendSpansKey)
|
||||
}
|
||||
|
||||
// startMetricsOp is called at the start of an Export operation.
|
||||
// The returned context should be used in other calls to the Exporter functions
|
||||
// dealing with the same export operation.
|
||||
func (or *obsReport) startMetricsOp(ctx context.Context) context.Context {
|
||||
return or.startOp(ctx, obsmetrics.ExportMetricsOperationSuffix)
|
||||
return or.startOp(ctx, internal.ExportMetricsOperationSuffix)
|
||||
}
|
||||
|
||||
// endMetricsOp completes the export operation that was started with
|
||||
|
|
@ -79,21 +79,21 @@ func (or *obsReport) startMetricsOp(ctx context.Context) context.Context {
|
|||
func (or *obsReport) endMetricsOp(ctx context.Context, numMetricPoints int, err error) {
|
||||
numSent, numFailedToSend := toNumItems(numMetricPoints, err)
|
||||
or.recordMetrics(context.WithoutCancel(ctx), component.DataTypeMetrics, numSent, numFailedToSend)
|
||||
endSpan(ctx, err, numSent, numFailedToSend, obsmetrics.SentMetricPointsKey, obsmetrics.FailedToSendMetricPointsKey)
|
||||
endSpan(ctx, err, numSent, numFailedToSend, internal.SentMetricPointsKey, internal.FailedToSendMetricPointsKey)
|
||||
}
|
||||
|
||||
// startLogsOp is called at the start of an Export operation.
|
||||
// The returned context should be used in other calls to the Exporter functions
|
||||
// dealing with the same export operation.
|
||||
func (or *obsReport) startLogsOp(ctx context.Context) context.Context {
|
||||
return or.startOp(ctx, obsmetrics.ExportLogsOperationSuffix)
|
||||
return or.startOp(ctx, internal.ExportLogsOperationSuffix)
|
||||
}
|
||||
|
||||
// endLogsOp completes the export operation that was started with startLogsOp.
|
||||
func (or *obsReport) endLogsOp(ctx context.Context, numLogRecords int, err error) {
|
||||
numSent, numFailedToSend := toNumItems(numLogRecords, err)
|
||||
or.recordMetrics(context.WithoutCancel(ctx), component.DataTypeLogs, numSent, numFailedToSend)
|
||||
endSpan(ctx, err, numSent, numFailedToSend, obsmetrics.SentLogRecordsKey, obsmetrics.FailedToSendLogRecordsKey)
|
||||
endSpan(ctx, err, numSent, numFailedToSend, internal.SentLogRecordsKey, internal.FailedToSendLogRecordsKey)
|
||||
}
|
||||
|
||||
// startOp creates the span used to trace the operation. Returning
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import (
|
|||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/component/componenttest"
|
||||
"go.opentelemetry.io/collector/exporter"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
"go.opentelemetry.io/collector/exporter/exporterhelper/internal"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -55,13 +55,13 @@ func TestExportTraceDataOp(t *testing.T) {
|
|||
switch {
|
||||
case params[i].err == nil:
|
||||
sentSpans += params[i].items
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.SentSpansKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.FailedToSendSpansKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.SentSpansKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.FailedToSendSpansKey, Value: attribute.Int64Value(0)})
|
||||
assert.Equal(t, codes.Unset, span.Status().Code)
|
||||
case errors.Is(params[i].err, errFake):
|
||||
failedToSendSpans += params[i].items
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.SentSpansKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.FailedToSendSpansKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.SentSpansKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.FailedToSendSpansKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
assert.Equal(t, codes.Error, span.Status().Code)
|
||||
assert.Equal(t, params[i].err.Error(), span.Status().Description)
|
||||
default:
|
||||
|
|
@ -104,13 +104,13 @@ func TestExportMetricsOp(t *testing.T) {
|
|||
switch {
|
||||
case params[i].err == nil:
|
||||
sentMetricPoints += params[i].items
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.SentMetricPointsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.FailedToSendMetricPointsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.SentMetricPointsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.FailedToSendMetricPointsKey, Value: attribute.Int64Value(0)})
|
||||
assert.Equal(t, codes.Unset, span.Status().Code)
|
||||
case errors.Is(params[i].err, errFake):
|
||||
failedToSendMetricPoints += params[i].items
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.SentMetricPointsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.FailedToSendMetricPointsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.SentMetricPointsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.FailedToSendMetricPointsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
assert.Equal(t, codes.Error, span.Status().Code)
|
||||
assert.Equal(t, params[i].err.Error(), span.Status().Description)
|
||||
default:
|
||||
|
|
@ -153,13 +153,13 @@ func TestExportLogsOp(t *testing.T) {
|
|||
switch {
|
||||
case params[i].err == nil:
|
||||
sentLogRecords += params[i].items
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.SentLogRecordsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.FailedToSendLogRecordsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.SentLogRecordsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.FailedToSendLogRecordsKey, Value: attribute.Int64Value(0)})
|
||||
assert.Equal(t, codes.Unset, span.Status().Code)
|
||||
case errors.Is(params[i].err, errFake):
|
||||
failedToSendLogRecords += params[i].items
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.SentLogRecordsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.FailedToSendLogRecordsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.SentLogRecordsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.FailedToSendLogRecordsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
assert.Equal(t, codes.Error, span.Status().Code)
|
||||
assert.Equal(t, params[i].err.Error(), span.Status().Description)
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ import (
|
|||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/exporter"
|
||||
"go.opentelemetry.io/collector/exporter/exporterhelper/internal"
|
||||
"go.opentelemetry.io/collector/exporter/exporterqueue"
|
||||
"go.opentelemetry.io/collector/exporter/internal/queue"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
)
|
||||
|
||||
const defaultQueueSize = 1000
|
||||
|
|
@ -90,7 +90,7 @@ func newQueueSender(q exporterqueue.Queue[Request], set exporter.Settings, numCo
|
|||
qs := &queueSender{
|
||||
queue: q,
|
||||
numConsumers: numConsumers,
|
||||
traceAttribute: attribute.String(obsmetrics.ExporterKey, set.ID.String()),
|
||||
traceAttribute: attribute.String(internal.ExporterKey, set.ID.String()),
|
||||
obsrep: obsrep,
|
||||
exporterID: set.ID,
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ func (qs *queueSender) Start(ctx context.Context, host component.Host) error {
|
|||
return err
|
||||
}
|
||||
|
||||
dataTypeAttr := attribute.String(obsmetrics.DataTypeKey, qs.obsrep.dataType.String())
|
||||
dataTypeAttr := attribute.String(internal.DataTypeKey, qs.obsrep.dataType.String())
|
||||
return multierr.Append(
|
||||
qs.obsrep.telemetryBuilder.InitExporterQueueSize(func() int64 { return int64(qs.queue.Size()) },
|
||||
metric.WithAttributeSet(attribute.NewSet(qs.traceAttribute, dataTypeAttr))),
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ import (
|
|||
"go.opentelemetry.io/collector/component/componenttest"
|
||||
"go.opentelemetry.io/collector/config/configretry"
|
||||
"go.opentelemetry.io/collector/exporter"
|
||||
"go.opentelemetry.io/collector/exporter/exporterhelper/internal"
|
||||
"go.opentelemetry.io/collector/exporter/exporterqueue"
|
||||
"go.opentelemetry.io/collector/exporter/exportertest"
|
||||
"go.opentelemetry.io/collector/exporter/internal/queue"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
)
|
||||
|
||||
func TestQueuedRetry_StopWhileWaiting(t *testing.T) {
|
||||
|
|
@ -226,7 +226,7 @@ func TestQueuedRetry_QueueMetricsReported(t *testing.T) {
|
|||
require.NoError(t, be.send(context.Background(), newErrorRequest()))
|
||||
}
|
||||
require.NoError(t, tt.CheckExporterMetricGauge("otelcol_exporter_queue_size", int64(7),
|
||||
attribute.String(obsmetrics.DataTypeKey, dataType.String())))
|
||||
attribute.String(internal.DataTypeKey, dataType.String())))
|
||||
|
||||
assert.NoError(t, be.Shutdown(context.Background()))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ import (
|
|||
"go.opentelemetry.io/collector/config/configretry"
|
||||
"go.opentelemetry.io/collector/consumer/consumererror"
|
||||
"go.opentelemetry.io/collector/exporter"
|
||||
"go.opentelemetry.io/collector/exporter/exporterhelper/internal"
|
||||
"go.opentelemetry.io/collector/exporter/internal/experr"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
)
|
||||
|
||||
// TODO: Clean this by forcing all exporters to return an internal error type that always include the information about retries.
|
||||
|
|
@ -53,7 +53,7 @@ type retrySender struct {
|
|||
|
||||
func newRetrySender(config configretry.BackOffConfig, set exporter.Settings) *retrySender {
|
||||
return &retrySender{
|
||||
traceAttribute: attribute.String(obsmetrics.ExporterKey, set.ID.String()),
|
||||
traceAttribute: attribute.String(internal.ExporterKey, set.ID.String()),
|
||||
cfg: config,
|
||||
stopCh: make(chan struct{}),
|
||||
logger: set.Logger,
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ import (
|
|||
"go.opentelemetry.io/collector/consumer/consumererror"
|
||||
"go.opentelemetry.io/collector/consumer/consumertest"
|
||||
"go.opentelemetry.io/collector/exporter"
|
||||
"go.opentelemetry.io/collector/exporter/exporterhelper/internal"
|
||||
"go.opentelemetry.io/collector/exporter/exportertest"
|
||||
"go.opentelemetry.io/collector/exporter/internal/queue"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
"go.opentelemetry.io/collector/pdata/ptrace"
|
||||
"go.opentelemetry.io/collector/pdata/testdata"
|
||||
)
|
||||
|
|
@ -441,7 +441,7 @@ func checkWrapSpanForTracesExporter(t *testing.T, sr *tracetest.SpanRecorder, tr
|
|||
sentSpans = 0
|
||||
failedToSendSpans = numSpans
|
||||
}
|
||||
require.Containsf(t, sd.Attributes(), attribute.KeyValue{Key: obsmetrics.SentSpansKey, Value: attribute.Int64Value(sentSpans)}, "SpanData %v", sd)
|
||||
require.Containsf(t, sd.Attributes(), attribute.KeyValue{Key: obsmetrics.FailedToSendSpansKey, Value: attribute.Int64Value(failedToSendSpans)}, "SpanData %v", sd)
|
||||
require.Containsf(t, sd.Attributes(), attribute.KeyValue{Key: internal.SentSpansKey, Value: attribute.Int64Value(sentSpans)}, "SpanData %v", sd)
|
||||
require.Containsf(t, sd.Attributes(), attribute.KeyValue{Key: internal.FailedToSendSpansKey, Value: attribute.Int64Value(failedToSendSpans)}, "SpanData %v", sd)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@ replace go.opentelemetry.io/collector/extension => ../../extension
|
|||
|
||||
replace go.opentelemetry.io/collector/extension/experimental/storage => ../../extension/experimental/storage
|
||||
|
||||
replace go.opentelemetry.io/collector => ../..
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
|
||||
|
||||
replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry
|
||||
|
|
@ -51,10 +49,6 @@ replace go.opentelemetry.io/collector/config/configretry => ../../config/configr
|
|||
|
||||
replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
|
||||
|
||||
replace go.opentelemetry.io/collector/featuregate => ../../featuregate
|
||||
|
||||
replace go.opentelemetry.io/collector/confmap => ../../confmap
|
||||
|
||||
replace go.opentelemetry.io/collector/component => ../../component
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata => ../../pdata
|
||||
|
|
@ -67,6 +61,4 @@ replace go.opentelemetry.io/collector/consumer => ../../consumer
|
|||
|
||||
replace go.opentelemetry.io/collector/exporter => ../
|
||||
|
||||
replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus
|
||||
|
||||
replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receiver/receiverprofiles
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ require (
|
|||
github.com/cenkalti/backoff/v4 v4.3.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/stretchr/testify v1.9.0
|
||||
go.opentelemetry.io/collector v0.109.0
|
||||
go.opentelemetry.io/collector/component v0.109.0
|
||||
go.opentelemetry.io/collector/config/configretry v1.15.0
|
||||
go.opentelemetry.io/collector/config/configtelemetry v0.109.0
|
||||
|
|
@ -58,20 +57,14 @@ require (
|
|||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
replace go.opentelemetry.io/collector => ../
|
||||
|
||||
replace go.opentelemetry.io/collector/component => ../component
|
||||
|
||||
replace go.opentelemetry.io/collector/confmap => ../confmap
|
||||
|
||||
replace go.opentelemetry.io/collector/consumer => ../consumer
|
||||
|
||||
replace go.opentelemetry.io/collector/extension => ../extension
|
||||
|
||||
replace go.opentelemetry.io/collector/extension/experimental/storage => ../extension/experimental/storage
|
||||
|
||||
replace go.opentelemetry.io/collector/featuregate => ../featuregate
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata => ../pdata
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata
|
||||
|
|
@ -90,8 +83,6 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../consumer/c
|
|||
|
||||
replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consumertest
|
||||
|
||||
replace go.opentelemetry.io/collector/component/componentstatus => ../component/componentstatus
|
||||
|
||||
replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../receiver/receiverprofiles
|
||||
|
||||
replace go.opentelemetry.io/collector/exporter/exporterprofiles => ./exporterprofiles
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJ
|
|||
github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0=
|
||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ require (
|
|||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common v0.59.1 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
go.opentelemetry.io/collector v0.109.0 // indirect
|
||||
go.opentelemetry.io/collector/config/configretry v1.15.0 // indirect
|
||||
go.opentelemetry.io/collector/consumer v0.109.0 // indirect
|
||||
go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect
|
||||
|
|
@ -66,8 +65,6 @@ require (
|
|||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
replace go.opentelemetry.io/collector => ../../
|
||||
|
||||
replace go.opentelemetry.io/collector/component => ../../component
|
||||
|
||||
replace go.opentelemetry.io/collector/confmap => ../../confmap
|
||||
|
|
@ -80,8 +77,6 @@ replace go.opentelemetry.io/collector/extension => ../../extension
|
|||
|
||||
replace go.opentelemetry.io/collector/extension/experimental/storage => ../../extension/experimental/storage
|
||||
|
||||
replace go.opentelemetry.io/collector/featuregate => ../../featuregate
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata => ../../pdata
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
|
||||
|
|
@ -103,8 +98,6 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume
|
|||
|
||||
replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest
|
||||
|
||||
replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus
|
||||
|
||||
replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receiver/receiverprofiles
|
||||
|
||||
replace go.opentelemetry.io/collector/exporter/exporterprofiles => ../exporterprofiles
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJ
|
|||
github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0=
|
||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
|
|
|
|||
|
|
@ -74,10 +74,6 @@ replace go.opentelemetry.io/collector/config/configretry => ../../config/configr
|
|||
|
||||
replace go.opentelemetry.io/collector/receiver => ../../receiver
|
||||
|
||||
replace go.opentelemetry.io/collector => ../..
|
||||
|
||||
replace go.opentelemetry.io/collector/featuregate => ../../featuregate
|
||||
|
||||
replace go.opentelemetry.io/collector/confmap => ../../confmap
|
||||
|
||||
replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry
|
||||
|
|
@ -92,8 +88,6 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume
|
|||
|
||||
replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest
|
||||
|
||||
replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus
|
||||
|
||||
replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receiver/receiverprofiles
|
||||
|
||||
replace go.opentelemetry.io/collector/exporter/exporterprofiles => ../exporterprofiles
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package obsmetrics // import "go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
|
||||
const (
|
||||
// ProcessorKey is the key used to identify processors in metrics and traces.
|
||||
ProcessorKey = "processor"
|
||||
|
||||
// DroppedSpansKey is the key used to identify spans dropped by the Collector.
|
||||
DroppedSpansKey = "dropped_spans"
|
||||
|
||||
// DroppedMetricPointsKey is the key used to identify metric points dropped by the Collector.
|
||||
DroppedMetricPointsKey = "dropped_metric_points"
|
||||
|
||||
// DroppedLogRecordsKey is the key used to identify log records dropped by the Collector.
|
||||
DroppedLogRecordsKey = "dropped_log_records"
|
||||
)
|
||||
|
||||
var (
|
||||
ProcessorMetricPrefix = ProcessorKey + MetricNameSep
|
||||
)
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package obsmetrics // import "go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
|
||||
const (
|
||||
// ScraperKey used to identify scrapers in metrics and traces.
|
||||
ScraperKey = "scraper"
|
||||
|
||||
// ScrapedMetricPointsKey used to identify metric points scraped by the
|
||||
// Collector.
|
||||
ScrapedMetricPointsKey = "scraped_metric_points"
|
||||
// ErroredMetricPointsKey used to identify metric points errored (i.e.
|
||||
// unable to be scraped) by the Collector.
|
||||
ErroredMetricPointsKey = "errored_metric_points"
|
||||
)
|
||||
|
||||
const (
|
||||
ScraperPrefix = ScraperKey + SpanNameSep
|
||||
ScraperMetricPrefix = ScraperKey + MetricNameSep
|
||||
ScraperMetricsOperationSuffix = SpanNameSep + "MetricsScraped"
|
||||
)
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package obsmetrics defines the obsreport metrics for each components
|
||||
package obsmetrics // import "go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
|
||||
const (
|
||||
SpanNameSep = "/"
|
||||
MetricNameSep = "_"
|
||||
Scope = "go.opentelemetry.io/collector/obsreport"
|
||||
)
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package obsreportconfig // import "go.opentelemetry.io/collector/internal/obsreportconfig"
|
||||
|
||||
import (
|
||||
"go.opentelemetry.io/collector/featuregate"
|
||||
)
|
||||
|
||||
// DisableHighCardinalityMetricsfeatureGate is the feature gate that controls whether the collector should enable
|
||||
// potentially high cardinality metrics. The gate will be removed when the collector allows for view configuration.
|
||||
var DisableHighCardinalityMetricsfeatureGate = featuregate.GlobalRegistry().MustRegister(
|
||||
"telemetry.disableHighCardinalityMetrics",
|
||||
featuregate.StageAlpha,
|
||||
featuregate.WithRegisterDescription("controls whether the collector should enable potentially high"+
|
||||
"cardinality metrics. The gate will be removed when the collector allows for view configuration."))
|
||||
|
||||
// UseOtelWithSDKConfigurationForInternalTelemetryFeatureGate is the feature gate that controls whether the collector
|
||||
// supports configuring the OpenTelemetry SDK via configuration
|
||||
var UseOtelWithSDKConfigurationForInternalTelemetryFeatureGate = featuregate.GlobalRegistry().MustRegister(
|
||||
"telemetry.useOtelWithSDKConfigurationForInternalTelemetry",
|
||||
featuregate.StageBeta,
|
||||
featuregate.WithRegisterDescription("controls whether the collector supports extended OpenTelemetry"+
|
||||
"configuration for internal telemetry"))
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package obsreportconfig
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"go.uber.org/goleak"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
goleak.VerifyTestMain(m)
|
||||
}
|
||||
|
|
@ -4,7 +4,6 @@ go 1.22.0
|
|||
|
||||
require (
|
||||
github.com/stretchr/testify v1.9.0
|
||||
go.opentelemetry.io/collector v0.109.0
|
||||
go.opentelemetry.io/collector/client v1.15.0
|
||||
go.opentelemetry.io/collector/component v0.109.0
|
||||
go.opentelemetry.io/collector/config/configtelemetry v0.109.0
|
||||
|
|
@ -62,8 +61,6 @@ require (
|
|||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
replace go.opentelemetry.io/collector => ../../
|
||||
|
||||
replace go.opentelemetry.io/collector/processor => ../
|
||||
|
||||
replace go.opentelemetry.io/collector/component => ../../component
|
||||
|
|
@ -72,8 +69,6 @@ replace go.opentelemetry.io/collector/client => ../../client
|
|||
|
||||
replace go.opentelemetry.io/collector/confmap => ../../confmap
|
||||
|
||||
replace go.opentelemetry.io/collector/featuregate => ../../featuregate
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata => ../../pdata
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJ
|
|||
github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0=
|
||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
|
|
|
|||
|
|
@ -10,15 +10,14 @@ import (
|
|||
"go.opentelemetry.io/otel/metric"
|
||||
|
||||
"go.opentelemetry.io/collector/config/configtelemetry"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
"go.opentelemetry.io/collector/processor"
|
||||
"go.opentelemetry.io/collector/processor/batchprocessor/internal/metadata"
|
||||
"go.opentelemetry.io/collector/processor/internal"
|
||||
)
|
||||
|
||||
type trigger int
|
||||
|
||||
const (
|
||||
typeStr = "batch"
|
||||
triggerTimeout trigger = iota
|
||||
triggerBatchSize
|
||||
)
|
||||
|
|
@ -33,7 +32,7 @@ type batchProcessorTelemetry struct {
|
|||
}
|
||||
|
||||
func newBatchProcessorTelemetry(set processor.Settings, currentMetadataCardinality func() int) (*batchProcessorTelemetry, error) {
|
||||
attrs := attribute.NewSet(attribute.String(obsmetrics.ProcessorKey, set.ID.String()))
|
||||
attrs := attribute.NewSet(attribute.String(internal.ProcessorKey, set.ID.String()))
|
||||
|
||||
telemetryBuilder, err := metadata.NewTelemetryBuilder(set.TelemetrySettings,
|
||||
metadata.WithProcessorBatchMetadataCardinalityCallback(func() int64 {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ go 1.22.0
|
|||
require (
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/stretchr/testify v1.9.0
|
||||
go.opentelemetry.io/collector v0.109.0
|
||||
go.opentelemetry.io/collector/component v0.109.0
|
||||
go.opentelemetry.io/collector/component/componentstatus v0.109.0
|
||||
go.opentelemetry.io/collector/config/configtelemetry v0.109.0
|
||||
|
|
@ -53,16 +52,10 @@ require (
|
|||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
replace go.opentelemetry.io/collector => ../
|
||||
|
||||
replace go.opentelemetry.io/collector/component => ../component
|
||||
|
||||
replace go.opentelemetry.io/collector/confmap => ../confmap
|
||||
|
||||
replace go.opentelemetry.io/collector/consumer => ../consumer
|
||||
|
||||
replace go.opentelemetry.io/collector/featuregate => ../featuregate
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata => ../pdata
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJ
|
|||
github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0=
|
||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package internal // import "go.opentelemetry.io/collector/processor/internal"
|
||||
|
||||
const (
|
||||
MetricNameSep = "_"
|
||||
|
||||
// ProcessorKey is the key used to identify processors in metrics and traces.
|
||||
ProcessorKey = "processor"
|
||||
|
||||
ProcessorMetricPrefix = ProcessorKey + MetricNameSep
|
||||
)
|
||||
|
|
@ -11,8 +11,8 @@ import (
|
|||
"go.opentelemetry.io/otel/metric"
|
||||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
"go.opentelemetry.io/collector/processor"
|
||||
"go.opentelemetry.io/collector/processor/internal"
|
||||
"go.opentelemetry.io/collector/processor/processorhelper/internal/metadata"
|
||||
)
|
||||
|
||||
|
|
@ -20,14 +20,14 @@ import (
|
|||
// the standards used in the Collector. The configType should be the same
|
||||
// value used to identify the type on the config.
|
||||
func BuildCustomMetricName(configType, metric string) string {
|
||||
componentPrefix := obsmetrics.ProcessorMetricPrefix
|
||||
if !strings.HasSuffix(componentPrefix, obsmetrics.MetricNameSep) {
|
||||
componentPrefix += obsmetrics.MetricNameSep
|
||||
componentPrefix := internal.ProcessorMetricPrefix
|
||||
if !strings.HasSuffix(componentPrefix, internal.MetricNameSep) {
|
||||
componentPrefix += internal.MetricNameSep
|
||||
}
|
||||
if configType == "" {
|
||||
return componentPrefix
|
||||
}
|
||||
return componentPrefix + configType + obsmetrics.MetricNameSep + metric
|
||||
return componentPrefix + configType + internal.MetricNameSep + metric
|
||||
}
|
||||
|
||||
// ObsReport is a helper to add observability to a processor.
|
||||
|
|
@ -54,7 +54,7 @@ func newObsReport(cfg ObsReportSettings) (*ObsReport, error) {
|
|||
}
|
||||
return &ObsReport{
|
||||
otelAttrs: []attribute.KeyValue{
|
||||
attribute.String(obsmetrics.ProcessorKey, cfg.ProcessorID.String()),
|
||||
attribute.String(internal.ProcessorKey, cfg.ProcessorID.String()),
|
||||
},
|
||||
telemetryBuilder: telemetryBuilder,
|
||||
}, nil
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/consumer"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
"go.opentelemetry.io/collector/processor/internal"
|
||||
)
|
||||
|
||||
// ErrSkipProcessingData is a sentinel value to indicate when traces or metrics should intentionally be dropped
|
||||
|
|
@ -69,5 +69,5 @@ func fromOptions(options []Option) *baseSettings {
|
|||
}
|
||||
|
||||
func spanAttributes(id component.ID) trace.EventOption {
|
||||
return trace.WithAttributes(attribute.String(obsmetrics.ProcessorKey, id.String()))
|
||||
return trace.WithAttributes(attribute.String(internal.ProcessorKey, id.String()))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,24 +39,18 @@ replace go.opentelemetry.io/collector/processor => ../
|
|||
|
||||
replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry
|
||||
|
||||
replace go.opentelemetry.io/collector => ../..
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
|
||||
|
||||
replace go.opentelemetry.io/collector/consumer => ../../consumer
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
|
||||
|
||||
replace go.opentelemetry.io/collector/confmap => ../../confmap
|
||||
|
||||
replace go.opentelemetry.io/collector/component => ../../component
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata => ../../pdata
|
||||
|
||||
replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles
|
||||
|
||||
replace go.opentelemetry.io/collector/featuregate => ../../featuregate
|
||||
|
||||
replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest
|
||||
|
||||
replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ go 1.22.0
|
|||
require (
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/stretchr/testify v1.9.0
|
||||
go.opentelemetry.io/collector v0.109.0
|
||||
go.opentelemetry.io/collector/component v0.109.0
|
||||
go.opentelemetry.io/collector/config/configtelemetry v0.109.0
|
||||
go.opentelemetry.io/collector/consumer v0.109.0
|
||||
|
|
@ -51,16 +50,10 @@ require (
|
|||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
replace go.opentelemetry.io/collector => ../
|
||||
|
||||
replace go.opentelemetry.io/collector/component => ../component
|
||||
|
||||
replace go.opentelemetry.io/collector/confmap => ../confmap
|
||||
|
||||
replace go.opentelemetry.io/collector/consumer => ../consumer
|
||||
|
||||
replace go.opentelemetry.io/collector/featuregate => ../featuregate
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata => ../pdata
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata
|
||||
|
|
@ -75,6 +68,4 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../consumer/c
|
|||
|
||||
replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consumertest
|
||||
|
||||
replace go.opentelemetry.io/collector/component/componentstatus => ../component/componentstatus
|
||||
|
||||
replace go.opentelemetry.io/collector/receiver/receiverprofiles => ./receiverprofiles
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJ
|
|||
github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0=
|
||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package obsmetrics // import "go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
package internal // import "go.opentelemetry.io/collector/receiver/internal"
|
||||
|
||||
const (
|
||||
// SpanNameSep is duplicate between receiver and exporter.
|
||||
SpanNameSep = "/"
|
||||
|
||||
// ReceiverKey used to identify receivers in metrics and traces.
|
||||
ReceiverKey = "receiver"
|
||||
// TransportKey used to identify the transport used to received the data.
|
||||
|
|
@ -27,11 +30,20 @@ const (
|
|||
// RefusedLogRecordsKey used to identify log records refused (ie.: not ingested) by the
|
||||
// Collector.
|
||||
RefusedLogRecordsKey = "refused_log_records"
|
||||
)
|
||||
|
||||
var (
|
||||
// ScraperKey used to identify scrapers in metrics and traces.
|
||||
ScraperKey = "scraper"
|
||||
|
||||
// ScrapedMetricPointsKey used to identify metric points scraped by the
|
||||
// Collector.
|
||||
ScrapedMetricPointsKey = "scraped_metric_points"
|
||||
// ErroredMetricPointsKey used to identify metric points errored (i.e.
|
||||
// unable to be scraped) by the Collector.
|
||||
ErroredMetricPointsKey = "errored_metric_points"
|
||||
ScraperPrefix = ScraperKey + SpanNameSep
|
||||
ScraperMetricsOperationSuffix = SpanNameSep + "MetricsScraped"
|
||||
|
||||
ReceiverPrefix = ReceiverKey + SpanNameSep
|
||||
ReceiverMetricPrefix = ReceiverKey + MetricNameSep
|
||||
ReceiveTraceDataOperationSuffix = SpanNameSep + "TraceDataReceived"
|
||||
ReceiverMetricsOperationSuffix = SpanNameSep + "MetricsReceived"
|
||||
ReceiverLogsOperationSuffix = SpanNameSep + "LogsReceived"
|
||||
|
|
@ -72,16 +72,10 @@ replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
|
|||
|
||||
replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry
|
||||
|
||||
replace go.opentelemetry.io/collector => ../..
|
||||
|
||||
replace go.opentelemetry.io/collector/featuregate => ../../featuregate
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
|
||||
|
||||
replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles
|
||||
|
||||
replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest
|
||||
|
||||
replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus
|
||||
|
||||
replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../receiverprofiles
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ import (
|
|||
"go.opentelemetry.io/otel/trace"
|
||||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
"go.opentelemetry.io/collector/receiver"
|
||||
"go.opentelemetry.io/collector/receiver/internal"
|
||||
"go.opentelemetry.io/collector/receiver/receiverhelper/internal/metadata"
|
||||
)
|
||||
|
||||
|
|
@ -54,14 +54,14 @@ func newReceiver(cfg ObsReportSettings) (*ObsReport, error) {
|
|||
return nil, err
|
||||
}
|
||||
return &ObsReport{
|
||||
spanNamePrefix: obsmetrics.ReceiverPrefix + cfg.ReceiverID.String(),
|
||||
spanNamePrefix: internal.ReceiverPrefix + cfg.ReceiverID.String(),
|
||||
transport: cfg.Transport,
|
||||
longLivedCtx: cfg.LongLivedCtx,
|
||||
tracer: cfg.ReceiverCreateSettings.TracerProvider.Tracer(cfg.ReceiverID.String()),
|
||||
|
||||
otelAttrs: []attribute.KeyValue{
|
||||
attribute.String(obsmetrics.ReceiverKey, cfg.ReceiverID.String()),
|
||||
attribute.String(obsmetrics.TransportKey, cfg.Transport),
|
||||
attribute.String(internal.ReceiverKey, cfg.ReceiverID.String()),
|
||||
attribute.String(internal.TransportKey, cfg.Transport),
|
||||
},
|
||||
telemetryBuilder: telemetryBuilder,
|
||||
}, nil
|
||||
|
|
@ -71,7 +71,7 @@ func newReceiver(cfg ObsReportSettings) (*ObsReport, error) {
|
|||
// The returned context should be used in other calls to the obsreport functions
|
||||
// dealing with the same receive operation.
|
||||
func (rec *ObsReport) StartTracesOp(operationCtx context.Context) context.Context {
|
||||
return rec.startOp(operationCtx, obsmetrics.ReceiveTraceDataOperationSuffix)
|
||||
return rec.startOp(operationCtx, internal.ReceiveTraceDataOperationSuffix)
|
||||
}
|
||||
|
||||
// EndTracesOp completes the receive operation that was started with
|
||||
|
|
@ -89,7 +89,7 @@ func (rec *ObsReport) EndTracesOp(
|
|||
// The returned context should be used in other calls to the obsreport functions
|
||||
// dealing with the same receive operation.
|
||||
func (rec *ObsReport) StartLogsOp(operationCtx context.Context) context.Context {
|
||||
return rec.startOp(operationCtx, obsmetrics.ReceiverLogsOperationSuffix)
|
||||
return rec.startOp(operationCtx, internal.ReceiverLogsOperationSuffix)
|
||||
}
|
||||
|
||||
// EndLogsOp completes the receive operation that was started with
|
||||
|
|
@ -107,7 +107,7 @@ func (rec *ObsReport) EndLogsOp(
|
|||
// The returned context should be used in other calls to the obsreport functions
|
||||
// dealing with the same receive operation.
|
||||
func (rec *ObsReport) StartMetricsOp(operationCtx context.Context) context.Context {
|
||||
return rec.startOp(operationCtx, obsmetrics.ReceiverMetricsOperationSuffix)
|
||||
return rec.startOp(operationCtx, internal.ReceiverMetricsOperationSuffix)
|
||||
}
|
||||
|
||||
// EndMetricsOp completes the receive operation that was started with
|
||||
|
|
@ -141,7 +141,7 @@ func (rec *ObsReport) startOp(receiverCtx context.Context, operationSuffix strin
|
|||
}
|
||||
|
||||
if rec.transport != "" {
|
||||
span.SetAttributes(attribute.String(obsmetrics.TransportKey, rec.transport))
|
||||
span.SetAttributes(attribute.String(internal.TransportKey, rec.transport))
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
|
@ -170,18 +170,18 @@ func (rec *ObsReport) endOp(
|
|||
var acceptedItemsKey, refusedItemsKey string
|
||||
switch dataType {
|
||||
case component.DataTypeTraces:
|
||||
acceptedItemsKey = obsmetrics.AcceptedSpansKey
|
||||
refusedItemsKey = obsmetrics.RefusedSpansKey
|
||||
acceptedItemsKey = internal.AcceptedSpansKey
|
||||
refusedItemsKey = internal.RefusedSpansKey
|
||||
case component.DataTypeMetrics:
|
||||
acceptedItemsKey = obsmetrics.AcceptedMetricPointsKey
|
||||
refusedItemsKey = obsmetrics.RefusedMetricPointsKey
|
||||
acceptedItemsKey = internal.AcceptedMetricPointsKey
|
||||
refusedItemsKey = internal.RefusedMetricPointsKey
|
||||
case component.DataTypeLogs:
|
||||
acceptedItemsKey = obsmetrics.AcceptedLogRecordsKey
|
||||
refusedItemsKey = obsmetrics.RefusedLogRecordsKey
|
||||
acceptedItemsKey = internal.AcceptedLogRecordsKey
|
||||
refusedItemsKey = internal.RefusedLogRecordsKey
|
||||
}
|
||||
|
||||
span.SetAttributes(
|
||||
attribute.String(obsmetrics.FormatKey, format),
|
||||
attribute.String(internal.FormatKey, format),
|
||||
attribute.Int64(acceptedItemsKey, int64(numAccepted)),
|
||||
attribute.Int64(refusedItemsKey, int64(numRefused)),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import (
|
|||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/component/componenttest"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
"go.opentelemetry.io/collector/receiver"
|
||||
"go.opentelemetry.io/collector/receiver/internal"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -65,13 +65,13 @@ func TestReceiveTraceDataOp(t *testing.T) {
|
|||
switch {
|
||||
case params[i].err == nil:
|
||||
acceptedSpans += params[i].items
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.AcceptedSpansKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.RefusedSpansKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.AcceptedSpansKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.RefusedSpansKey, Value: attribute.Int64Value(0)})
|
||||
assert.Equal(t, codes.Unset, span.Status().Code)
|
||||
case errors.Is(params[i].err, errFake):
|
||||
refusedSpans += params[i].items
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.AcceptedSpansKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.RefusedSpansKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.AcceptedSpansKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.RefusedSpansKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
assert.Equal(t, codes.Error, span.Status().Code)
|
||||
assert.Equal(t, params[i].err.Error(), span.Status().Description)
|
||||
default:
|
||||
|
|
@ -113,13 +113,13 @@ func TestReceiveLogsOp(t *testing.T) {
|
|||
switch {
|
||||
case params[i].err == nil:
|
||||
acceptedLogRecords += params[i].items
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.AcceptedLogRecordsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.RefusedLogRecordsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.AcceptedLogRecordsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.RefusedLogRecordsKey, Value: attribute.Int64Value(0)})
|
||||
assert.Equal(t, codes.Unset, span.Status().Code)
|
||||
case errors.Is(params[i].err, errFake):
|
||||
refusedLogRecords += params[i].items
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.AcceptedLogRecordsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.RefusedLogRecordsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.AcceptedLogRecordsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.RefusedLogRecordsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
assert.Equal(t, codes.Error, span.Status().Code)
|
||||
assert.Equal(t, params[i].err.Error(), span.Status().Description)
|
||||
default:
|
||||
|
|
@ -161,13 +161,13 @@ func TestReceiveMetricsOp(t *testing.T) {
|
|||
switch {
|
||||
case params[i].err == nil:
|
||||
acceptedMetricPoints += params[i].items
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.AcceptedMetricPointsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.RefusedMetricPointsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.AcceptedMetricPointsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.RefusedMetricPointsKey, Value: attribute.Int64Value(0)})
|
||||
assert.Equal(t, codes.Unset, span.Status().Code)
|
||||
case errors.Is(params[i].err, errFake):
|
||||
refusedMetricPoints += params[i].items
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.AcceptedMetricPointsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.RefusedMetricPointsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.AcceptedMetricPointsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.RefusedMetricPointsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
assert.Equal(t, codes.Error, span.Status().Code)
|
||||
assert.Equal(t, params[i].err.Error(), span.Status().Description)
|
||||
default:
|
||||
|
|
@ -216,15 +216,15 @@ func TestReceiveWithLongLivedCtx(t *testing.T) {
|
|||
assert.Equal(t, parentSpan.SpanContext().TraceID(), link.SpanContext.TraceID())
|
||||
assert.Equal(t, parentSpan.SpanContext().SpanID(), link.SpanContext.SpanID())
|
||||
assert.Equal(t, "receiver/"+receiverID.String()+"/TraceDataReceived", span.Name())
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.TransportKey, Value: attribute.StringValue(transport)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.TransportKey, Value: attribute.StringValue(transport)})
|
||||
switch {
|
||||
case params[i].err == nil:
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.AcceptedSpansKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.RefusedSpansKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.AcceptedSpansKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.RefusedSpansKey, Value: attribute.Int64Value(0)})
|
||||
assert.Equal(t, codes.Unset, span.Status().Code)
|
||||
case errors.Is(params[i].err, errFake):
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.AcceptedSpansKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.RefusedSpansKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.AcceptedSpansKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.RefusedSpansKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
assert.Equal(t, codes.Error, span.Status().Code)
|
||||
assert.Equal(t, params[i].err.Error(), span.Status().Description)
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ require (
|
|||
|
||||
replace go.opentelemetry.io/collector/receiver => ../
|
||||
|
||||
replace go.opentelemetry.io/collector/confmap => ../../confmap
|
||||
|
||||
replace go.opentelemetry.io/collector/consumer => ../../consumer
|
||||
|
||||
replace go.opentelemetry.io/collector/component => ../../component
|
||||
|
|
@ -47,16 +45,10 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume
|
|||
|
||||
replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry
|
||||
|
||||
replace go.opentelemetry.io/collector => ../..
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
|
||||
|
||||
replace go.opentelemetry.io/collector/featuregate => ../../featuregate
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
|
||||
|
||||
replace go.opentelemetry.io/collector/pdata => ../../pdata
|
||||
|
||||
replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest
|
||||
|
||||
replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ import (
|
|||
"go.opentelemetry.io/otel/trace"
|
||||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
"go.opentelemetry.io/collector/receiver"
|
||||
"go.opentelemetry.io/collector/receiver/internal"
|
||||
"go.opentelemetry.io/collector/receiver/scrapererror"
|
||||
"go.opentelemetry.io/collector/receiver/scraperhelper/internal/metadata"
|
||||
)
|
||||
|
|
@ -47,8 +47,8 @@ func newScraper(cfg obsReportSettings) (*obsReport, error) {
|
|||
tracer: cfg.ReceiverCreateSettings.TracerProvider.Tracer(cfg.Scraper.String()),
|
||||
|
||||
otelAttrs: []attribute.KeyValue{
|
||||
attribute.String(obsmetrics.ReceiverKey, cfg.ReceiverID.String()),
|
||||
attribute.String(obsmetrics.ScraperKey, cfg.Scraper.String()),
|
||||
attribute.String(internal.ReceiverKey, cfg.ReceiverID.String()),
|
||||
attribute.String(internal.ScraperKey, cfg.Scraper.String()),
|
||||
},
|
||||
telemetryBuilder: telemetryBuilder,
|
||||
}, nil
|
||||
|
|
@ -58,7 +58,7 @@ func newScraper(cfg obsReportSettings) (*obsReport, error) {
|
|||
// returned context should be used in other calls to the obsreport functions
|
||||
// dealing with the same scrape operation.
|
||||
func (s *obsReport) StartMetricsOp(ctx context.Context) context.Context {
|
||||
spanName := obsmetrics.ScraperPrefix + s.receiverID.String() + obsmetrics.SpanNameSep + s.scraper.String() + obsmetrics.ScraperMetricsOperationSuffix
|
||||
spanName := internal.ScraperPrefix + s.receiverID.String() + internal.SpanNameSep + s.scraper.String() + internal.ScraperMetricsOperationSuffix
|
||||
ctx, _ = s.tracer.Start(ctx, spanName)
|
||||
return ctx
|
||||
}
|
||||
|
|
@ -88,9 +88,9 @@ func (s *obsReport) EndMetricsOp(
|
|||
// end span according to errors
|
||||
if span.IsRecording() {
|
||||
span.SetAttributes(
|
||||
attribute.String(obsmetrics.FormatKey, component.DataTypeMetrics.String()),
|
||||
attribute.Int64(obsmetrics.ScrapedMetricPointsKey, int64(numScrapedMetrics)),
|
||||
attribute.Int64(obsmetrics.ErroredMetricPointsKey, int64(numErroredMetrics)),
|
||||
attribute.String(internal.FormatKey, component.DataTypeMetrics.String()),
|
||||
attribute.Int64(internal.ScrapedMetricPointsKey, int64(numScrapedMetrics)),
|
||||
attribute.Int64(internal.ErroredMetricPointsKey, int64(numErroredMetrics)),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import (
|
|||
|
||||
"go.opentelemetry.io/collector/component"
|
||||
"go.opentelemetry.io/collector/component/componenttest"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
|
||||
"go.opentelemetry.io/collector/receiver"
|
||||
"go.opentelemetry.io/collector/receiver/internal"
|
||||
"go.opentelemetry.io/collector/receiver/scrapererror"
|
||||
)
|
||||
|
||||
|
|
@ -64,21 +64,21 @@ func TestScrapeMetricsDataOp(t *testing.T) {
|
|||
switch {
|
||||
case params[i].err == nil:
|
||||
scrapedMetricPoints += params[i].items
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.ScrapedMetricPointsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.ErroredMetricPointsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.ScrapedMetricPointsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.ErroredMetricPointsKey, Value: attribute.Int64Value(0)})
|
||||
assert.Equal(t, codes.Unset, span.Status().Code)
|
||||
case errors.Is(params[i].err, errFake):
|
||||
erroredMetricPoints += params[i].items
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.ScrapedMetricPointsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.ErroredMetricPointsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.ScrapedMetricPointsKey, Value: attribute.Int64Value(0)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.ErroredMetricPointsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
assert.Equal(t, codes.Error, span.Status().Code)
|
||||
assert.Equal(t, params[i].err.Error(), span.Status().Description)
|
||||
|
||||
case errors.Is(params[i].err, partialErrFake):
|
||||
scrapedMetricPoints += params[i].items
|
||||
erroredMetricPoints++
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.ScrapedMetricPointsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.ErroredMetricPointsKey, Value: attribute.Int64Value(1)})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.ScrapedMetricPointsKey, Value: attribute.Int64Value(int64(params[i].items))})
|
||||
require.Contains(t, span.Attributes(), attribute.KeyValue{Key: internal.ErroredMetricPointsKey, Value: attribute.Int64Value(1)})
|
||||
assert.Equal(t, codes.Error, span.Status().Code)
|
||||
assert.Equal(t, params[i].err.Error(), span.Status().Description)
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ import (
|
|||
"go.opentelemetry.io/collector/connector"
|
||||
"go.opentelemetry.io/collector/exporter"
|
||||
"go.opentelemetry.io/collector/extension"
|
||||
"go.opentelemetry.io/collector/featuregate"
|
||||
"go.opentelemetry.io/collector/internal/localhostgate"
|
||||
"go.opentelemetry.io/collector/internal/obsreportconfig"
|
||||
"go.opentelemetry.io/collector/pdata/pcommon"
|
||||
"go.opentelemetry.io/collector/processor"
|
||||
"go.opentelemetry.io/collector/receiver"
|
||||
|
|
@ -37,6 +37,22 @@ import (
|
|||
"go.opentelemetry.io/collector/service/telemetry"
|
||||
)
|
||||
|
||||
// useOtelWithSDKConfigurationForInternalTelemetryFeatureGate is the feature gate that controls whether the collector
|
||||
// supports configuring the OpenTelemetry SDK via configuration
|
||||
var useOtelWithSDKConfigurationForInternalTelemetryFeatureGate = featuregate.GlobalRegistry().MustRegister(
|
||||
"telemetry.useOtelWithSDKConfigurationForInternalTelemetry",
|
||||
featuregate.StageBeta,
|
||||
featuregate.WithRegisterDescription("controls whether the collector supports extended OpenTelemetry"+
|
||||
"configuration for internal telemetry"))
|
||||
|
||||
// disableHighCardinalityMetricsfeatureGate is the feature gate that controls whether the collector should enable
|
||||
// potentially high cardinality metrics. The gate will be removed when the collector allows for view configuration.
|
||||
var disableHighCardinalityMetricsfeatureGate = featuregate.GlobalRegistry().MustRegister(
|
||||
"telemetry.disableHighCardinalityMetrics",
|
||||
featuregate.StageAlpha,
|
||||
featuregate.WithRegisterDescription("controls whether the collector should enable potentially high"+
|
||||
"cardinality metrics. The gate will be removed when the collector allows for view configuration."))
|
||||
|
||||
// Settings holds configuration for building a new Service.
|
||||
type Settings struct {
|
||||
// BuildInfo provides collector start information.
|
||||
|
|
@ -88,7 +104,7 @@ type Service struct {
|
|||
|
||||
// New creates a new Service, its telemetry, and Components.
|
||||
func New(ctx context.Context, set Settings, cfg Config) (*Service, error) {
|
||||
disableHighCard := obsreportconfig.DisableHighCardinalityMetricsfeatureGate.IsEnabled()
|
||||
disableHighCard := disableHighCardinalityMetricsfeatureGate.IsEnabled()
|
||||
|
||||
srv := &Service{
|
||||
buildInfo: set.BuildInfo,
|
||||
|
|
@ -190,7 +206,7 @@ func logsAboutMeterProvider(logger *zap.Logger, cfg telemetry.MetricsConfig, mp
|
|||
return
|
||||
}
|
||||
|
||||
if len(cfg.Address) != 0 && obsreportconfig.UseOtelWithSDKConfigurationForInternalTelemetryFeatureGate.IsEnabled() {
|
||||
if len(cfg.Address) != 0 && useOtelWithSDKConfigurationForInternalTelemetryFeatureGate.IsEnabled() {
|
||||
logger.Warn("service::telemetry::metrics::address is being deprecated in favor of service::telemetry::metrics::readers")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue