ops

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 39 Imported by: 0

Documentation

Overview

Package ops provides operational features needed for monitoring, logging, tracing or deployment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLoggingContext

func AddLoggingContext(c userContextProvider, key, value string)

AddLoggingContext adds the key and value to all logging messages in this request context.

func ConfigureLogging

func ConfigureLogging(logConfig configs.LogConfig, profiles *Profiles)

ConfigureLogging configures the logging framework

func ConfigureMetrics added in v0.7.0

func ConfigureMetrics(vConf *configs.ValkyrieConfig) error

ConfigureMetrics configures metrics, including exporter and instrumentation

func ConfigureTracing added in v0.5.0

func ConfigureTracing(cfg *TracingConfig) error

ConfigureTracing configures the tracing framework based on TracingConfig.

func GetTracingHeaders

func GetTracingHeaders(ctx context.Context) map[string]string

GetTracingHeaders returns the tracing headers

func LogHTTPRequest added in v0.5.0

func LogHTTPRequest(req *fasthttp.Request) func(event *zerolog.Event)

LogHTTPRequest return a function that adds request data to the zerolog Event

func LogHTTPResponse added in v0.5.0

func LogHTTPResponse(req *fasthttp.Request, resp *fasthttp.Response, err error) func(event *zerolog.Event)

LogHTTPResponse return a function that adds request and response data to the zerolog Event

func LoggingMiddleware

func LoggingMiddleware(apps ...*fiber.App)

LoggingMiddleware setup zerolog and request logging

Adds tracing information to logging

Adds debug logging for request and response

func OnGCE added in v0.7.0

func OnGCE() bool

OnGCE reports whether this process is running on Google Compute Engine.

func TraceHTTPAttributes

func TraceHTTPAttributes(span trace.Span, req *fasthttp.Request, resp *fasthttp.Response, err error)

TraceHTTPAttributes sets relevant tracing attributes based on provided fasthttp.Request and fasthttp.Response.

func TracingMiddleware

func TracingMiddleware(cfg *TracingConfig, apps ...*fiber.App)

TracingMiddleware adds tracing

Types

type ExporterType

type ExporterType string
const (
	StdOut        ExporterType = "stdout"
	OTLPTraceHTTP ExporterType = "otlptracehttp"
	None          ExporterType = ""
)

type MetricConfig added in v0.7.0

type MetricConfig struct {
	Exporter    MetricExporterType
	Version     string
	ServiceName string
	Namespace   string
	configs.MetricConfig
}

type MetricExporterType added in v0.7.0

type MetricExporterType string
const (
	MetricStdOut   MetricExporterType = "stdout"
	MetricOTLPHTTP MetricExporterType = "otlpmetrichttp"
	MetricNone     MetricExporterType = ""
)

type Profiles

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

A Profiles struct holds all loaded profiles of the application. A profile can be used at runtime to customize behavior of the application. This was inspired by other frameworks, such as Micronaut (https://github.com/micronaut-projects/micronaut-core/blob/v3.6.3/inject/src/main/java/io/micronaut/context/env/DefaultEnvironment.java)

func NewProfiles

func NewProfiles() *Profiles

func (*Profiles) Has

func (p *Profiles) Has(profile string) bool

Has returns true if profile is present in p

func (*Profiles) List

func (p *Profiles) List() []string

List returns the profiles of p

func (*Profiles) Load

func (p *Profiles) Load() *Profiles

Load profiles explicitly set from VALK_PROFILES=dev,linux,cloud,gcp

Try to deduce profiles unless disabled by VALK_PROFILES_DEDUCE=false

type TracingConfig

type TracingConfig struct {
	Exporter    ExporterType
	Version     string
	ServiceName string
	Namespace   string
	configs.TraceConfig
}

func Tracing

func Tracing(vConf *configs.ValkyrieConfig) *TracingConfig

Tracing returns a TracingConfig based on the provided Valkyrie config

Jump to

Keyboard shortcuts

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