kotel

package module
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

README

KrakenD OpenTelemetry (krakend-otel)

OpenTelemetry building blocks to instrument KrakenD and Lura based API Gateways.

Apache License 2.0

Documentation:

Example

For a quick look at the observability the library can provide, check the example documentation.

Configuration from Lura's ServiceConfig

In order to configure the open telemetry stack to instrument the API Gateway, a new entry must be added to the ExtraConfig root propertry of ServiceConfig using the telemetry/opentelemetry key, with the krakend-otel's configuration.

See the configuration of the component.

In a visual way, this is the relation between the exporters configuration, and how we select as metric_providers or trace_providers:

krakend_otel_exporters.svg

Layers, Traces and Metrics

The most up to date documentation about the different supported layers, and the produced metrics and traces is available in the Understanding OpenTelemetry layers and metrics documentation.

We can differentiate the processing of a request in KrakenD in 3 main stages (each one including or wrapping the inner stage):

Additional information

Documentation

Overview

Package kotel adds opentelemetry instrumentation to a KrakenD instance (or some other [Lura](https://github.com/luraproject/lura) based softawre)

In the KrakenD project, we can differentiate 3 main stages in the process of handling a request:

  • the "router" stage: the part where the router plugins are run, and is the part from receiving the request, up to the point where the request enters the Lura's pipeline.
  • the "proxy" stage: is for the processing endpoint part, up to the point
  • the "backend" stage: is the part for each one of the backends that will be used for a given endpoint.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(ctx context.Context, l logging.Logger, srvCfg lconfig.ServiceConfig) (func(), error)

Register uses the ServiceConfig to instantiate the configured exporters. It also sets the global exporter instances, the global propagation method, and the global KrakenD otel state, so it can be used from anywhere.

func RegisterGlobalInstance

func RegisterGlobalInstance(ctx context.Context, l logging.Logger,
	me map[string]exporter.MetricReader, te map[string]exporter.SpanExporter,
	metricReportingPeriod int, traceSampleRate float64, serviceName string, serviceVersion string,
) (func(), error)

RegisterGlobalInstance creates the instance that will be used to report metrics and traces

func RegisterWithConfig

func RegisterWithConfig(ctx context.Context, l logging.Logger, cfg *config.ConfigData) (func(), error)

RegisterWithConfig instantiates the configured exporters from an already parsed config: sets the global exporter instances, the global propagation method, and the global KrakenD otel state, so it can be used from anywhere.

Types

This section is empty.

Directories

Path Synopsis
Package config defines the configuration to be used to setup the metrics and traces for each stage of a KrakenD instances as well as the level of detail we want for each stage.
Package config defines the configuration to be used to setup the metrics and traces for each stage of a KrakenD instances as well as the level of detail we want for each stage.
example
server
Srv creates a few basic routes to test the configured instrumentation.
Srv creates a few basic routes to test the configured instrumentation.
Package exporter defines the interfaces required to implement in order to add additional exporters.
Package exporter defines the interfaces required to implement in order to add additional exporters.
otelcollector
Package otelcollector implements the Open Telemetry exporter.
Package otelcollector implements the Open Telemetry exporter.
prometheus
Package prometheus implements a Prometheus metrics exporter.
Package prometheus implements a Prometheus metrics exporter.
client
Package client provides the instrumentation for an http client.
Package client provides the instrumentation for an http client.
Package otelio implements the instrumentation around the io.Reader and io.Writer.
Package otelio implements the instrumentation around the io.Reader and io.Writer.
router
gin
Package state provides the functionality to "pack" into a single structure a set of configured instances (exporters, meters, tracers...)
Package state provides the functionality to "pack" into a single structure a set of configured instances (exporters, meters, tracers...)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL