Documentation
¶
Overview ¶
Package telemetry provides observability via structured logging, metrics, and tracing.
Features: - Structured JSON logging via log/slog - Prometheus metrics on /metrics - OpenTelemetry spans - SIGIL_TELEMETRY=none disables all telemetry
Index ¶
- type Config
- type Span
- type Telemetry
- func (t *Telemetry) IncrementChallengesCreated(actionType string)
- func (t *Telemetry) IncrementChallengesVerified(actionType string, success bool)
- func (t *Telemetry) IncrementMPARequests(actionType string)
- func (t *Telemetry) IsEnabled() bool
- func (t *Telemetry) LogChallengeCreated(ctx context.Context, fields map[string]interface{})
- func (t *Telemetry) LogChallengeVerified(ctx context.Context, fields map[string]interface{})
- func (t *Telemetry) LogMPAQuorumSatisfied(ctx context.Context, fields map[string]interface{})
- func (t *Telemetry) LogMPARequest(ctx context.Context, fields map[string]interface{})
- func (t *Telemetry) MetricsHandler() http.Handler
- func (t *Telemetry) RecordChallengeVerifyDuration(durationMs float64)
- func (t *Telemetry) RecordMPARequestDuration(durationMs float64)
- func (t *Telemetry) Shutdown(ctx context.Context) error
- func (t *Telemetry) StartSpan(ctx context.Context, name string) (context.Context, *Span)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ServiceName string
Enabled bool
LogWriter io.Writer // For testing, defaults to os.Stdout
}
Config holds telemetry configuration.
type Span ¶
type Span struct {
// contains filtered or unexported fields
}
Span wraps OpenTelemetry span.
func (*Span) SetAttribute ¶
SetAttribute sets an attribute on the span.
type Telemetry ¶
type Telemetry struct {
// contains filtered or unexported fields
}
Telemetry manages observability across logging, metrics, and tracing.
func New ¶
New creates a new telemetry instance.
Reads SIGIL_TELEMETRY environment variable: - "none" = disabled - anything else or unset = enabled
func (*Telemetry) IncrementChallengesCreated ¶
IncrementChallengesCreated increments the challenge creation counter.
func (*Telemetry) IncrementChallengesVerified ¶
IncrementChallengesVerified increments the challenge verification counter.
func (*Telemetry) IncrementMPARequests ¶
IncrementMPARequests increments the MPA request counter.
func (*Telemetry) LogChallengeCreated ¶
LogChallengeCreated logs a challenge.created event per Knox §6.
func (*Telemetry) LogChallengeVerified ¶
LogChallengeVerified logs a challenge.verified event per Knox §6.
func (*Telemetry) LogMPAQuorumSatisfied ¶
LogMPAQuorumSatisfied logs an mpa.quorum_satisfied event per Knox §6.
func (*Telemetry) LogMPARequest ¶
LogMPARequest logs an mpa.request event per Knox §6.
func (*Telemetry) MetricsHandler ¶
MetricsHandler returns an HTTP handler for Prometheus /metrics endpoint.
func (*Telemetry) RecordChallengeVerifyDuration ¶
RecordChallengeVerifyDuration records challenge verification duration in milliseconds.
func (*Telemetry) RecordMPARequestDuration ¶
RecordMPARequestDuration records MPA request duration in milliseconds.