Debian Codegraph @

service/internal/graph/graph.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 // Package graph contains the internal graph representation of the pipelines.
5 //
6 // [Build] is the constructor for a [Graph] object. The method calls out to helpers that transform the graph from a config
7 // to a DAG of components. The configuration undergoes additional validation here as well, and is used to instantiate
8 // the components of the pipeline.
9 //
10 // [Graph.StartAll] starts all components in each pipeline.
11 //
12 // [Graph.ShutdownAll] stops all components in each pipeline.
13 package graph // import "go.opentelemetry.io/collector/service/internal/graph"
14
15 import (
16 "context"
17 "errors"
18 "fmt"
19 "strings"
20
21 "go.uber.org/multierr"
22 "go.uber.org/zap"
23 "gonum.org/v1/gonum/graph"
24 "gonum.org/v1/gonum/graph/simple"
25 "gonum.org/v1/gonum/graph/topo"
26
27 "go.opentelemetry.io/collector/component"
28 "go.opentelemetry.io/collector/component/componentstatus"
29 "go.opentelemetry.io/collector/connector"
30 "go.opentelemetry.io/collector/connector/xconnector"
31 "go.opentelemetry.io/collector/consumer"
32 "go.opentelemetry.io/collector/consumer/xconsumer"
33 "go.opentelemetry.io/collector/internal/fanoutconsumer"
34 "go.opentelemetry.io/collector/pipeline"
35 "go.opentelemetry.io/collector/pipeline/xpipeline"
36 "go.opentelemetry.io/collector/service/hostcapabilities"
37 "go.opentelemetry.io/collector/service/internal/builders"
38 "go.opentelemetry.io/collector/service/internal/capabilityconsumer"
39 "go.opentelemetry.io/collector/service/internal/status"
40 "go.opentelemetry.io/collector/service/pipelines"
41 )
42
43 // Settings holds configuration for building builtPipelines.
44 type Settings struct {
45 Telemetry component.TelemetrySettings
46 BuildInfo component.BuildInfo
47
48 ReceiverBuilder *builders.ReceiverBuilder
49 ProcessorBuilder *builders.ProcessorBuilder
50 ExporterBuilder *builders.ExporterBuilder
51 ConnectorBuilder *builders.ConnectorBuilder
52
53 // PipelineConfigs is a map of component.ID to PipelineConfig.
54 PipelineConfigs pipelines.Config
55
56 ReportStatus status.ServiceStatusFunc
57 }
58
59 type Graph struct {
60 // All component instances represented as nodes, with directed edges indicating data flow.
61 componentGraph *simple.DirectedGraph
62
63 // Keep track of how nodes relate to pipelines, so we can declare edges in the graph.
64 pipelines map[pipeline.ID]*pipelineNodes
65
66 // Keep track of status source per node
67 instanceIDs map[int64]*componentstatus.InstanceID
68
69 telemetry component.TelemetrySettings
70 }
71
72 // Build builds a full pipeline graph.
73 // Build also validates the configuration of the pipelines and does the actual initialization of each Component in the Graph.
74 func Build(ctx context.Context, set Settings) (*Graph, error) {
75 pipelines := &Graph{
76 componentGraph: simple.NewDirectedGraph(),
77 pipelines: make(map[pipeline.ID]*pipelineNodes, len(set.PipelineConfigs)),
78 instanceIDs: make(map[int64]*componentstatus.InstanceID),
79 telemetry: set.Telemetry,
80 }
81 for pipelineID := range set.PipelineConfigs {
82 pipelines.pipelines[pipelineID] = &pipelineNodes{
83 receivers: make(map[int64]graph.Node),
84 exporters: make(map[int64]graph.Node),
85 }
86 }
87 if err := pipelines.createNodes(set); err != nil {
88 return nil, err
89 }
90 pipelines.createEdges()
91 err := pipelines.buildComponents(ctx, set)
92 return pipelines, err
93 }
94
95 // Creates a node for each instance of a component and adds it to the graph.
96 // Validates that connectors are configured to export and receive correctly.
97 func (g *Graph) createNodes(set Settings) error {
98 // Build a list of all connectors for easy reference.
99 connectors := make(map[component.ID]struct{})
100
101 // Keep track of connectors and where they are used. (map[connectorID][]pipelineID).
102 connectorsAsExporter := make(map[component.ID][]pipeline.ID)
103 connectorsAsReceiver := make(map[component.ID][]pipeline.ID)
104
105 // Build each pipelineNodes struct for each pipeline by parsing the pipelineCfg.
106 // Also populates the connectors, connectorsAsExporter and connectorsAsReceiver maps.
107 for pipelineID, pipelineCfg := range set.PipelineConfigs {
108 pipe := g.pipelines[pipelineID]
109 for _, recvID := range pipelineCfg.Receivers {
110 // Checks if this receiver is a connector or a regular receiver.
111 if set.ConnectorBuilder.IsConfigured(recvID) {
112 connectors[recvID] = struct{}{}
113 connectorsAsReceiver[recvID] = append(connectorsAsReceiver[recvID], pipelineID)
114 continue
115 }
116 rcvrNode := g.createReceiver(pipelineID, recvID)
117 pipe.receivers[rcvrNode.ID()] = rcvrNode
118 }
119
120 pipe.capabilitiesNode = newCapabilitiesNode(pipelineID)
121
122 for _, procID := range pipelineCfg.Processors {
123 procNode := g.createProcessor(pipelineID, procID)
124 pipe.processors = append(pipe.processors, procNode)
125 }
126
127 pipe.fanOutNode = newFanOutNode(pipelineID)
128
129 for _, exprID := range pipelineCfg.Exporters {
130 if set.ConnectorBuilder.IsConfigured(exprID) {
131 connectors[exprID] = struct{}{}
132 connectorsAsExporter[exprID] = append(connectorsAsExporter[exprID], pipelineID)
133 continue
134 }
135 expNode := g.createExporter(pipelineID, exprID)
136 pipe.exporters[expNode.ID()] = expNode
137 }
138 }
139
140 for connID := range connectors {
141 factory := set.ConnectorBuilder.Factory(connID.Type())
142 if factory == nil {
143 return fmt.Errorf("connector factory not available for: %q", connID.Type())
144 }
145 connFactory := factory.(connector.Factory)
146
147 expTypes := make(map[pipeline.Signal]bool)
148 for _, pipelineID := range connectorsAsExporter[connID] {
149 // The presence of each key indicates how the connector is used as an exporter.
150 // The value is initially set to false. Later we will set the value to true *if* we
151 // confirm that there is a supported corresponding use as a receiver.
152 expTypes[pipelineID.Signal()] = false
153 }
154 recTypes := make(map[pipeline.Signal]bool)
155 for _, pipelineID := range connectorsAsReceiver[connID] {
156 // The presence of each key indicates how the connector is used as a receiver.
157 // The value is initially set to false. Later we will set the value to true *if* we
158 // confirm that there is a supported corresponding use as an exporter.
159 recTypes[pipelineID.Signal()] = false
160 }
161
162 for expType := range expTypes {
163 for recType := range recTypes {
164 // Typechecks the connector's receiving and exporting datatypes.
165 if connectorStability(connFactory, expType, recType) != component.StabilityLevelUndefined {
166 expTypes[expType] = true
167 recTypes[recType] = true
168 }
169 }
170 }
171
172 for expType, supportedUse := range expTypes {
173 if supportedUse {
174 continue
175 }
176 return fmt.Errorf("connector %q used as exporter in %v pipeline but not used in any supported receiver pipeline", connID, formatPipelineNamesWithSignal(connectorsAsExporter[connID], expType))
177 }
178 for recType, supportedUse := range recTypes {
179 if supportedUse {
180 continue
181 }
182 return fmt.Errorf("connector %q used as receiver in %v pipeline but not used in any supported exporter pipeline", connID, formatPipelineNamesWithSignal(connectorsAsReceiver[connID], recType))
183 }
184
185 for _, eID := range connectorsAsExporter[connID] {
186 for _, rID := range connectorsAsReceiver[connID] {
187 if connectorStability(connFactory, eID.Signal(), rID.Signal()) == component.StabilityLevelUndefined {
188 // Connector is not supported for this combination, but we know it is used correctly elsewhere
189 continue
190 }
191 connNode := g.createConnector(eID, rID, connID)
192
193 g.pipelines[eID].exporters[connNode.ID()] = connNode
194 g.pipelines[rID].receivers[connNode.ID()] = connNode
195 }
196 }
197 }
198 return nil
199 }
200
201 // formatPipelineNamesWithSignal formats pipeline name with signal as "signal[/name]" format.
202 func formatPipelineNamesWithSignal(pipelineIDs []pipeline.ID, signal pipeline.Signal) []string {
203 var formatted []string
204 for _, pid := range pipelineIDs {
205 if pid.Signal() == signal {
206 formatted = append(formatted, pid.String())
207 }
208 }
209 return formatted
210 }
211
212 func (g *Graph) createReceiver(pipelineID pipeline.ID, recvID component.ID) *receiverNode {
213 rcvrNode := newReceiverNode(pipelineID.Signal(), recvID)
214 if node := g.componentGraph.Node(rcvrNode.ID()); node != nil {
215 instanceID := g.instanceIDs[node.ID()]
216 g.instanceIDs[node.ID()] = instanceID.WithPipelines(pipelineID)
217 return node.(*receiverNode)
218 }
219 g.componentGraph.AddNode(rcvrNode)
220 g.instanceIDs[rcvrNode.ID()] = componentstatus.NewInstanceID(
221 recvID, component.KindReceiver, pipelineID,
222 )
223 return rcvrNode
224 }
225
226 func (g *Graph) createProcessor(pipelineID pipeline.ID, procID component.ID) *processorNode {
227 procNode := newProcessorNode(pipelineID, procID)
228 g.componentGraph.AddNode(procNode)
229 g.instanceIDs[procNode.ID()] = componentstatus.NewInstanceID(
230 procID, component.KindProcessor, pipelineID,
231 )
232 return procNode
233 }
234
235 func (g *Graph) createExporter(pipelineID pipeline.ID, exprID component.ID) *exporterNode {
236 expNode := newExporterNode(pipelineID.Signal(), exprID)
237 if node := g.componentGraph.Node(expNode.ID()); node != nil {
238 instanceID := g.instanceIDs[expNode.ID()]
239 g.instanceIDs[expNode.ID()] = instanceID.WithPipelines(pipelineID)
240 return node.(*exporterNode)
241 }
242 g.componentGraph.AddNode(expNode)
243 g.instanceIDs[expNode.ID()] = componentstatus.NewInstanceID(
244 expNode.componentID, component.KindExporter, pipelineID,
245 )
246 return expNode
247 }
248
249 func (g *Graph) createConnector(exprPipelineID, rcvrPipelineID pipeline.ID, connID component.ID) *connectorNode {
250 connNode := newConnectorNode(exprPipelineID.Signal(), rcvrPipelineID.Signal(), connID)
251 if node := g.componentGraph.Node(connNode.ID()); node != nil {
252 instanceID := g.instanceIDs[connNode.ID()]
253 g.instanceIDs[connNode.ID()] = instanceID.WithPipelines(exprPipelineID, rcvrPipelineID)
254 return node.(*connectorNode)
255 }
256 g.componentGraph.AddNode(connNode)
257 g.instanceIDs[connNode.ID()] = componentstatus.NewInstanceID(
258 connNode.componentID, component.KindConnector, exprPipelineID, rcvrPipelineID,
259 )
260 return connNode
261 }
262
263 // Iterates through the pipelines and creates edges between components.
264 func (g *Graph) createEdges() {
265 for _, pg := range g.pipelines {
266 // Draw edges from each receiver to the capability node.
267 for _, receiver := range pg.receivers {
268 g.componentGraph.SetEdge(g.componentGraph.NewEdge(receiver, pg.capabilitiesNode))
269 }
270
271 // Iterates through processors, chaining them together. starts with the capabilities node.
272 var from, to graph.Node
273 from = pg.capabilitiesNode
274 for _, processor := range pg.processors {
275 to = processor
276 g.componentGraph.SetEdge(g.componentGraph.NewEdge(from, to))
277 from = processor
278 }
279 // Always inserts a fanout node before any exporters. If there is only one
280 // exporter, the fanout node is still created and acts as a noop.
281 to = pg.fanOutNode
282 g.componentGraph.SetEdge(g.componentGraph.NewEdge(from, to))
283
284 for _, exporter := range pg.exporters {
285 g.componentGraph.SetEdge(g.componentGraph.NewEdge(pg.fanOutNode, exporter))
286 }
287 }
288 }
289
290 // Uses the already built graph g to instantiate the actual components for each component of each pipeline.
291 // Handles calling the factories for each component - and hooking up each component to the next.
292 // Also calculates whether each pipeline mutates data so the receiver can know whether it needs to clone the data.
293 func (g *Graph) buildComponents(ctx context.Context, set Settings) error {
294 nodes, err := topo.Sort(g.componentGraph)
295 if err != nil {
296 return cycleErr(err, topo.DirectedCyclesIn(g.componentGraph))
297 }
298
299 for i := len(nodes) - 1; i >= 0; i-- {
300 node := nodes[i]
301
302 switch n := node.(type) {
303 case *receiverNode:
304 err = n.buildComponent(ctx, set.Telemetry, set.BuildInfo, set.ReceiverBuilder, g.nextConsumers(n.ID()))
305 case *processorNode:
306 // nextConsumers is guaranteed to be length 1. Either it is the next processor or it is the fanout node for the exporters.
307 err = n.buildComponent(ctx, set.Telemetry, set.BuildInfo, set.ProcessorBuilder, g.nextConsumers(n.ID())[0])
308 case *exporterNode:
309 err = n.buildComponent(ctx, set.Telemetry, set.BuildInfo, set.ExporterBuilder)
310 case *connectorNode:
311 err = n.buildComponent(ctx, set.Telemetry, set.BuildInfo, set.ConnectorBuilder, g.nextConsumers(n.ID()))
312 case *capabilitiesNode:
313 capability := consumer.Capabilities{
314 // The fanOutNode represents the aggregate capabilities of the exporters in the pipeline.
315 MutatesData: g.pipelines[n.pipelineID].fanOutNode.getConsumer().Capabilities().MutatesData,
316 }
317 for _, proc := range g.pipelines[n.pipelineID].processors {
318 capability.MutatesData = capability.MutatesData || proc.(*processorNode).getConsumer().Capabilities().MutatesData
319 }
320 next := g.nextConsumers(n.ID())[0]
321 switch n.pipelineID.Signal() {
322 case pipeline.SignalTraces:
323 cc := capabilityconsumer.NewTraces(next.(consumer.Traces), capability)
324 n.baseConsumer = cc
325 n.ConsumeTracesFunc = cc.ConsumeTraces
326 case pipeline.SignalMetrics:
327 cc := capabilityconsumer.NewMetrics(next.(consumer.Metrics), capability)
328 n.baseConsumer = cc
329 n.ConsumeMetricsFunc = cc.ConsumeMetrics
330 case pipeline.SignalLogs:
331 cc := capabilityconsumer.NewLogs(next.(consumer.Logs), capability)
332 n.baseConsumer = cc
333 n.ConsumeLogsFunc = cc.ConsumeLogs
334 case xpipeline.SignalProfiles:
335 cc := capabilityconsumer.NewProfiles(next.(xconsumer.Profiles), capability)
336 n.baseConsumer = cc
337 n.ConsumeProfilesFunc = cc.ConsumeProfiles
338 }
339 case *fanOutNode:
340 nexts := g.nextConsumers(n.ID())
341 switch n.pipelineID.Signal() {
342 case pipeline.SignalTraces:
343 consumers := make([]consumer.Traces, 0, len(nexts))
344 for _, next := range nexts {
345 consumers = append(consumers, next.(consumer.Traces))
346 }
347 n.baseConsumer = fanoutconsumer.NewTraces(consumers)
348 case pipeline.SignalMetrics:
349 consumers := make([]consumer.Metrics, 0, len(nexts))
350 for _, next := range nexts {
351 consumers = append(consumers, next.(consumer.Metrics))
352 }
353 n.baseConsumer = fanoutconsumer.NewMetrics(consumers)
354 case pipeline.SignalLogs:
355 consumers := make([]consumer.Logs, 0, len(nexts))
356 for _, next := range nexts {
357 consumers = append(consumers, next.(consumer.Logs))
358 }
359 n.baseConsumer = fanoutconsumer.NewLogs(consumers)
360 case xpipeline.SignalProfiles:
361 consumers := make([]xconsumer.Profiles, 0, len(nexts))
362 for _, next := range nexts {
363 consumers = append(consumers, next.(xconsumer.Profiles))
364 }
365 n.baseConsumer = fanoutconsumer.NewProfiles(consumers)
366 }
367 }
368 if err != nil {
369 return err
370 }
371 }
372 return nil
373 }
374
375 // Find all nodes
376 func (g *Graph) nextConsumers(nodeID int64) []baseConsumer {
377 nextNodes := g.componentGraph.From(nodeID)
378 nexts := make([]baseConsumer, 0, nextNodes.Len())
379 for nextNodes.Next() {
380 nexts = append(nexts, nextNodes.Node().(consumerNode).getConsumer())
381 }
382 return nexts
383 }
384
385 // A node-based representation of a pipeline configuration.
386 type pipelineNodes struct {
387 // Use map to assist with deduplication of connector instances.
388 receivers map[int64]graph.Node
389
390 // The node to which receivers emit. Passes through to processors.
391 // Easily accessible as the first node in a pipeline.
392 *capabilitiesNode
393
394 // The order of processors is very important. Therefore use a slice for processors.
395 processors []graph.Node
396
397 // Emits to exporters.
398 *fanOutNode
399
400 // Use map to assist with deduplication of connector instances.
401 exporters map[int64]graph.Node
402 }
403
404 func (g *Graph) StartAll(ctx context.Context, host *Host) error {
405 if host == nil {
406 return errors.New("host cannot be nil")
407 }
408
409 nodes, err := topo.Sort(g.componentGraph)
410 if err != nil {
411 return err
412 }
413
414 // Start in reverse topological order so that downstream components
415 // are started before upstream components. This ensures that each
416 // component's consumer is ready to consume.
417 for i := len(nodes) - 1; i >= 0; i-- {
418 node := nodes[i]
419 comp, ok := node.(component.Component)
420
421 if !ok {
422 // Skip capabilities/fanout nodes
423 continue
424 }
425
426 instanceID := g.instanceIDs[node.ID()]
427 host.Reporter.ReportStatus(
428 instanceID,
429 componentstatus.NewEvent(componentstatus.StatusStarting),
430 )
431
432 if compErr := comp.Start(ctx, &HostWrapper{Host: host, InstanceID: instanceID}); compErr != nil {
433 host.Reporter.ReportStatus(
434 instanceID,
435 componentstatus.NewPermanentErrorEvent(compErr),
436 )
437 // We log with zap.AddStacktrace(zap.DPanicLevel) to avoid adding the stack trace to the error log
438 g.telemetry.Logger.WithOptions(zap.AddStacktrace(zap.DPanicLevel)).
439 Error("Failed to start component",
440 zap.Error(compErr),
441 zap.String("type", instanceID.Kind().String()),
442 zap.String("id", instanceID.ComponentID().String()),
443 )
444 return fmt.Errorf("failed to start %q %s: %w", instanceID.ComponentID().String(), strings.ToLower(instanceID.Kind().String()), compErr)
445 }
446
447 host.Reporter.ReportOKIfStarting(instanceID)
448 }
449 return nil
450 }
451
452 func (g *Graph) ShutdownAll(ctx context.Context, reporter status.Reporter) error {
453 nodes, err := topo.Sort(g.componentGraph)
454 if err != nil {
455 return err
456 }
457
458 // Stop in topological order so that upstream components
459 // are stopped before downstream components. This ensures
460 // that each component has a chance to drain to its consumer
461 // before the consumer is stopped.
462 var errs error
463 for i := range nodes {
464 node := nodes[i]
465 comp, ok := node.(component.Component)
466
467 if !ok {
468 // Skip capabilities/fanout nodes
469 continue
470 }
471
472 instanceID := g.instanceIDs[node.ID()]
473 reporter.ReportStatus(
474 instanceID,
475 componentstatus.NewEvent(componentstatus.StatusStopping),
476 )
477
478 if compErr := comp.Shutdown(ctx); compErr != nil {
479 errs = multierr.Append(errs, compErr)
480 reporter.ReportStatus(
481 instanceID,
482 componentstatus.NewPermanentErrorEvent(compErr),
483 )
484 continue
485 }
486
487 reporter.ReportStatus(
488 instanceID,
489 componentstatus.NewEvent(componentstatus.StatusStopped),
490 )
491 }
492 return errs
493 }
494
495 func (g *Graph) GetExporters() map[pipeline.Signal]map[component.ID]component.Component {
496 exportersMap := make(map[pipeline.Signal]map[component.ID]component.Component)
497 exportersMap[pipeline.SignalTraces] = make(map[component.ID]component.Component)
498 exportersMap[pipeline.SignalMetrics] = make(map[component.ID]component.Component)
499 exportersMap[pipeline.SignalLogs] = make(map[component.ID]component.Component)
500 exportersMap[xpipeline.SignalProfiles] = make(map[component.ID]component.Component)
501
502 for _, pg := range g.pipelines {
503 for _, expNode := range pg.exporters {
504 // Skip connectors, otherwise individual components can introduce cycles
505 if expNode, ok := g.componentGraph.Node(expNode.ID()).(*exporterNode); ok {
506 exportersMap[expNode.pipelineType][expNode.componentID] = expNode.Component
507 }
508 }
509 }
510 return exportersMap
511 }
512
513 func cycleErr(err error, cycles [][]graph.Node) error {
514 var topoErr topo.Unorderable
515 if !errors.As(err, &topoErr) || len(cycles) == 0 || len(cycles[0]) == 0 {
516 return err
517 }
518
519 // There may be multiple cycles, but report only the first one.
520 cycle := cycles[0]
521
522 // The last node is a duplicate of the first node.
523 // Remove it because we may start from a different node.
524 cycle = cycle[:len(cycle)-1]
525
526 // A cycle always contains a connector. For the sake of consistent
527 // error messages report the cycle starting from a connector.
528 for i := 0; i < len(cycle); i++ {
529 if _, ok := cycle[i].(*connectorNode); ok {
530 cycle = append(cycle[i:], cycle[:i]...)
531 break
532 }
533 }
534
535 // Repeat the first node at the end to clarify the cycle
536 cycle = append(cycle, cycle[0])
537
538 // Build the error message
539 componentDetails := make([]string, 0, len(cycle))
540 for _, node := range cycle {
541 switch n := node.(type) {
542 case *processorNode:
543 componentDetails = append(componentDetails, fmt.Sprintf("processor %q in pipeline %q", n.componentID, n.pipelineID.String()))
544 case *connectorNode:
545 componentDetails = append(componentDetails, fmt.Sprintf("connector %q (%s to %s)", n.componentID, n.exprPipelineType, n.rcvrPipelineType))
546 default:
547 continue // skip capabilities/fanout nodes
548 }
549 }
550 return fmt.Errorf("cycle detected: %s", strings.Join(componentDetails, " -> "))
551 }
552
553 func connectorStability(f connector.Factory, expType, recType pipeline.Signal) component.StabilityLevel {
554 switch expType {
555 case pipeline.SignalTraces:
556 switch recType {
557 case pipeline.SignalTraces:
558 return f.TracesToTracesStability()
559 case pipeline.SignalMetrics:
560 return f.TracesToMetricsStability()
561 case pipeline.SignalLogs:
562 return f.TracesToLogsStability()
563 case xpipeline.SignalProfiles:
564 fprof, ok := f.(xconnector.Factory)
565 if !ok {
566 return component.StabilityLevelUndefined
567 }
568 return fprof.TracesToProfilesStability()
569 }
570 case pipeline.SignalMetrics:
571 switch recType {
572 case pipeline.SignalTraces:
573 return f.MetricsToTracesStability()
574 case pipeline.SignalMetrics:
575 return f.MetricsToMetricsStability()
576 case pipeline.SignalLogs:
577 return f.MetricsToLogsStability()
578 case xpipeline.SignalProfiles:
579 fprof, ok := f.(xconnector.Factory)
580 if !ok {
581 return component.StabilityLevelUndefined
582 }
583 return fprof.MetricsToProfilesStability()
584 }
585 case pipeline.SignalLogs:
586 switch recType {
587 case pipeline.SignalTraces:
588 return f.LogsToTracesStability()
589 case pipeline.SignalMetrics:
590 return f.LogsToMetricsStability()
591 case pipeline.SignalLogs:
592 return f.LogsToLogsStability()
593 case xpipeline.SignalProfiles:
594 fprof, ok := f.(xconnector.Factory)
595 if !ok {
596 return component.StabilityLevelUndefined
597 }
598 return fprof.LogsToProfilesStability()
599 }
600 case xpipeline.SignalProfiles:
601 fprof, ok := f.(xconnector.Factory)
602 if !ok {
603 return component.StabilityLevelUndefined
604 }
605 switch recType {
606 case pipeline.SignalTraces:
607 return fprof.ProfilesToTracesStability()
608 case pipeline.SignalMetrics:
609 return fprof.ProfilesToMetricsStability()
610 case pipeline.SignalLogs:
611 return fprof.ProfilesToLogsStability()
612 case xpipeline.SignalProfiles:
613 return fprof.ProfilesToProfilesStability()
614 }
615 }
616 return component.StabilityLevelUndefined
617 }
618
619 var (
620 _ component.Host = (*HostWrapper)(nil)
621 _ componentstatus.Reporter = (*HostWrapper)(nil)
622 _ hostcapabilities.ExposeExporters = (*HostWrapper)(nil) //nolint:staticcheck // SA1019
623 )
624
625 type HostWrapper struct {
626 *Host
627 InstanceID *componentstatus.InstanceID
628 }
629
630 func (host *HostWrapper) Report(event *componentstatus.Event) {
631 host.Reporter.ReportStatus(host.InstanceID, event)
632 }