Documentation ¶
Overview ¶
Package app implements OTEL, prometheus, graceful shutdown and other common application features for go-faster projects.
Index ¶
- func Go(f func(ctx context.Context, t *Telemetry) error, op ...Option)
- func Resource(ctx context.Context) (*resource.Resource, error)
- func Run(f func(ctx context.Context, lg *zap.Logger, m *Telemetry) error, op ...Option)
- type Metricsdeprecated
- type Option
- func WithContext(ctx context.Context) Option
- func WithMeterOptions(opts ...autometer.Option) Option
- func WithResource(fn func(ctx context.Context) (*resource.Resource, error)) Option
- func WithTracerOptions(opts ...autotracer.Option) Option
- func WithZapConfig(cfg zap.Config) Option
- func WithZapOptions(opts ...zap.Option) Option
- func WithZapTee(teeToStderr bool) Option
- type Telemetry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Resource ¶
Resource returns new resource for application.
Combines following detectors: - ProcessRuntimeDescription - ProcessRuntimeVersion - ProcessRuntimeName And merges it with default resource.
Types ¶
type Option ¶ added in v0.8.2
type Option interface {
// contains filtered or unexported methods
}
Option is a functional option for the application.
func WithContext ¶ added in v0.10.0
WithContext sets the base context for the application. Background context is used by default.
func WithMeterOptions ¶ added in v0.8.2
WithMeterOptions sets the default autometer options for the application.
func WithResource ¶ added in v0.12.0
WithResource sets the function that will be called to retrieve telemetry resource for application.
Defaults to Resource function.
func WithTracerOptions ¶ added in v0.8.2
func WithTracerOptions(opts ...autotracer.Option) Option
WithTracerOptions sets the default autotracer options for the application.
func WithZapConfig ¶ added in v0.8.2
WithZapConfig sets the default zap config for the application.
func WithZapOptions ¶ added in v0.11.0
WithZapOptions sets additional zap logger options for the application.
func WithZapTee ¶ added in v0.17.0
WithZapTee sets option to tee zap logs to stderr.
type Telemetry ¶ added in v0.17.0
type Telemetry struct {
// contains filtered or unexported fields
}
Telemetry implement common basic metrics and infrastructure to it.
func (*Telemetry) LoggerProvider ¶ added in v0.17.0
func (m *Telemetry) LoggerProvider() log.LoggerProvider
func (*Telemetry) MeterProvider ¶ added in v0.17.0
func (m *Telemetry) MeterProvider() metric.MeterProvider
func (*Telemetry) TextMapPropagator ¶ added in v0.17.0
func (m *Telemetry) TextMapPropagator() propagation.TextMapPropagator
func (*Telemetry) TracerProvider ¶ added in v0.17.0
func (m *Telemetry) TracerProvider() trace.TracerProvider