@@ -126,7 +126,13 @@ func (n *connectorNode) buildTraces(
126
126
if err != nil {
127
127
return err
128
128
}
129
- n .consumer = obsconsumer .NewLogs (n .Component .(consumer.Logs ), tb .ConnectorConsumedItems )
129
+ consumedOpts := []obsconsumer.Option {
130
+ obsconsumer .WithLogsSizeCounter (& tb .ConnectorConsumedItems ),
131
+ }
132
+ if isEnabled (tb .ConnectorConsumedSize ) {
133
+ consumedOpts = append (consumedOpts , obsconsumer .WithLogsSizeCounter (& tb .ConnectorConsumedSize ))
134
+ }
135
+ n .consumer = obsconsumer .NewLogs (n .Component .(consumer.Logs ), consumedOpts ... )
130
136
case xpipeline .SignalProfiles :
131
137
n .Component , err = builder .CreateProfilesToTraces (ctx , set , next )
132
138
if err != nil {
@@ -188,7 +194,13 @@ func (n *connectorNode) buildMetrics(
188
194
if err != nil {
189
195
return err
190
196
}
191
- n .consumer = obsconsumer .NewLogs (n .Component .(consumer.Logs ), tb .ConnectorConsumedItems )
197
+ consumedOpts := []obsconsumer.Option {
198
+ obsconsumer .WithLogsSizeCounter (& tb .ConnectorConsumedItems ),
199
+ }
200
+ if isEnabled (tb .ConnectorConsumedSize ) {
201
+ consumedOpts = append (consumedOpts , obsconsumer .WithLogsSizeCounter (& tb .ConnectorConsumedSize ))
202
+ }
203
+ n .consumer = obsconsumer .NewLogs (n .Component .(consumer.Logs ), consumedOpts ... )
192
204
case xpipeline .SignalProfiles :
193
205
n .Component , err = builder .CreateProfilesToMetrics (ctx , set , next )
194
206
if err != nil {
@@ -212,16 +224,20 @@ func (n *connectorNode) buildLogs(
212
224
213
225
consumers := make (map [pipeline.ID ]consumer.Logs , len (nexts ))
214
226
for _ , next := range nexts {
215
- consumers [next .(* capabilitiesNode ).pipelineID ] = obsconsumer .NewLogs (
216
- next .(consumer.Logs ),
217
- tb .ConnectorProducedItems ,
227
+ producedOpts := []obsconsumer.Option {
218
228
obsconsumer .WithStaticDataPointAttribute (
219
229
otelattr .String (
220
230
pipelineIDAttrKey ,
221
231
next .(* capabilitiesNode ).pipelineID .String (),
222
232
),
223
233
),
224
- )
234
+ obsconsumer .WithLogsSizeCounter (& tb .ConnectorProducedSize ),
235
+ }
236
+ if isEnabled (tb .ConnectorProducedSize ) {
237
+ producedOpts = append (producedOpts , obsconsumer .WithLogsSizeCounter (& tb .ConnectorProducedSize ))
238
+ }
239
+ consumers [next .(* capabilitiesNode ).pipelineID ] = obsconsumer .NewLogs (
240
+ next .(consumer.Logs ), producedOpts ... )
225
241
}
226
242
next := connector .NewLogsRouter (consumers )
227
243
@@ -231,13 +247,19 @@ func (n *connectorNode) buildLogs(
231
247
if err != nil {
232
248
return err
233
249
}
250
+ consumedOpts := []obsconsumer.Option {
251
+ obsconsumer .WithLogsSizeCounter (& tb .ConnectorConsumedItems ),
252
+ }
253
+ if isEnabled (tb .ConnectorConsumedSize ) {
254
+ consumedOpts = append (consumedOpts , obsconsumer .WithLogsSizeCounter (& tb .ConnectorConsumedSize ))
255
+ }
234
256
// Connectors which might pass along data must inherit capabilities of all nexts
235
257
n .consumer = obsconsumer .NewLogs (
236
258
capabilityconsumer .NewLogs (
237
259
n .Component .(consumer.Logs ),
238
260
aggregateCap (n .Component .(consumer.Logs ), nexts ),
239
261
),
240
- tb . ConnectorConsumedItems ,
262
+ consumedOpts ... ,
241
263
)
242
264
case pipeline .SignalTraces :
243
265
n .Component , err = builder .CreateTracesToLogs (ctx , set , next )
@@ -318,7 +340,13 @@ func (n *connectorNode) buildProfiles(
318
340
if err != nil {
319
341
return err
320
342
}
321
- n .consumer = obsconsumer .NewLogs (n .Component .(consumer.Logs ), tb .ConnectorConsumedItems )
343
+ consumedOpts := []obsconsumer.Option {
344
+ obsconsumer .WithLogsSizeCounter (& tb .ConnectorConsumedItems ),
345
+ }
346
+ if isEnabled (tb .ConnectorConsumedSize ) {
347
+ consumedOpts = append (consumedOpts , obsconsumer .WithLogsSizeCounter (& tb .ConnectorConsumedSize ))
348
+ }
349
+ n .consumer = obsconsumer .NewLogs (n .Component .(consumer.Logs ), consumedOpts ... )
322
350
}
323
351
return nil
324
352
}
0 commit comments