logging

package
v0.0.0-...-b9360c4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaximumServiceTrace = 10
)

Variables

This section is empty.

Functions

func Configure

func Configure(production bool, name string) (*zap.SugaredLogger, error)

func CreateFacilityForType

func CreateFacilityForType(t reflect.Type) string

func FindTaskID

func FindTaskID(ctx context.Context) string

func HandlerContext

func HandlerContext(ctx context.Context, queue string, handlerType reflect.Type, messageType reflect.Type) context.Context

func IsIngestion

func IsIngestion(r *http.Request) bool

func IsServiceTraceEnabled

func IsServiceTraceEnabled() bool

func IsWebSocket

func IsWebSocket(r *http.Request) bool

func Logger

func Logger(ctx context.Context) *zap.Logger

func LoggingAndInfrastructure

func LoggingAndInfrastructure(name string) func(h http.Handler) http.Handler

func MakeCommonPrefix

func MakeCommonPrefix() string

algorithm taken from goa RequestId middleware algorithm taken from https://github.com/zenazn/goji/blob/master/web/middleware/request_id.go#L44-L50

func MakeShortID

func MakeShortID() string

func Monitoring

func Monitoring(name string, m *Metrics) func(h http.Handler) http.Handler

func NewGoaAdapter

func NewGoaAdapter(logger *zap.Logger) goa.LogAdapter

func NewGoaMiddlewareAdapter

func NewGoaMiddlewareAdapter(logger *zap.Logger) middleware.Logger

func OnlyLogIf

func OnlyLogIf(logger *zap.SugaredLogger, verbose bool) *zap.SugaredLogger

func PushServiceTrace

func PushServiceTrace(ctx context.Context, value ...string) context.Context

func ServiceTrace

func ServiceTrace(ctx context.Context) []string

func WithDeviceID

func WithDeviceID(ctx context.Context, deviceID string) context.Context

func WithFacility

func WithFacility(ctx context.Context, facility string) context.Context

func WithNewTaskID

func WithNewTaskID(ctx context.Context, g *IdGenerator) context.Context

func WithTaskID

func WithTaskID(ctx context.Context, taskID string) context.Context

func WithUserID

func WithUserID(ctx context.Context, userID int32) context.Context

Types

type IdGenerator

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

func NewIdGenerator

func NewIdGenerator() *IdGenerator

func (*IdGenerator) Generate

func (g *IdGenerator) Generate() string

type KeyMeta

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

type Metrics

type Metrics struct {
	SC       *statsd.Client
	Settings *MetricsSettings
}

func NewMetrics

func NewMetrics(ctx context.Context, ms *MetricsSettings) *Metrics

func (*Metrics) AuthRefreshSuccess

func (m *Metrics) AuthRefreshSuccess()

func (*Metrics) AuthRefreshTry

func (m *Metrics) AuthRefreshTry()

func (*Metrics) AuthSuccess

func (m *Metrics) AuthSuccess()

func (*Metrics) AuthTry

func (m *Metrics) AuthTry()

func (*Metrics) DailyQuery

func (m *Metrics) DailyQuery() *Timing

func (*Metrics) DataErrorsMissingMeta

func (m *Metrics) DataErrorsMissingMeta()

func (*Metrics) DataErrorsParsing

func (m *Metrics) DataErrorsParsing()

func (*Metrics) DataErrorsUnknown

func (m *Metrics) DataErrorsUnknown()

func (*Metrics) DataQuery

func (m *Metrics) DataQuery(aggregate string) *Timing

func (*Metrics) DataRangesQuery

func (m *Metrics) DataRangesQuery() *Timing

func (*Metrics) EmailRecoverPasswordSent

func (m *Metrics) EmailRecoverPasswordSent()

func (*Metrics) EmailVerificationSent

func (m *Metrics) EmailVerificationSent()

func (*Metrics) FileUpload

func (m *Metrics) FileUpload() *Timing

func (*Metrics) GatherMetrics

func (m *Metrics) GatherMetrics(h http.Handler) http.Handler

func (*Metrics) HandleMessage

func (m *Metrics) HandleMessage(jobType string) *Timing

func (*Metrics) Ingested

func (m *Metrics) Ingested(blocks, bytes int)

func (*Metrics) IngestionDevice

func (m *Metrics) IngestionDevice(id []byte)

func (*Metrics) LastTimesQuery

func (m *Metrics) LastTimesQuery(batch int) *Timing

func (*Metrics) MessagePublished

func (m *Metrics) MessagePublished()

func (*Metrics) PileBytes

func (m *Metrics) PileBytes(pile string, bytes int64)

func (*Metrics) PileHit

func (m *Metrics) PileHit(pile string)

func (*Metrics) PileMiss

func (m *Metrics) PileMiss(pile string)

func (*Metrics) ReadingsViewed

func (m *Metrics) ReadingsViewed(readings int)

func (*Metrics) RecentlyMultiQuery

func (m *Metrics) RecentlyMultiQuery(batch int) *Timing

func (*Metrics) RecordsViewed

func (m *Metrics) RecordsViewed(records int)

func (*Metrics) TailMultiQuery

func (m *Metrics) TailMultiQuery(batch int) *Timing

func (*Metrics) TailQuery

func (m *Metrics) TailQuery() *Timing

func (*Metrics) ThirdPartyLocation

func (m *Metrics) ThirdPartyLocation(provider string) *Timing

func (*Metrics) ThirdPartyLocationDescribe

func (m *Metrics) ThirdPartyLocationDescribe() *Timing

func (*Metrics) UserAdded

func (m *Metrics) UserAdded()

func (*Metrics) UserID

func (m *Metrics) UserID(id int32)

func (*Metrics) UserValidated

func (m *Metrics) UserValidated()

type MetricsSettings

type MetricsSettings struct {
	Prefix  string
	Address string
}

type PreventableStatusResponse

type PreventableStatusResponse struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

This is a http.ResponseWriter which allows us to circumvent the WriteHeader call that goa does before calling our encoder. Look, this sucks. I know. I just can't for the life of me figure out how to get Etagged response working for these images in another way.

func (*PreventableStatusResponse) BufferNextWriteHeader

func (w *PreventableStatusResponse) BufferNextWriteHeader()

func (*PreventableStatusResponse) FineWriteHeader

func (w *PreventableStatusResponse) FineWriteHeader()

func (*PreventableStatusResponse) Hijack

func (*PreventableStatusResponse) Write

func (w *PreventableStatusResponse) Write(b []byte) (int, error)

func (*PreventableStatusResponse) WriteHeader

func (w *PreventableStatusResponse) WriteHeader(code int)

type ResponseCapture

type ResponseCapture struct {
	http.ResponseWriter
	StatusCode    int
	ContentLength int
}

ResponseCapture is a http.ResponseWriter which captures the response status code and content length.

func CaptureResponse

func CaptureResponse(w http.ResponseWriter) *ResponseCapture

func (*ResponseCapture) Hijack

func (w *ResponseCapture) Hijack() (net.Conn, *bufio.ReadWriter, error)

func (*ResponseCapture) Write

func (w *ResponseCapture) Write(b []byte) (int, error)

func (*ResponseCapture) WriteHeader

func (w *ResponseCapture) WriteHeader(code int)

type Timing

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

func (*Timing) Send

func (t *Timing) Send()

Jump to

Keyboard shortcuts

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