Debian Codegraph @

extension/extensioncapabilities/interfaces.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 // Package extensioncapabilities provides interfaces that can be implemented by extensions
5 // to provide additional capabilities.
6 package extensioncapabilities // import "go.opentelemetry.io/collector/extension/extensioncapabilities"
7
8 import (
9 "context"
10
11 "go.opentelemetry.io/collector/component"
12 "go.opentelemetry.io/collector/confmap"
13 "go.opentelemetry.io/collector/extension"
14 )
15
16 // Dependent is an optional interface that can be implemented by extensions
17 // that depend on other extensions and must be started only after their dependencies.
18 // See https://github.com/open-telemetry/opentelemetry-collector/pull/8768 for examples.
19 type Dependent interface {
20 extension.Extension
21 Dependencies() []component.ID
22 }
23
24 // PipelineWatcher is an extra interface for Extension hosted by the OpenTelemetry
25 // Collector that is to be implemented by extensions interested in changes to pipeline
26 // states. Typically this will be used by extensions that change their behavior if data is
27 // being ingested or not, e.g.: a k8s readiness probe.
28 type PipelineWatcher interface {
29 // Ready notifies the Extension that all pipelines were built and the
30 // receivers were started, i.e.: the service is ready to receive data
31 // (note that it may already have received data when this method is called).
32 Ready() error
33
34 // NotReady notifies the Extension that all receivers are about to be stopped,
35 // i.e.: pipeline receivers will not accept new data.
36 // This is sent before receivers are stopped, so the Extension can take any
37 // appropriate actions before that happens.
38 NotReady() error
39 }
40
41 // ConfigWatcher is an interface that should be implemented by an extension that
42 // wishes to be notified of the Collector's effective configuration.
43 type ConfigWatcher interface {
44 // NotifyConfig notifies the extension of the Collector's current effective configuration.
45 // The extension owns the `confmap.Conf`. Callers must ensure that it's safe for
46 // extensions to store the `conf` pointer and use it concurrently with any other
47 // instances of `conf`.
48 NotifyConfig(ctx context.Context, conf *confmap.Conf) error
49 }