Documentation
¶
Overview ¶
Package metry provides a zero-boilerplate OpenTelemetry and LLMOps hub for Go AI applications.
Index ¶
- Variables
- func BaggageValue(ctx context.Context, key string) string
- func SetBaggageValue(ctx context.Context, key, value string) (context.Context, error)
- type Option
- func WithEnvironment(env string) Option
- func WithExporter(exp sdktrace.SpanExporter) Option
- func WithMetricExporter(exp sdkmetric.Exporter) Option
- func WithSampler(sampler sdktrace.Sampler) Option
- func WithServiceName(name string) Option
- func WithServiceVersion(version string) Option
- func WithTraceRatio(ratio float64) Option
- type Provider
Constants ¶
This section is empty.
Variables ¶
var ( // ErrServiceNameRequired is returned when New is called with an empty ServiceName. ErrServiceNameRequired = errors.New("metry: ServiceName is required") )
Functions ¶
func BaggageValue ¶
BaggageValue retrieves a value for the given key from the context's baggage. Returns an empty string if the key does not exist.
Types ¶
type Option ¶ added in v0.1.2
type Option func(*config)
Option configures New. Use WithServiceName, WithTraceRatio, etc.
func WithEnvironment ¶ added in v0.1.2
WithEnvironment sets the deployment environment (e.g. "production", "staging").
func WithExporter ¶ added in v0.2.0
func WithExporter(exp sdktrace.SpanExporter) Option
WithExporter sets the span exporter. If not set, a no-op exporter is used.
func WithMetricExporter ¶ added in v0.1.2
WithMetricExporter sets the metric exporter. If not set, metrics are not exported.
func WithSampler ¶ added in v0.2.5
WithSampler sets a custom head-based sampler for tracing. When provided, this sampler takes precedence over WithTraceRatio.
func WithServiceName ¶ added in v0.1.2
WithServiceName sets the service name (required).
func WithServiceVersion ¶ added in v0.1.2
WithServiceVersion sets the service version (optional).
func WithTraceRatio ¶ added in v0.1.2
WithTraceRatio sets the fraction of traces to sample (1.0 = 100%, 0.0 = disable).
type Provider ¶ added in v0.2.5
type Provider struct {
TracerProvider trace.TracerProvider
MeterProvider metric.MeterProvider
Propagator propagation.TextMapPropagator
// contains filtered or unexported fields
}
Provider is the stateless runtime object created by New. It exposes OTel providers and propagator without mutating global state.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package genai defines GenAI semantic-convention constants and helpers for metry.
|
Package genai defines GenAI semantic-convention constants and helpers for metry. |
|
middleware
|
|
|
http
Package http provides HTTP middleware for metry that creates root spans and propagates trace context.
|
Package http provides HTTP middleware for metry that creates root spans and propagates trace context. |
|
Package security provides semantic conventions and helpers for AI security observability telemetry.
|
Package security provides semantic conventions and helpers for AI security observability telemetry. |
|
Package testutil provides in-memory exporters and helpers for testing code that uses metry.
|
Package testutil provides in-memory exporters and helpers for testing code that uses metry. |
|
Package traceutil provides utilities for OpenTelemetry trace spans.
|
Package traceutil provides utilities for OpenTelemetry trace spans. |