otelcore

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package otelcore holds the OTLP/OTel export plumbing shared by GTB's analytics pipeline and its web-service observability signals: OTLP/HTTP endpoint parsing, the service resource, and telemetry.* configuration resolution.

It deliberately imports no signal exporters. Traces, metrics and logs each build their own typed exporter (otlptracehttp, otlpmetrichttp, otlploghttp) from a resolved Settings and Endpoint, so this package stays free of any single signal's dependencies and can be shared by all of them.

Index

Constants

View Source
const (
	SignalTracing = "tracing"
	SignalMetrics = "metrics"
	SignalLogs    = "logs"
)

Signal names, used both as the per-signal config sub-key (telemetry.<signal>.*) and as the OTLP URL path suffix.

View Source
const Root = "telemetry"

Root is the config key prefix shared by the analytics pipeline and the observability signals.

Variables

This section is empty.

Functions

func Resource

func Resource(name, version string) *resource.Resource

Resource builds the OTel resource that identifies the emitting service. name and version populate the service.name and service.version semantic-convention attributes that appear as labels on every signal in the backend.

Types

type Endpoint

type Endpoint struct {
	Host     string            // host:port, e.g. "collector:4318"
	BasePath string            // path prefix the per-signal suffix is appended to
	Insecure bool              // plaintext OTLP (http scheme, or an explicit insecure flag)
	Headers  map[string]string // exporter headers, e.g. an auth token
}

Endpoint is a parsed OTLP/HTTP base URL, split into the components every signal exporter needs. Each signal appends its own suffix to BasePath: "/v1/traces", "/v1/metrics" or "/v1/logs".

func ParseEndpoint

func ParseEndpoint(rawURL string, insecure bool, headers map[string]string) (Endpoint, error)

ParseEndpoint splits an OTLP/HTTP base URL into exporter components. An http scheme, or insecure being true, marks the endpoint as plaintext — use that only for a local collector.

type Settings

type Settings struct {
	Enabled  bool
	Endpoint string // OTLP/HTTP base URL; empty means "let the SDK read OTEL_* env vars"
	Headers  map[string]string
	Insecure bool
}

Settings is the resolved OTLP target for a single signal.

func Resolve

func Resolve(cfg config.Containable, signal string) Settings

Resolve reads telemetry.<signal>.* overlaid on the shared telemetry.* keys, in the same shared-plus-override style as pkg/tls. A per-signal key, when set, overrides the shared value for that one field. Enabled is per-signal only.

An empty Endpoint is intentional and not an error: it lets the OTel SDK fall back to the standard OTEL_EXPORTER_OTLP_* environment variables, so operators who configure the ecosystem's env vars need set nothing in GTB config beyond telemetry.<signal>.enabled.

Jump to

Keyboard shortcuts

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