appcommon

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CommitUnixTimestamp = "0"
	DockerTag           = "unset"
)

Functions

func NewTracedAuthRoundTripper

func NewTracedAuthRoundTripper(rt http.RoundTripper, name string) http.RoundTripper

NewTracedAuthRoundTripper creates a RoundTripper that does both tracing and org ID injection.

func NewTracer

func NewTracer(name string, logger log.Logger) (opentracing.Tracer, io.Closer, error)

NewTracer creates a new tracer using environment variables. Setting the environment variable JAEGER_AGENT_HOST enables tracing.

Types

type App

type App struct {
	Group *run.Group

	Logger      log.Logger
	LogProvider ctxlog.Provider
	Server      *server.Server
	Tracer      opentracing.Tracer
	// contains filtered or unexported fields
}

func New

func New(cfg Config, reg prometheus.Registerer, metricPrefix string, tracer opentracing.Tracer) (app App, err error)

New creates a new App. Callers should call App.Close() after use.

func (App) Close

func (app App) Close() error

type AppError

type AppError []error

func (AppError) Error

func (ae AppError) Error() string

type AuthTransport

type AuthTransport struct {
	http.RoundTripper
}

func (*AuthTransport) RoundTrip

func (t *AuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

AuthTransport is a RoundTripper that injects the org id from the context into the http request.

type Config

type Config struct {
	InstrumentBuckets string `yaml:"instrument_buckets"`
	EnableAuth        bool   `yaml:"enable_auth"`
	ServiceName       string `yaml:"service_name"`

	ServerConfig         server.Config         `yaml:"server_config"`
	InternalServerConfig internalserver.Config `yaml:"internal_server_config"`
}

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(flags *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet

func (*Config) RegisterFlagsWithPrefix

func (cfg *Config) RegisterFlagsWithPrefix(prefix string, flags *flag.FlagSet)

RegisterFlagsWithPrefix registers flags, adding the provided prefix if needed. If the prefix is not blank and doesn't end with '.', a '.' is appended to it.

type TracerTransport

type TracerTransport struct {
	http.RoundTripper
	// contains filtered or unexported fields
}

TracerTransport is a RoundTripper that records opentracing information

func (*TracerTransport) RoundTrip

func (t *TracerTransport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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