@@ -18,11 +18,8 @@ import (
1818 "go.opentelemetry.io/collector/internal/obsreportconfig/obsmetrics"
1919)
2020
21- // ObsReport is a helper to add observability to an exporter.
22- //
23- // Deprecated: [v0.105.0] Not expected to be used directly.
24- // If needed, report your use case in https://github.com/open-telemetry/opentelemetry-collector/issues/10592.
25- type ObsReport struct {
21+ // obsReport is a helper to add observability to an exporter.
22+ type obsReport struct {
2623 level configtelemetry.Level
2724 spanNamePrefix string
2825 tracer trace.Tracer
@@ -32,112 +29,90 @@ type ObsReport struct {
3229 telemetryBuilder * metadata.TelemetryBuilder
3330}
3431
35- // ObsReportSettings are settings for creating an ObsReport.
36- //
37- // Deprecated: [v0.105.0] Not expected to be used directly.
38- // If needed, report your use case in https://github.com/open-telemetry/opentelemetry-collector/issues/10592.
39- type ObsReportSettings struct {
40- ExporterID component.ID
41- ExporterCreateSettings exporter.Settings
42- DataType component.DataType
32+ // obsReportSettings are settings for creating an obsReport.
33+ type obsReportSettings struct {
34+ exporterID component.ID
35+ exporterCreateSettings exporter.Settings
36+ dataType component.DataType
4337}
4438
45- // NewObsReport creates a new Exporter.
46- //
47- // Deprecated: [v0.105.0] Not expected to be used directly.
48- // If needed, report your use case in https://github.com/open-telemetry/opentelemetry-collector/issues/10592.
49- func NewObsReport (cfg ObsReportSettings ) (* ObsReport , error ) {
39+ // newObsReport creates a new Exporter.
40+ func newObsReport (cfg obsReportSettings ) (* obsReport , error ) {
5041 return newExporter (cfg )
5142}
5243
53- func newExporter (cfg ObsReportSettings ) (* ObsReport , error ) {
54- telemetryBuilder , err := metadata .NewTelemetryBuilder (cfg .ExporterCreateSettings .TelemetrySettings )
44+ func newExporter (cfg obsReportSettings ) (* obsReport , error ) {
45+ telemetryBuilder , err := metadata .NewTelemetryBuilder (cfg .exporterCreateSettings .TelemetrySettings )
5546 if err != nil {
5647 return nil , err
5748 }
5849
59- return & ObsReport {
60- level : cfg .ExporterCreateSettings .TelemetrySettings .MetricsLevel ,
61- spanNamePrefix : obsmetrics .ExporterPrefix + cfg .ExporterID .String (),
62- tracer : cfg .ExporterCreateSettings .TracerProvider .Tracer (cfg .ExporterID .String ()),
63- dataType : cfg .DataType ,
50+ return & obsReport {
51+ level : cfg .exporterCreateSettings .TelemetrySettings .MetricsLevel ,
52+ spanNamePrefix : obsmetrics .ExporterPrefix + cfg .exporterID .String (),
53+ tracer : cfg .exporterCreateSettings .TracerProvider .Tracer (cfg .exporterID .String ()),
54+ dataType : cfg .dataType ,
6455 otelAttrs : []attribute.KeyValue {
65- attribute .String (obsmetrics .ExporterKey , cfg .ExporterID .String ()),
56+ attribute .String (obsmetrics .ExporterKey , cfg .exporterID .String ()),
6657 },
6758 telemetryBuilder : telemetryBuilder ,
6859 }, nil
6960}
7061
71- // StartTracesOp is called at the start of an Export operation.
62+ // startTracesOp is called at the start of an Export operation.
7263// The returned context should be used in other calls to the Exporter functions
7364// dealing with the same export operation.
74- //
75- // Deprecated: [v0.105.0] Not expected to be used directly.
76- // If needed, report your use case in https://github.com/open-telemetry/opentelemetry-collector/issues/10592.
77- func (or * ObsReport ) StartTracesOp (ctx context.Context ) context.Context {
65+ func (or * obsReport ) startTracesOp (ctx context.Context ) context.Context {
7866 return or .startOp (ctx , obsmetrics .ExportTraceDataOperationSuffix )
7967}
8068
81- // EndTracesOp completes the export operation that was started with StartTracesOp.
82- //
83- // Deprecated: [v0.105.0] Not expected to be used directly.
84- // If needed, report your use case in https://github.com/open-telemetry/opentelemetry-collector/issues/10592.
85- func (or * ObsReport ) EndTracesOp (ctx context.Context , numSpans int , err error ) {
69+ // endTracesOp completes the export operation that was started with startTracesOp.
70+ func (or * obsReport ) endTracesOp (ctx context.Context , numSpans int , err error ) {
8671 numSent , numFailedToSend := toNumItems (numSpans , err )
8772 or .recordMetrics (context .WithoutCancel (ctx ), component .DataTypeTraces , numSent , numFailedToSend )
8873 endSpan (ctx , err , numSent , numFailedToSend , obsmetrics .SentSpansKey , obsmetrics .FailedToSendSpansKey )
8974}
9075
91- // StartMetricsOp is called at the start of an Export operation.
76+ // startMetricsOp is called at the start of an Export operation.
9277// The returned context should be used in other calls to the Exporter functions
9378// dealing with the same export operation.
94- //
95- // Deprecated: [v0.105.0] Not expected to be used directly.
96- // If needed, report your use case in https://github.com/open-telemetry/opentelemetry-collector/issues/10592.
97- func (or * ObsReport ) StartMetricsOp (ctx context.Context ) context.Context {
79+ func (or * obsReport ) startMetricsOp (ctx context.Context ) context.Context {
9880 return or .startOp (ctx , obsmetrics .ExportMetricsOperationSuffix )
9981}
10082
101- // EndMetricsOp completes the export operation that was started with
102- // StartMetricsOp .
83+ // endMetricsOp completes the export operation that was started with
84+ // startMetricsOp .
10385//
104- // Deprecated: [v0.105.0] Not expected to be used directly.
10586// If needed, report your use case in https://github.com/open-telemetry/opentelemetry-collector/issues/10592.
106- func (or * ObsReport ) EndMetricsOp (ctx context.Context , numMetricPoints int , err error ) {
87+ func (or * obsReport ) endMetricsOp (ctx context.Context , numMetricPoints int , err error ) {
10788 numSent , numFailedToSend := toNumItems (numMetricPoints , err )
10889 or .recordMetrics (context .WithoutCancel (ctx ), component .DataTypeMetrics , numSent , numFailedToSend )
10990 endSpan (ctx , err , numSent , numFailedToSend , obsmetrics .SentMetricPointsKey , obsmetrics .FailedToSendMetricPointsKey )
11091}
11192
112- // StartLogsOp is called at the start of an Export operation.
93+ // startLogsOp is called at the start of an Export operation.
11394// The returned context should be used in other calls to the Exporter functions
11495// dealing with the same export operation.
115- //
116- // Deprecated: [v0.105.0] Not expected to be used directly.
117- // If needed, report your use case in https://github.com/open-telemetry/opentelemetry-collector/issues/10592.
118- func (or * ObsReport ) StartLogsOp (ctx context.Context ) context.Context {
96+ func (or * obsReport ) startLogsOp (ctx context.Context ) context.Context {
11997 return or .startOp (ctx , obsmetrics .ExportLogsOperationSuffix )
12098}
12199
122- // EndLogsOp completes the export operation that was started with StartLogsOp.
123- //
124- // Deprecated: [v0.105.0] Not expected to be used directly.
125- // If needed, report your use case in https://github.com/open-telemetry/opentelemetry-collector/issues/10592.
126- func (or * ObsReport ) EndLogsOp (ctx context.Context , numLogRecords int , err error ) {
100+ // endLogsOp completes the export operation that was started with startLogsOp.
101+ func (or * obsReport ) endLogsOp (ctx context.Context , numLogRecords int , err error ) {
127102 numSent , numFailedToSend := toNumItems (numLogRecords , err )
128103 or .recordMetrics (context .WithoutCancel (ctx ), component .DataTypeLogs , numSent , numFailedToSend )
129104 endSpan (ctx , err , numSent , numFailedToSend , obsmetrics .SentLogRecordsKey , obsmetrics .FailedToSendLogRecordsKey )
130105}
131106
132107// startOp creates the span used to trace the operation. Returning
133108// the updated context and the created span.
134- func (or * ObsReport ) startOp (ctx context.Context , operationSuffix string ) context.Context {
109+ func (or * obsReport ) startOp (ctx context.Context , operationSuffix string ) context.Context {
135110 spanName := or .spanNamePrefix + operationSuffix
136111 ctx , _ = or .tracer .Start (ctx , spanName )
137112 return ctx
138113}
139114
140- func (or * ObsReport ) recordMetrics (ctx context.Context , dataType component.DataType , sent , failed int64 ) {
115+ func (or * obsReport ) recordMetrics (ctx context.Context , dataType component.DataType , sent , failed int64 ) {
141116 if or .level == configtelemetry .LevelNone {
142117 return
143118 }
@@ -180,7 +155,7 @@ func toNumItems(numExportedItems int, err error) (int64, int64) {
180155 return int64 (numExportedItems ), 0
181156}
182157
183- func (or * ObsReport ) recordEnqueueFailure (ctx context.Context , dataType component.DataType , failed int64 ) {
158+ func (or * obsReport ) recordEnqueueFailure (ctx context.Context , dataType component.DataType , failed int64 ) {
184159 var enqueueFailedMeasure metric.Int64Counter
185160 switch dataType {
186161 case component .DataTypeTraces :
0 commit comments