constants

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Input is the attribute in a JSON request body, which contains the necessary data for policy evaluation
	Input = "input"
	// EndpointData is used for all data related http endpoints
	EndpointData = "/data"
	// EndpointPolicies is used for all policy related http endpoints
	EndpointPolicies = "/policies"
	// EndpointHealth is used as the http endpoint for liveliness probes
	EndpointHealth = "/health"
	// EndpointMetrics will be used if Kelon is configured to publish metrics using Prometheus
	EndpointMetrics = "/metrics"
	// URLParamID is the url parameter which will be used by http endpoints, which try to query/modify e.g. policies
	URLParamID = "id"
)

HTTP Request related constants

View Source
const (
	// MetaMaxOpenConnections is the MetaKey for maxOpenConnections
	MetaMaxOpenConnections string = "maxOpenConnections"
	// MetaMaxIdleConnections is the MetaKey for maxIdleConnections
	MetaMaxIdleConnections string = "maxIdleConnections"
	// MetaConnectionMaxLifetimeSeconds is the MetaKey for connectionMaxLifetimeSeconds
	MetaConnectionMaxLifetimeSeconds string = "connectionMaxLifetimeSeconds"
)

Datastore related constants

View Source
const (
	// TelemetryPrometheus is the telemetry option for prometheus
	TelemetryPrometheus string = "prometheus"
	// TelemetryOtlp is the telemetry option for OpenTelemetry
	TelemetryOtlp string = "otlp"
	// ProtocolHTTP indicates HTTP should be used for exporting OpenTelemetry data
	ProtocolHTTP string = "http"
	// ProtocolGRPC indicates gRPC should be used for exporting OpenTelemetry data
	ProtocolGRPC string = "grpc"
)

Telemetry Configuration

View Source
const (
	// LabelHTTPMethod is the label which holds the http method for the http.Handler metric instrumentation
	LabelHTTPMethod string = "http.method"
	// LabelHTTPStatusCode is the label which holds the http response code for the http.Handler metric instrumentation
	LabelHTTPStatusCode string = "http.status_code"
	// LabelGrpcService is the label which holds the grpc service name for the grpc metric instrumentation
	LabelGrpcService string = "rpc.service"
	// LabelDBPoolName is the label which holds the db pool information for the database query execution metrics
	LabelDBPoolName string = "pool.name"
	// LabelPolicyDecision is the label for the policy decision in the metrics
	LabelPolicyDecision string = "decision"
	// LabelPolicyDecisionReason is the label for the decision reason in the metrics
	LabelPolicyDecisionReason string = "reason"
	// LabelRegoPackage is the label for the rego package in the metrics
	LabelRegoPackage string = "rego.package"
)

Telemetry Label

View Source
const ContextKeyRegoPackage = ContextKey("regoPackage")

ContextKeyRegoPackage is used to propagate the rego package via the context in order to enrich logs/spans

View Source
const ProtocolPrefixRe = "^\\w+://"

ProtocolPrefixRe is the regex, which will be used to remove the protocol prefix from endpoints

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextKey

type ContextKey string

ContextKey represents keys for key value pairs in contexts

type MetricInstrument added in v0.2.0

type MetricInstrument int

MetricInstrument identifies the metric instruments

const (
	// InstrumentVersion represents the version metric
	InstrumentVersion MetricInstrument = iota
	// InstrumentHTTPRequestDuration represents the http request duration metric
	InstrumentHTTPRequestDuration
	// InstrumentHTTPActiveRequests represents the http active request metric
	InstrumentHTTPActiveRequests
	// InstrumentHTTPRequestSize represents the http request size metric
	InstrumentHTTPRequestSize
	// InstrumentRPCRequestDuration represents the rpc request metric
	InstrumentRPCRequestDuration
	// InstrumentRPCRequestSize represents the rpc request size metric
	InstrumentRPCRequestSize
	// InstrumentDecisionDuration represents the decision duration metric
	InstrumentDecisionDuration
	// InstrumentDBQueryDuration represents the database query duration metric
	InstrumentDBQueryDuration
)

func (MetricInstrument) String added in v0.2.0

func (i MetricInstrument) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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