Skip to content

Commit 5cd2421

Browse files
dmitryaxcodeboten
andauthored
[exporterhelper] Deprecate the obsreport API (#10594)
Deprecate the obsreport API in the exporterhelper package. The top-level helpers `exporterhelper.New[Metrics|Traces|Logs]Exporter` are supposed to be used instead. Resolves #10592 --------- Co-authored-by: Alex Boten <[email protected]>
1 parent 54b8c19 commit 5cd2421

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: 'deprecation'
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
7+
component: exporterhelper
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Deprecate the obsreport API in the exporterhelper package.
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [10592]
14+
15+
# Optional: The change log or logs in which this entry should be included.
16+
# e.g. '[user]' or '[user, api]'
17+
# Include 'user' if the change is relevant to end users.
18+
# Include 'api' if there is a change to a library API.
19+
# Default: '[user]'
20+
change_logs: [api]

exporter/exporterhelper/obsexporter.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ import (
1919
)
2020

2121
// 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.
2225
type ObsReport struct {
2326
level configtelemetry.Level
2427
spanNamePrefix string
@@ -29,12 +32,18 @@ type ObsReport struct {
2932
}
3033

3134
// ObsReportSettings are settings for creating an ObsReport.
35+
//
36+
// Deprecated: [v0.105.0] Not expected to be used directly.
37+
// If needed, report your use case in https://github.com/open-telemetry/opentelemetry-collector/issues/10592.
3238
type ObsReportSettings struct {
3339
ExporterID component.ID
3440
ExporterCreateSettings exporter.Settings
3541
}
3642

3743
// NewObsReport creates a new Exporter.
44+
//
45+
// Deprecated: [v0.105.0] Not expected to be used directly.
46+
// If needed, report your use case in https://github.com/open-telemetry/opentelemetry-collector/issues/10592.
3847
func NewObsReport(cfg ObsReportSettings) (*ObsReport, error) {
3948
return newExporter(cfg)
4049
}
@@ -62,11 +71,17 @@ func newExporter(cfg ObsReportSettings) (*ObsReport, error) {
6271
// StartTracesOp is called at the start of an Export operation.
6372
// The returned context should be used in other calls to the Exporter functions
6473
// 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.
6577
func (or *ObsReport) StartTracesOp(ctx context.Context) context.Context {
6678
return or.startOp(ctx, obsmetrics.ExportTraceDataOperationSuffix)
6779
}
6880

6981
// 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.
7085
func (or *ObsReport) EndTracesOp(ctx context.Context, numSpans int, err error) {
7186
numSent, numFailedToSend := toNumItems(numSpans, err)
7287
or.recordMetrics(context.WithoutCancel(ctx), component.DataTypeTraces, numSent, numFailedToSend)
@@ -76,12 +91,18 @@ func (or *ObsReport) EndTracesOp(ctx context.Context, numSpans int, err error) {
7691
// StartMetricsOp is called at the start of an Export operation.
7792
// The returned context should be used in other calls to the Exporter functions
7893
// 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.
7997
func (or *ObsReport) StartMetricsOp(ctx context.Context) context.Context {
8098
return or.startOp(ctx, obsmetrics.ExportMetricsOperationSuffix)
8199
}
82100

83101
// EndMetricsOp completes the export operation that was started with
84102
// StartMetricsOp.
103+
//
104+
// Deprecated: [v0.105.0] Not expected to be used directly.
105+
// If needed, report your use case in https://github.com/open-telemetry/opentelemetry-collector/issues/10592.
85106
func (or *ObsReport) EndMetricsOp(ctx context.Context, numMetricPoints int, err error) {
86107
numSent, numFailedToSend := toNumItems(numMetricPoints, err)
87108
or.recordMetrics(context.WithoutCancel(ctx), component.DataTypeMetrics, numSent, numFailedToSend)
@@ -91,11 +112,17 @@ func (or *ObsReport) EndMetricsOp(ctx context.Context, numMetricPoints int, err
91112
// StartLogsOp is called at the start of an Export operation.
92113
// The returned context should be used in other calls to the Exporter functions
93114
// 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.
94118
func (or *ObsReport) StartLogsOp(ctx context.Context) context.Context {
95119
return or.startOp(ctx, obsmetrics.ExportLogsOperationSuffix)
96120
}
97121

98122
// 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.
99126
func (or *ObsReport) EndLogsOp(ctx context.Context, numLogRecords int, err error) {
100127
numSent, numFailedToSend := toNumItems(numLogRecords, err)
101128
or.recordMetrics(context.WithoutCancel(ctx), component.DataTypeLogs, numSent, numFailedToSend)

0 commit comments

Comments
 (0)