internal

package
v0.0.0-...-564de18 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithoutCancel

func ContextWithoutCancel(ctx context.Context) context.Context

ContextWithoutCancel returns a non-cancelable ctx

func Cookies

func Cookies(ctx context.Context) ([]*http.Cookie, bool)

Cookies reads the cookies from the context

func FillFromRequest

func FillFromRequest(req *http.Request, destination interface{}) (url.Values, error)

func GetIPFromContext

func GetIPFromContext(ctx context.Context) string

GetIPFromContext gets IP value from ctx

func Getenv

func Getenv(key string, def string) string

func NewMonitor

func NewMonitor(duration int)

func NewServerHooks

func NewServerHooks() *twirp.ServerHooks

NewServerHooks provides an error logging hook with Elastic APM

func SetIPToContext

func SetIPToContext(ctx context.Context, ip string) context.Context

SetIPToContext sets IP value to ctx

func WrapAll

func WrapAll(h http.Handler) http.Handler

WrapAll wraps a http.Handler with all needed handlers for our service

func WrapWithAPM

func WrapWithAPM(h http.Handler) http.Handler

WrapWithAPM wraps a http.Handler to inject the APM agent

func WrapWithCookies

func WrapWithCookies(base http.Handler) http.Handler

WrapWithCookies adds the http.Request cookies into context

func WrapWithIP

func WrapWithIP(h http.Handler) http.Handler

WrapWithIP wraps a http.Handler to inject the client IP into the context

Types

type Error

type Error struct {
	Error ErrorBody `json:"error"`
}

func NewError

func NewError(value error) *Error

type ErrorBody

type ErrorBody struct {
	Message string   `json:"message"`
	Trace   []string `json:"trace,omitempty"`
}

type Monitor

type Monitor struct {
	Alloc,
	TotalAlloc,
	Sys,
	Mallocs,
	Frees,
	LiveObjects,
	PauseTotalNs uint64

	NumGC        uint32
	NumGoroutine int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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