app

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package app implements OTEL, prometheus, graceful shutdown and other common application features for pfm projects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSpanNameFormatter added in v0.3.0

func NewSpanNameFormatter(h Router) func(operation string, r *http.Request) string

func Resource

func Resource(ctx context.Context) (*resource.Resource, error)

Resource returns new resource for application.

func Run

func Run(f func(ctx context.Context, lg *zap.Logger, m *Metrics) error)

Run f until interrupt.

If errors.Is(err, ctx.Err()) is valid for returned error, shutdown is considered graceful. Context is canceled on SIGINT. After watchdogTimeout application is forcefully terminated with exitCodeWatchdog.

Types

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics implement common basic metrics and infrastructure to it.

func (*Metrics) LogMiddleware added in v0.4.0

func (m *Metrics) LogMiddleware() middleware.Middleware

LogMiddleware adds logger via zctx.With to request context.

func (*Metrics) MeterProvider

func (m *Metrics) MeterProvider() metric.MeterProvider

func (*Metrics) String

func (m *Metrics) String() string

func (*Metrics) TextMapPropagator

func (m *Metrics) TextMapPropagator() propagation.TextMapPropagator

func (*Metrics) TracerProvider

func (m *Metrics) TracerProvider() trace.TracerProvider

type Router added in v0.3.0

type Router interface {
	FindRoute(method, path string) (oas.Route, bool)
}

Jump to

Keyboard shortcuts

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