observability

package
v0.1.31 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PropertyErrorLevel            = "log.level.error"
	PropertySlowLevel             = "log.level.slow"
	PropertySlowThreshold         = "log.slowThreshold"
	PropertyOperationLevel        = "log.level.operation"
	PropertySQLLevel              = "log.level.sql"
	PropertySQLParamsLevel        = "log.level.sql.params"
	PropertyHTTPLevel             = "log.level.http"
	PropertyHTTPHeadersLevel      = "log.level.http.headers"
	PropertyHTTPRequestBodyLevel  = "log.level.http.request.body"
	PropertyHTTPResponseBodyLevel = "log.level.http.response.body"
	DefaultCollectorEntries       = 100
)

Variables

This section is empty.

Functions

func ParseLevelName

func ParseLevelName(name string) (level logger.LogLevel, off bool, ok bool)

ParseLevelName resolves one of SupportedLevelNames to its level. "off" is not a level and reports ok=false along with off=true, so a caller can tell "switch this feature off" from "that is not a level I know" and reject the latter rather than quietly running at a level nobody asked for.

func SupportedLevelNames

func SupportedLevelNames() []string

Types

type Capability

type Capability struct {
	Family         ProviderFamily    `json:"family"`
	SlowThreshold  string            `json:"slowThreshold"`
	ThresholdLabel string            `json:"thresholdLabel"`
	Events         []EventDefinition `json:"events"`
}

func CapabilityFor

func CapabilityFor(connectionType string) Capability

type Event

type Event string
const (
	EventError            Event = "error"
	EventSlow             Event = "slow"
	EventOperation        Event = "operation"
	EventSQL              Event = "sql"
	EventSQLParams        Event = "sql_params"
	EventHTTP             Event = "http"
	EventHTTPHeaders      Event = "http_headers"
	EventHTTPRequestBody  Event = "http_request_body"
	EventHTTPResponseBody Event = "http_response_body"
)

type EventDefinition

type EventDefinition struct {
	Event         Event          `json:"event"`
	Property      string         `json:"property"`
	Label         string         `json:"label"`
	Description   string         `json:"description"`
	Default       string         `json:"default"`
	Captures      []string       `json:"captures"`
	Example       map[string]any `json:"example"`
	PrettyExample string         `json:"prettyExample"`
}

type Policy

type Policy struct {
	Family        ProviderFamily
	SlowThreshold time.Duration
	// contains filtered or unexported fields
}

func PolicyFor

func PolicyFor(connection *models.Connection) (Policy, error)

func (Policy) Completion

func (p Policy) Completion(duration time.Duration, err error) (Event, logger.LogLevel)

func (Policy) Enabled

func (p Policy) Enabled(event Event) bool

func (Policy) Level

func (p Policy) Level(event Event) logger.LogLevel

type ProviderFamily

type ProviderFamily string
const (
	ProviderGeneric ProviderFamily = "generic"
	ProviderSQL     ProviderFamily = "sql"
	ProviderHTTP    ProviderFamily = "http"
)

Jump to

Keyboard shortcuts

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