Documentation ¶
Overview ¶
Package state provides the functionality to "pack" into a single structure a set of configured instances (exporters, meters, tracers...)
Index ¶
- func SetGlobalConfig(cfg Config)
- func SetGlobalState(s *OTELState)
- type Config
- type GetterFn
- type OTEL
- type OTELState
- func (s *OTELState) Meter() metric.Meter
- func (s *OTELState) MeterProvider() metric.MeterProvider
- func (s *OTELState) Propagator() propagation.TextMapPropagator
- func (s *OTELState) Shutdown(ctx context.Context)
- func (s *OTELState) Tracer() trace.Tracer
- func (s *OTELState) TracerProvider() trace.TracerProvider
- type OTELStateConfig
- type StateConfig
- func (*StateConfig) BackendOTEL(_ *luraconfig.Backend) OTEL
- func (s *StateConfig) BackendOpts(cfg *luraconfig.Backend) *config.BackendOpts
- func (s *StateConfig) EndpointBackendOpts(cfg *luraconfig.Backend) *config.BackendOpts
- func (*StateConfig) EndpointOTEL(_ *luraconfig.EndpointConfig) OTEL
- func (s *StateConfig) EndpointPipeOpts(cfg *luraconfig.EndpointConfig) *config.PipeOpts
- func (s *StateConfig) GlobalOpts() *config.GlobalOpts
- func (*StateConfig) OTEL() OTEL
- func (s *StateConfig) SkipEndpoint(endpoint string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetGlobalConfig ¶ added in v0.2.0
func SetGlobalConfig(cfg Config)
func SetGlobalState ¶
func SetGlobalState(s *OTELState)
SetGlobalState set the provided state as the global state.
Types ¶
type Config ¶ added in v0.2.0
type Config interface { OTEL() OTEL // GlobalOpts gets the configuration at the service level. GlobalOpts() *config.GlobalOpts // Gets the OTEL instance for a given endpoint EndpointOTEL(cfg *luraconfig.EndpointConfig) OTEL // EndpointPipeOpts retrieve "proxy" level configuration for a given // endpoint. EndpointPipeOpts(cfg *luraconfig.EndpointConfig) *config.PipeOpts // EndpointBackendOpts should return a config for all the child // backend of this endpoint. // // Deprecated: the interface should only need to fetch the BackendOpts // from a luraconfig.Backend when configuring at the Backend level: // the BackendOpts function must be used instead. EndpointBackendOpts(cfg *luraconfig.Backend) *config.BackendOpts BackendOTEL(cfg *luraconfig.Backend) OTEL BackendOpts(cfg *luraconfig.Backend) *config.BackendOpts // SkipEndpoint tells if an endpoint should not be instrumented SkipEndpoint(endpoint string) bool }
func GlobalConfig ¶ added in v0.2.0
func GlobalConfig() Config
type GetterFn ¶
type GetterFn func() OTEL
GetterFn defines a function that will return an OTEL instance.
type OTEL ¶
type OTEL interface { Tracer() trace.Tracer Meter() metric.Meter Propagator() propagation.TextMapPropagator Shutdown(ctx context.Context) MeterProvider() metric.MeterProvider TracerProvider() trace.TracerProvider }
OTEL defines the interface to obtain observability instruments for a state.
type OTELState ¶
type OTELState struct {
// contains filtered or unexported fields
}
OTELState is the basic implementation of an OTEL intstance.
func NewWithVersion ¶
func NewWithVersion(serviceName string, cfg *OTELStateConfig, version string, me map[string]exporter.MetricReader, te map[string]exporter.SpanExporter, ) (*OTELState, error)
NewWithVersion create a new OTELState with a version for the KrakenD service, with the provided metrics and traces exporters
func (*OTELState) MeterProvider ¶
func (s *OTELState) MeterProvider() metric.MeterProvider
func (*OTELState) Propagator ¶
func (s *OTELState) Propagator() propagation.TextMapPropagator
Propagator returns the configured propagator to use.
func (*OTELState) Shutdown ¶
Shutdown performs the clean shutdown to be able to flush pending traces and / or metrics.
func (*OTELState) TracerProvider ¶
func (s *OTELState) TracerProvider() trace.TracerProvider
type OTELStateConfig ¶
type StateConfig ¶ added in v0.2.0
type StateConfig struct {
// contains filtered or unexported fields
}
func NewConfig ¶ added in v0.2.0
func NewConfig(cfgData *config.ConfigData) *StateConfig
func (*StateConfig) BackendOTEL ¶ added in v0.2.0
func (*StateConfig) BackendOTEL(_ *luraconfig.Backend) OTEL
func (*StateConfig) BackendOpts ¶ added in v0.2.0
func (s *StateConfig) BackendOpts(cfg *luraconfig.Backend) *config.BackendOpts
func (*StateConfig) EndpointBackendOpts ¶ added in v0.2.0
func (s *StateConfig) EndpointBackendOpts(cfg *luraconfig.Backend) *config.BackendOpts
EndpointBackendOpts is a bad interface function, as is should receive as a param a luraconfig.Endpoint .. but also makes no sense to have it because we only need the backend configuration at
func (*StateConfig) EndpointOTEL ¶ added in v0.2.0
func (*StateConfig) EndpointOTEL(_ *luraconfig.EndpointConfig) OTEL
func (*StateConfig) EndpointPipeOpts ¶ added in v0.2.0
func (s *StateConfig) EndpointPipeOpts(cfg *luraconfig.EndpointConfig) *config.PipeOpts
EndpointPipeOpts checks if there is an override for pipe ("proxy") options at the endpoint levels a fully replaces (it DOES NOT MERGE attributes) the existing config from the service level configuration. If none of those configs are found, it falls back to the defaults.
func (*StateConfig) GlobalOpts ¶ added in v0.2.0
func (s *StateConfig) GlobalOpts() *config.GlobalOpts
func (*StateConfig) OTEL ¶ added in v0.2.0
func (*StateConfig) OTEL() OTEL
func (*StateConfig) SkipEndpoint ¶ added in v0.2.0
func (s *StateConfig) SkipEndpoint(endpoint string) bool