infra

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package infra provides infrastructure related utils to share among hipster shop services.

Index

Constants

View Source
const (
	JaegerAddrEnv = "JAEGER_SERVICE_ADDR"
	DebugModeEnv  = "ENABLE_DEBUG_MODE"
	AppPortEnv    = "APP_PORT"
)

environment variables

Variables

View Source
var (
	ErrNoEnv = errors.New("missing env variable")
)

exported errors

Functions

func AppPort added in v0.2.1

func AppPort(port int) int

AppPort gets the port from certain env variable if it is set, or use the provided port otherwise.

func InitJaegerTracing

func InitJaegerTracing(name string) error

InitJaegerTracing init a jaeger exporter and register it. The agent endpoint comes from the env JAEGER_SERVICE_ADDR.

func InitLogrus added in v0.2.1

func InitLogrus() *logrus.Logger

InitLogrus returns logger that prints to stderr. If ENABLE_DEBUG_MODE is set to "1", it outputs colored plain text for human read; otherwise it outputs JSON-formatted lines for machines parsing.

func NewServer added in v0.2.1

func NewServer(opts ...serverOption) *grpc.Server

NewServer returns a grpc server with opencensus statHandler.

func WithHealth added in v0.2.1

func WithHealth(srv *grpc.Server)

WithHealth registers a health server.

func WithReflection added in v0.2.1

func WithReflection(srv *grpc.Server)

WithReflection turns on the server's reflection protocol.

Types

This section is empty.

Jump to

Keyboard shortcuts

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