Documentation
¶
Overview ¶
Package audit provides audit logging for the platform.
Index ¶
- func SanitizeParameters(params map[string]any) map[string]any
- type Config
- type Event
- func (e *Event) WithConnection(connection string) *Event
- func (e *Event) WithParameters(params map[string]any) *Event
- func (e *Event) WithPersona(persona string) *Event
- func (e *Event) WithRequestID(requestID string) *Event
- func (e *Event) WithResponseSize(chars, tokenEstimate int) *Event
- func (e *Event) WithResult(success bool, errorMsg string, durationMS int64) *Event
- func (e *Event) WithToolkit(kind, name string) *Event
- func (e *Event) WithUser(userID, email string) *Event
- type EventType
- type Logger
- type QueryFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Event ¶
type Event struct {
ID string `json:"id"`
Timestamp time.Time `json:"timestamp"`
DurationMS int64 `json:"duration_ms"`
RequestID string `json:"request_id"`
UserID string `json:"user_id"`
UserEmail string `json:"user_email,omitempty"`
Persona string `json:"persona,omitempty"`
ToolName string `json:"tool_name"`
ToolkitKind string `json:"toolkit_kind,omitempty"`
ToolkitName string `json:"toolkit_name,omitempty"`
Connection string `json:"connection,omitempty"`
Parameters map[string]any `json:"parameters,omitempty"`
Success bool `json:"success"`
ErrorMessage string `json:"error_message,omitempty"`
ResponseChars int `json:"response_chars"`
ResponseTokenEstimate int `json:"response_token_estimate"`
}
Event represents an auditable event.
func (*Event) WithConnection ¶
WithConnection adds connection information to the event.
func (*Event) WithParameters ¶
WithParameters adds parameters to the event.
func (*Event) WithPersona ¶
WithPersona adds persona information to the event.
func (*Event) WithRequestID ¶
WithRequestID adds a request ID to the event.
func (*Event) WithResponseSize ¶ added in v0.14.0
WithResponseSize adds response size metrics to the event.
func (*Event) WithResult ¶
WithResult adds result information to the event.
func (*Event) WithToolkit ¶
WithToolkit adds toolkit information to the event.
type Logger ¶
type Logger interface {
// Log records an audit event.
Log(ctx context.Context, event Event) error
// Query retrieves audit events matching the filter.
Query(ctx context.Context, filter QueryFilter) ([]Event, error)
// Close releases resources.
Close() error
}
Logger defines the interface for audit logging.
Click to show internal directories.
Click to hide internal directories.