Documentation
¶
Index ¶
- Constants
- Variables
- func ContextAddAttributes(ctx context.Context, attr slog.Attr)
- func GetIPFromHeaders(r *http.Request) netip.Addr
- func NewChild(ctx context.Context, name string) context.Context
- func SetDefaultTelemetry(t Telemetry)
- type Child
- type Config
- type ContextSupervisor
- type DefaultTelemetry
- type HttpRequest
- type Otel
- type Telemetry
Constants ¶
View Source
const ( KeyRequestID = "request.id" KeyHttpRoute = string(semconv.HTTPRouteKey) KeyHttpRequest = "http.request" KeyHttpMethod = string(semconv.HTTPRequestMethodKey) KeyHttpPath = "http.request.path" KeyHttpRequestClientIP = string(semconv.ClientAddressKey) KeyHttpResponseSize = string(semconv.HTTPResponseSizeKey) KeyHttpRequestDuration = string(semconv.HTTPClientRequestDurationName) KeyHttpResponseStatusCode = string(semconv.HTTPStatusCodeKey) )
View Source
const (
OtelEnvLocal = "LOCAL"
)
Variables ¶
View Source
var (
ErrUnsupportedOtelEnv = errors.New("unsupported otel environment")
)
Functions ¶
func GetIPFromHeaders ¶
GetIPFromHeaders returns the IP address from the request headers The request headers can be injected and ips can be spoofed They are also injected by proxies
func SetDefaultTelemetry ¶
func SetDefaultTelemetry(t Telemetry)
Types ¶
type Child ¶
type Child struct {
// contains filtered or unexported fields
}
type ContextSupervisor ¶
type DefaultTelemetry ¶
type DefaultTelemetry struct {
// contains filtered or unexported fields
}
func NewDefaultTelemetry ¶
func NewDefaultTelemetry(ctx context.Context, applicationName string) (*DefaultTelemetry, error)
func (*DefaultTelemetry) Log ¶
func (d *DefaultTelemetry) Log() *slog.Logger
func (*DefaultTelemetry) StartChild ¶
type HttpRequest ¶
type HttpRequest struct {
// contains filtered or unexported fields
}
func NewHttpRequest ¶
func NewHttpRequest(r *http.Request) *HttpRequest
func (HttpRequest) LogValue ¶
func (r HttpRequest) LogValue() slog.Value
Source Files
¶
Click to show internal directories.
Click to hide internal directories.