Documentation
¶
Index ¶
- func ForceFlush(ctx context.Context) error
- func Init(ctx context.Context, cfg Config, res *resource.Resource) error
- func Meter(name string, opts ...metric.MeterOption) metric.Meter
- func RegisterRuntimeMetrics(ctx context.Context, cfg RuntimeConfig) error
- func Shutdown(ctx context.Context) error
- func Use(provider *Provider)
- type Config
- type Provider
- type RuntimeConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForceFlush ¶ added in v0.0.5
ForceFlush flushes the global meter provider immediately.
func Init ¶ added in v0.0.3
Init configures the meter provider and stores it as the package-level singleton.
func Meter ¶ added in v0.0.3
func Meter(name string, opts ...metric.MeterOption) metric.Meter
Meter yields a metric meter backed by the global provider.
func RegisterRuntimeMetrics ¶ added in v0.0.3
func RegisterRuntimeMetrics(ctx context.Context, cfg RuntimeConfig) error
RegisterRuntimeMetrics instruments runtime metrics using the global provider.
Types ¶
type Config ¶
type Config struct {
Enabled bool
Endpoint string `validate:"required_if=Enabled true"`
Insecure bool
Exporter string `default:"http" validate:"oneof=http grpc"`
Async bool
UseSpool bool
ServiceName string `default:"unknown-service"`
ExportInterval time.Duration `default:"10s" validate:"gt=0"`
QueueDir string
Runtime RuntimeConfig
Credentials auth.Credentials
UseGlobal bool
}
Config governs metric provider setup. Endpoint accepts a base URL (host[:port] with optional path). Provided schemes decide TLS mode; when absent, the Insecure flag controls whether HTTP is used.
func (Config) ApplyDefaults ¶ added in v0.0.3
ApplyDefaults returns a copy of the config with default values populated.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider wraps the SDK meter provider.
func Global ¶ added in v0.0.3
func Global() *Provider
Global returns the current global meter provider pointer. Panics if provider has not been initialized via Init() or Use().
func Setup ¶
Setup configures an OTLP meter provider and registers it globally. Selects HTTP or gRPC exporters based on the Exporter config field.
func (*Provider) ForceFlush ¶ added in v0.0.5
ForceFlush ensures metrics are exported immediately. No-op if provider is disabled.
func (*Provider) RegisterRuntimeMetrics ¶
func (p *Provider) RegisterRuntimeMetrics(ctx context.Context, cfg RuntimeConfig) error
RegisterRuntimeMetrics adds basic Go runtime metrics if enabled.
type RuntimeConfig ¶
type RuntimeConfig struct {
Enabled bool
}
RuntimeConfig controls optional runtime metric instrumentation.