eventmetrics

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureRoutes

func ConfigureRoutes(in RoutesIn)

ConfigureRoutes sets up the router provided to handle traffic for the events parsing endpoint.

func DecodeEvent

func DecodeEvent(_ context.Context, r *http.Request) (interface{}, error)

DecodeEvent decodes the request body into a wrp.Message type.

func EncodeError

func EncodeError(getLogger GetLoggerFunc) kithttp.ErrorEncoder

EncodeError logs the error provided using the logger in the context. The log message includes any details given. If the error includes a status code, that is the status code given in the response. Otherwise, a 500 is sent.

func EncodeResponseCode

func EncodeResponseCode(statusCode int) kithttp.EncodeResponseFunc

EncodeResponseCode creates a go-kit EncodeResponseFunc that returns the response code given.

func NewEventHandler

func NewEventHandler(e endpoint.Endpoint, getLogger GetLoggerFunc) http.Handler

func Provide

func Provide() fx.Option

Provide bundles everything needed for setting up the subscribe endpoint together for easier wiring into an uber fx application.

Types

type BadRequestErr

type BadRequestErr struct {
	Message string
}

func (BadRequestErr) Error

func (e BadRequestErr) Error() string

func (BadRequestErr) StatusCode

func (e BadRequestErr) StatusCode() int

type Config

type Config struct {
	BirthdateValidFrom time.Duration
	BirthdateValidTo   time.Duration
}

Config configures things related to the parsing of events for metrics

type Endpoints

type Endpoints struct {
	Event endpoint.Endpoint `name:"eventEndpoint"`
}

Endpoints is the register go-kit endpoints.

func NewEndpoints

func NewEndpoints(eventQueue queue.Queue, validator validation.TimeValidation, timeTracker queue.TimeTracker, logger *zap.Logger) Endpoints

type EndpointsDecodeIn

type EndpointsDecodeIn struct {
	fx.In
	Endpoints
	GetLogger GetLoggerFunc
}

EndpointsDecodeIn provides everything needed to handle the endpoints provided.

type GetLoggerFunc

type GetLoggerFunc func(context.Context) *zap.Logger

GetLoggerFunc is the function used to get a request-specific logger from its context.

type Handler

type Handler struct {
	Event http.Handler `name:"eventHandler"`
}

func NewHandlers

func NewHandlers(in EndpointsDecodeIn) Handler

NewHandlers builds handlers from endpoints and other input provided.

type RoutesIn

type RoutesIn struct {
	fx.In
	Handler      Handler
	AuthChain    alice.Chain
	ServerBundle touchhttp.ServerBundle
	Router       *mux.Router `name:"servers.primary"`
	APIBase      string      `name:"api_base"`
}

RoutesIn provides the information needed to set up the router and start handling requests for glaukos's primary subscribing endpoint.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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