Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions internal/component/otelcol/connector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,26 @@ func (p *Connector) Update(args component.Arguments) error {
components = append(components, tracesConnector)
}
}
case ConnectorLogsToMetrics:
if len(next.Traces) > 0 || len(next.Logs) > 0 {
return errors.New("this connector can only output metrics")
}

if len(next.Metrics) > 0 {
fanout := fanoutconsumer.Metrics(next.Metrics)
metricsInterceptor := interceptconsumer.Metrics(fanout,
func(ctx context.Context, md pmetric.Metrics) error {
livedebuggingpublisher.PublishMetricsIfActive(p.debugDataPublisher, p.opts.ID, md, otelcol.GetComponentMetadata(next.Metrics))
return fanout.ConsumeMetrics(ctx, md)
},
)
logsConnector, err = p.factory.CreateLogsToMetrics(p.ctx, settings, connectorConfig, metricsInterceptor)
if err != nil && !errors.Is(err, pipeline.ErrSignalNotSupported) {
return err
} else if logsConnector != nil {
components = append(components, logsConnector)
}
}
default:
return errors.New("unsupported connector type")
}
Expand Down
Loading