Documentation
¶
Index ¶
- Constants
- func ApplyHTTPClientObservability(ctx any, feature string, client *commonsHTTP.Client, explicit *har.Collector) middlewares.Middleware
- func ApplyHTTPObservability(ctx any, feature string, base netHTTP.RoundTripper, explicit *har.Collector) netHTTP.RoundTripper
- func ObserveHTTP(feature string, collector *har.Collector) (release func())
- func ParseLevelName(name string) (level logger.LogLevel, off bool, ok bool)
- func SupportedLevelNames() []string
- type Capability
- type Event
- type EventDefinition
- type Policy
- type ProviderFamily
Constants ¶
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 ApplyHTTPClientObservability ¶ added in v0.1.59
func ApplyHTTPClientObservability(ctx any, feature string, client *commonsHTTP.Client, explicit *har.Collector) middlewares.Middleware
ApplyHTTPClientObservability attaches HAR capture and HTTP logging to a commons HTTP client for the given feature. It returns a middleware suitable for reuse on derived (e.g. token) clients, or nil when nothing was attached.
func ApplyHTTPObservability ¶ added in v0.1.59
func ApplyHTTPObservability(ctx any, feature string, base netHTTP.RoundTripper, explicit *har.Collector) netHTTP.RoundTripper
ApplyHTTPObservability wraps a RoundTripper with HAR capture and HTTP logging for the given feature, honouring the context's effective levels.
func ObserveHTTP ¶ added in v0.1.59
ObserveHTTP hands collector every exchange that ApplyHTTPObservability and ApplyHTTPClientObservability transports of feature make, whatever the feature's HAR level, until release is called. Feature names match as the HAR level's do: case-insensitively, with an empty name meaning "http".
func ParseLevelName ¶
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 (Policy) Completion ¶
type ProviderFamily ¶
type ProviderFamily string
const ( ProviderGeneric ProviderFamily = "generic" ProviderSQL ProviderFamily = "sql" ProviderHTTP ProviderFamily = "http" )