otlp

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolGRPC Protocol = "grpc"
	ProtocolHTTP Protocol = "http/protobuf"

	SignalLogs   Signal = "logs"
	SignalTraces Signal = "traces"
)
View Source
const ExporterName = "otlp"

ExporterName is the registered name of the OTLP exporter template.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

type Exporter struct {
	// contains filtered or unexported fields
}

Exporter ships business events to an OTel Collector as OTLP log records through a dedicated, non-global LoggerProvider. It serves the metadata class by default and the raw class when declared under exporters.raw.

func (*Exporter) Close

func (e *Exporter) Close()

Close flushes buffered records then shuts the provider down, bounded by the configured timeout so shutdown can never hang.

func (*Exporter) DataClass added in v0.3.4

func (e *Exporter) DataClass() metrics.DataClass

DataClass reports the class this exporter is bound to. It defaults to metadata and becomes raw when SetDataClass is called at build time.

func (*Exporter) Name

func (e *Exporter) Name() string

func (*Exporter) Publish

func (e *Exporter) Publish(ctx context.Context, evt *events.Event) error

Publish maps the event to an OTLP log record and enqueues it without blocking on Collector latency. A raw-class exporter emits request/response payloads; other classes emit sanitized metadata. It errors only if already closed.

func (*Exporter) SetDataClass added in v0.3.4

func (e *Exporter) SetDataClass(class metrics.DataClass)

SetDataClass binds the exporter to a data class before it serves traffic.

type Protocol

type Protocol string

Protocol selects the OTLP transport used to reach the Collector.

type Settings

type Settings struct {
	Endpoint     string            `mapstructure:"endpoint"`
	Protocol     Protocol          `mapstructure:"protocol"`
	Signal       Signal            `mapstructure:"signal"`
	Headers      map[string]string `mapstructure:"headers"`
	Insecure     bool              `mapstructure:"insecure"`
	TLS          *TLSSettings      `mapstructure:"tls"`
	Timeout      time.Duration     `mapstructure:"timeout"`
	Compression  string            `mapstructure:"compression"`
	MaxBodyBytes int               `mapstructure:"max_body_bytes"`
}

Settings is the per-gateway configuration for the OTLP exporter, decoded from the gateway's telemetry exporter Settings map and merged with process-level OTEL_EXPORTER_OTLP_* defaults.

type Signal

type Signal string

Signal selects the OTel signal the exporter emits. Only SignalLogs is implemented; SignalTraces is reserved for a future spans exporter.

type TLSSettings

type TLSSettings struct {
	CAFile     string `mapstructure:"ca_file"`
	CertFile   string `mapstructure:"cert_file"`
	KeyFile    string `mapstructure:"key_file"`
	SkipVerify bool   `mapstructure:"skip_verify"`
}

TLSSettings configures mutual or server-only TLS for the OTLP transport.

type Template

type Template struct {
	// contains filtered or unexported fields
}

Template builds otlp.Exporter instances from per-gateway settings, falling back to process-level OTEL_EXPORTER_OTLP_* defaults.

func NewTemplate

func NewTemplate(logger *slog.Logger, envCfg config.OTLPConfig) *Template

NewTemplate returns an OTLP ExporterTemplate bound to the given logger and process-level OTEL_EXPORTER_OTLP_* defaults.

func (*Template) Name

func (t *Template) Name() string

func (*Template) ValidateConfig

func (t *Template) ValidateConfig(settings map[string]interface{}) error

ValidateConfig performs structural validation only; it never connects to the Collector.

func (*Template) WithSettings

func (t *Template) WithSettings(settings map[string]interface{}) (appmetrics.Exporter, error)

WithSettings validates the settings then builds a dedicated provider and exporter. The OTLP client connects lazily, so an unreachable Collector does not fail construction.

Jump to

Keyboard shortcuts

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