util

package
Version: v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBConn                   = "DIREKTIV_DB"
	DirektivDebug            = "DIREKTIV_DEBUG"
	DirektivServiceNamespace = "DIREKTIV_SERVICE_NAMESPACE"
	DirektivNamespace        = "DIREKTIV_NAMESPACE"

	DirektivFlowEndpoint      = "DIREKTIV_FLOW_ENDPOINT"
	DirektivFunctionsEndpoint = "DIREKTIV_FUNCTIONS_ENDPOINT"
	DirektivIngressEndpoint   = "DIREKTIV_INTERNAL_ENDPOINT"

	DirektivLogJSON       = "DIREKTIV_LOG_JSON"
	DirektivOpentelemetry = "DIREKTIV_OTLP"
)

Environtment variable keys

View Source
const RegexPattern = `^(([a-z][a-z0-9_\-]*[a-z0-9])|([a-z]))$`
View Source
const VarRegexPattern = `^(([a-zA-Z][a-zA-Z0-9_\-]*[a-zA-Z0-9])|([a-zA-Z]))$`

Variables

View Source
var TelemetryMiddleware = func(h http.Handler) http.Handler {
	return h
}

Functions

func AddGlobalGRPCDialOption

func AddGlobalGRPCDialOption(opt grpc.DialOption)

func AddGlobalGRPCServerOption

func AddGlobalGRPCServerOption(opt grpc.ServerOption)

func GetEndpointTLS

func GetEndpointTLS(service string) (*grpc.ClientConn, error)

GetEndpointTLS creates a grpc client

func GrpcServerOptions added in v0.5.0

func GrpcServerOptions(unaryInterceptor grpc.UnaryServerInterceptor, streamInterceptor grpc.StreamServerInterceptor) []grpc.ServerOption

func GrpcStart

func GrpcStart(server **grpc.Server, name, bind string, register func(srv *grpc.Server)) error

GrpcStart starts a grpc server

func InitTelemetry added in v0.5.0

func InitTelemetry(conf *Config, svcName, imName string) (func(), error)

func MatchesRegex

func MatchesRegex(s string) bool

MatchesRegex responds true if the provided string matches the RegexPattern constant defined in this package.

func MatchesVarRegex

func MatchesVarRegex(s string) bool

func SanitizeAsField added in v0.5.5

func SanitizeAsField(as string) string

SanitizeAsField removes initial slash if one exists and returns the new value

func Trace added in v0.5.0

func Trace(ctx context.Context, msg string)

func TraceHTTPRequest added in v0.5.0

func TraceHTTPRequest(ctx context.Context, r *http.Request) (cleanup func())

func TransplantTelemetryContextInformation added in v0.5.0

func TransplantTelemetryContextInformation(a, b context.Context) context.Context

Types

type Config added in v0.5.0

type Config struct {
	FunctionsService string `yaml:"functions-service"`
	FlowService      string `yaml:"flow-service"`

	PrometheusBackend    string `yaml:"prometheus-backend"`
	OpenTelemetryBackend string `yaml:"opentelemetry-backend"`

	Eventing bool `yaml:"eventing"`
}

Config contain direktiv configuration

func ReadConfig added in v0.5.0

func ReadConfig(file string) (*Config, error)

ReadConfig reads direktiv config file

func (*Config) GetTelemetryBackendAddr added in v0.5.0

func (cfg *Config) GetTelemetryBackendAddr() string

type GenericTelemetryCarrier added in v0.5.0

type GenericTelemetryCarrier struct {
	Trace map[string]string
}

func (*GenericTelemetryCarrier) Get added in v0.5.0

func (*GenericTelemetryCarrier) Keys added in v0.5.0

func (c *GenericTelemetryCarrier) Keys() []string

func (*GenericTelemetryCarrier) Set added in v0.5.0

func (c *GenericTelemetryCarrier) Set(key, val string)

Jump to

Keyboard shortcuts

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