Debian Codegraph @

component/host.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 package component // import "go.opentelemetry.io/collector/component"
5
6 // Host represents the entity that is hosting a Component. It is used to allow communication
7 // between the Component and its host (normally the service.Collector is the host).
8 //
9 // Components may require `component.Host` to implement additional interfaces to properly function.
10 // The component is expected to cast the `component.Host` to the interface it needs and return
11 // an error if the type assertion fails.
12 type Host interface {
13 // GetExtensions returns the map of extensions. Only enabled and created extensions will be returned.
14 // Typically, it is used to find an extension by type or by full config name. Both cases
15 // can be done by iterating the returned map. There are typically very few extensions,
16 // so there are no performance implications due to iteration.
17 //
18 // GetExtensions can be called by the component anytime after Component.Start() begins and
19 // until Component.Shutdown() ends.
20 //
21 // The returned map should only be nil if the host does not support extensions at all.
22 GetExtensions() map[ID]Component
23 }