@@ -51,7 +51,7 @@ type StartReceiveOption func(*StartReceiveOptions)
5151// for {
5252// // Since the context outlives the individual receive operations call obsreport using
5353// // WithLongLivedCtx().
54- // ctx := obsreport.StartTraceDataReceiveOp (
54+ // ctx := obsreport.StartTracesOp (
5555// longLivedCtx,
5656// r.config.Name(),
5757// r.transport,
@@ -62,7 +62,7 @@ type StartReceiveOption func(*StartReceiveOptions)
6262// if ok {
6363// err = r.nextConsumer.ConsumeTraces(ctx, td)
6464// }
65- // obsreport.EndTraceDataReceiveOp (
65+ // obsreport.EndTracesOp (
6666// ctx,
6767// r.format,
6868// len(td.Spans),
@@ -99,94 +99,58 @@ func NewReceiver(cfg ReceiverSettings) *Receiver {
9999 }
100100}
101101
102- // StartTraceDataReceiveOp is called when a request is received from a client.
102+ // StartTracesOp is called when a request is received from a client.
103103// The returned context should be used in other calls to the obsreport functions
104104// dealing with the same receive operation.
105- func (rec * Receiver ) StartTraceDataReceiveOp (
106- operationCtx context.Context ,
107- opt ... StartReceiveOption ,
108- ) context.Context {
109- return rec .traceReceiveOp (
110- operationCtx ,
111- obsmetrics .ReceiveTraceDataOperationSuffix ,
112- opt ... )
105+ func (rec * Receiver ) StartTracesOp (operationCtx context.Context , opt ... StartReceiveOption ) context.Context {
106+ return rec .startOp (operationCtx , obsmetrics .ReceiveTraceDataOperationSuffix , opt ... )
113107}
114108
115- // EndTraceDataReceiveOp completes the receive operation that was started with
116- // StartTraceDataReceiveOp .
117- func (rec * Receiver ) EndTraceDataReceiveOp (
109+ // EndTracesOp completes the receive operation that was started with
110+ // StartTracesOp .
111+ func (rec * Receiver ) EndTracesOp (
118112 receiverCtx context.Context ,
119113 format string ,
120114 numReceivedSpans int ,
121115 err error ,
122116) {
123- rec .endReceiveOp (
124- receiverCtx ,
125- format ,
126- numReceivedSpans ,
127- err ,
128- config .TracesDataType ,
129- )
117+ rec .endOp (receiverCtx , format , numReceivedSpans , err , config .TracesDataType )
130118}
131119
132- // StartLogsReceiveOp is called when a request is received from a client.
120+ // StartLogsOp is called when a request is received from a client.
133121// The returned context should be used in other calls to the obsreport functions
134122// dealing with the same receive operation.
135- func (rec * Receiver ) StartLogsReceiveOp (
136- operationCtx context.Context ,
137- opt ... StartReceiveOption ,
138- ) context.Context {
139- return rec .traceReceiveOp (
140- operationCtx ,
141- obsmetrics .ReceiverLogsOperationSuffix ,
142- opt ... )
123+ func (rec * Receiver ) StartLogsOp (operationCtx context.Context , opt ... StartReceiveOption ) context.Context {
124+ return rec .startOp (operationCtx , obsmetrics .ReceiverLogsOperationSuffix , opt ... )
143125}
144126
145- // EndLogsReceiveOp completes the receive operation that was started with
146- // StartLogsReceiveOp .
147- func (rec * Receiver ) EndLogsReceiveOp (
127+ // EndLogsOp completes the receive operation that was started with
128+ // StartLogsOp .
129+ func (rec * Receiver ) EndLogsOp (
148130 receiverCtx context.Context ,
149131 format string ,
150132 numReceivedLogRecords int ,
151133 err error ,
152134) {
153- rec .endReceiveOp (
154- receiverCtx ,
155- format ,
156- numReceivedLogRecords ,
157- err ,
158- config .LogsDataType ,
159- )
135+ rec .endOp (receiverCtx , format , numReceivedLogRecords , err , config .LogsDataType )
160136}
161137
162- // StartMetricsReceiveOp is called when a request is received from a client.
138+ // StartMetricsOp is called when a request is received from a client.
163139// The returned context should be used in other calls to the obsreport functions
164140// dealing with the same receive operation.
165- func (rec * Receiver ) StartMetricsReceiveOp (
166- operationCtx context.Context ,
167- opt ... StartReceiveOption ,
168- ) context.Context {
169- return rec .traceReceiveOp (
170- operationCtx ,
171- obsmetrics .ReceiverMetricsOperationSuffix ,
172- opt ... )
141+ func (rec * Receiver ) StartMetricsOp (operationCtx context.Context , opt ... StartReceiveOption ) context.Context {
142+ return rec .startOp (operationCtx , obsmetrics .ReceiverMetricsOperationSuffix , opt ... )
173143}
174144
175- // EndMetricsReceiveOp completes the receive operation that was started with
176- // StartMetricsReceiveOp .
177- func (rec * Receiver ) EndMetricsReceiveOp (
145+ // EndMetricsOp completes the receive operation that was started with
146+ // StartMetricsOp .
147+ func (rec * Receiver ) EndMetricsOp (
178148 receiverCtx context.Context ,
179149 format string ,
180150 numReceivedPoints int ,
181151 err error ,
182152) {
183- rec .endReceiveOp (
184- receiverCtx ,
185- format ,
186- numReceivedPoints ,
187- err ,
188- config .MetricsDataType ,
189- )
153+ rec .endOp (receiverCtx , format , numReceivedPoints , err , config .MetricsDataType )
190154}
191155
192156// ReceiverContext adds the keys used when recording observability metrics to
@@ -205,9 +169,9 @@ func ReceiverContext(
205169 return ctx
206170}
207171
208- // traceReceiveOp creates the span used to trace the operation. Returning
172+ // startOp creates the span used to trace the operation. Returning
209173// the updated context with the created span.
210- func (rec * Receiver ) traceReceiveOp (
174+ func (rec * Receiver ) startOp (
211175 receiverCtx context.Context ,
212176 operationSuffix string ,
213177 opt ... StartReceiveOption ,
@@ -224,7 +188,7 @@ func (rec *Receiver) traceReceiveOp(
224188 ctx , span = trace .StartSpan (receiverCtx , spanName )
225189 } else {
226190 // Since the receiverCtx is long lived do not use it to start the span.
227- // This way this trace ends when the EndTraceDataReceiveOp is called.
191+ // This way this trace ends when the EndTracesOp is called.
228192 // Here is safe to ignore the returned context since it is not used below.
229193 _ , span = trace .StartSpan (context .Background (), spanName )
230194
@@ -240,8 +204,8 @@ func (rec *Receiver) traceReceiveOp(
240204 return ctx
241205}
242206
243- // endReceiveOp records the observability signals at the end of an operation.
244- func (rec * Receiver ) endReceiveOp (
207+ // endOp records the observability signals at the end of an operation.
208+ func (rec * Receiver ) endOp (
245209 receiverCtx context.Context ,
246210 format string ,
247211 numReceivedItems int ,
0 commit comments