config

package
v0.1.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OTELConfig

type OTELConfig struct {
	// Service metadata
	ServiceName    string            `json:"service_name" yaml:"service_name"`
	ServiceVersion string            `json:"service_version" yaml:"service_version"`
	Environment    string            `json:"environment" yaml:"environment"`
	ResourceAttrs  map[string]string `json:"resource_attributes" yaml:"resource_attributes"`

	// Instrumentations to enable (per language these map to specific packages)
	Instrumentations []string `json:"instrumentations" yaml:"instrumentations"`

	// Context propagation
	Propagators []string `json:"propagators" yaml:"propagators"`

	// Sampling configuration
	Sampler struct {
		Type   string   `json:"type" yaml:"type"`     // e.g., always_on, always_off, traceidratio
		Ratio  float64  `json:"ratio" yaml:"ratio"`   // used for ratio-based samplers
		Parent string   `json:"parent" yaml:"parent"` // reserved for parentbased variants
		Rules  []string `json:"rules" yaml:"rules"`   // reserved for advanced/language-specific
	} `json:"sampler" yaml:"sampler"`

	// Exporters and endpoints
	Exporters struct {
		Traces struct {
			Type      string            `json:"type" yaml:"type"`         // e.g., otlp, console, jaeger (only otlp supported in templates for now)
			Protocol  string            `json:"protocol" yaml:"protocol"` // http/http+protobuf, grpc
			Endpoint  string            `json:"endpoint" yaml:"endpoint"`
			Headers   map[string]string `json:"headers" yaml:"headers"`
			Insecure  bool              `json:"insecure" yaml:"insecure"`
			TimeoutMs int               `json:"timeout_ms" yaml:"timeout_ms"`
		} `json:"traces" yaml:"traces"`
		Metrics struct {
			Type     string `json:"type" yaml:"type"`
			Protocol string `json:"protocol" yaml:"protocol"`
			Endpoint string `json:"endpoint" yaml:"endpoint"`
			Insecure bool   `json:"insecure" yaml:"insecure"`
		} `json:"metrics" yaml:"metrics"`
		Logs struct {
			Type     string `json:"type" yaml:"type"`
			Protocol string `json:"protocol" yaml:"protocol"`
			Endpoint string `json:"endpoint" yaml:"endpoint"`
			Insecure bool   `json:"insecure" yaml:"insecure"`
		} `json:"logs" yaml:"logs"`
	} `json:"exporters" yaml:"exporters"`

	// Span processors and additional SDK knobs
	SpanProcessors []string          `json:"span_processors" yaml:"span_processors"`
	SDK            map[string]string `json:"sdk" yaml:"sdk"`
}

OTELConfig represents advanced OpenTelemetry configuration that can be provided via a YAML file and applied across languages.

func LoadOTELConfig

func LoadOTELConfig(yamlContent []byte) (*OTELConfig, error)

LoadOTELConfig parses YAML content into an OTELConfig.

func (*OTELConfig) Validate

func (c *OTELConfig) Validate() error

Validate checks the configuration for common mistakes and unsupported values.

Jump to

Keyboard shortcuts

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