telemetry

package
v1.0.0-rc.7 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package telemetry builds OpenTelemetry providers that export over OTLP. It knows nothing of AppTown: a caller names an endpoint and a resource and gets a tracer, a meter and a logger provider, plus one bounded Close.

Index

Constants

View Source
const (
	DefaultMetricInterval = 15 * time.Second
	DefaultCloseTimeout   = 5 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint string            // host:port of the OTLP receiver
	Protocol string            // "http" (default) or "grpc"; all three signals follow it
	Insecure bool              // plain TCP; the LAN case
	Headers  map[string]string // sent with every export, for receivers that want one
	// The resource every signal carries.
	ServiceName      string
	ServiceNamespace string
	Attributes       map[string]string
	// Bounds. Zero means the defaults below.
	MetricInterval time.Duration // how often the meter pushes
	CloseTimeout   time.Duration // the most Close waits for a final flush
}

Config names where to export and what the exporting process is.

type Providers

type Providers struct {
	Tracer trace.TracerProvider
	Meter  metric.MeterProvider
	Logger *sdklog.LoggerProvider
	// contains filtered or unexported fields
}

Providers is what Start hands back. The three providers are what a program instruments with; Close flushes and stops them within the configured bound.

func Start

func Start(ctx context.Context, cfg Config) (*Providers, error)

Start builds exporters and providers for cfg. It opens no connection eagerly for HTTP; a bad endpoint surfaces on the first export, which the SDKs report through their error handler rather than by failing the program.

func (*Providers) Close

func (p *Providers) Close(ctx context.Context) error

Close flushes and shuts the providers down, waiting at most the close timeout in total. A receiver that never answers costs that long and no more; the error says so.

func (*Providers) Flush

func (p *Providers) Flush(ctx context.Context) error

Flush pushes what is buffered without stopping anything.

Directories

Path Synopsis
Package otlpfake is an in-process OTLP/HTTP receiver for tests.
Package otlpfake is an in-process OTLP/HTTP receiver for tests.

Jump to

Keyboard shortcuts

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