infra

package
v0.0.0-...-537b99d Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EndTx

func EndTx(tx *newrelic.Transaction)

end new relic transaction

func GetNRApp

func GetNRApp() *newrelic.Application

init new relic instance once

func RegisterNewrelic

func RegisterNewrelic() *newrelic.Application

register newrelic with the service name

func RegisterSwaggerDocs

func RegisterSwaggerDocs(serverContext *ServerContext)

func StartTx

func StartTx(name string) *newrelic.Transaction

start new relic transaction

func WrapNR

func WrapNR(pattern string, handler func(http.ResponseWriter, *http.Request)) (string, func(http.ResponseWriter, *http.Request))

wrap function for new relic metric reporting

Types

type ServerContext

type ServerContext struct {
	Router *chi.Mux
	NRApp  *newrelic.Application
}

ServerContext maintain service level state

func New

func New() *ServerContext

New create new server context

func (*ServerContext) Mount

func (ctx *ServerContext) Mount(path string, handler http.Handler)

Mount mounts sub router with a path

func (*ServerContext) Register

func (ctx *ServerContext) Register(path string, handle func(http.ResponseWriter, *http.Request), method string)

Register registers handler with a path

func (*ServerContext) StartServer

func (ctx *ServerContext) StartServer(address string)

StartServer serves on address

type StructuredLogger

type StructuredLogger struct {
	Logger *logrus.Logger
}

StructuredLogger holds instance of logrus

Jump to

Keyboard shortcuts

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