execution_logs

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditLogger

type AuditLogger interface {
	Log(ctx context.Context, event Event) error
	Query(ctx context.Context, filter QueryFilter) ([]Event, error)
	Count(ctx context.Context, filter QueryFilter) (int, error)
}

AuditLogger provides audit logging operations.

type Event

type Event struct {
	ID        string
	TenantID  string
	UserID    string
	RequestID string
	Action    string // e.g., "skills.execute", "model.generate"
	Resource  string // e.g., "skill/search", "model/claude"
	Outcome   string // "success", "failure", "timeout"
	Duration  time.Duration
	Metadata  map[string]string
	Timestamp time.Time
}

Event represents an audit log entry.

type InMemoryAuditLogger

type InMemoryAuditLogger struct {
	// contains filtered or unexported fields
}

InMemoryAuditLogger implements AuditLogger using an in-memory slice.

func NewInMemoryAuditLogger

func NewInMemoryAuditLogger() *InMemoryAuditLogger

NewInMemoryAuditLogger creates a new in-memory audit logger.

func (*InMemoryAuditLogger) Count

func (l *InMemoryAuditLogger) Count(ctx context.Context, filter QueryFilter) (int, error)

Count returns the number of events matching the filter.

func (*InMemoryAuditLogger) Log

func (l *InMemoryAuditLogger) Log(ctx context.Context, event Event) error

Log records an audit event.

func (*InMemoryAuditLogger) Query

func (l *InMemoryAuditLogger) Query(ctx context.Context, filter QueryFilter) ([]Event, error)

Query retrieves audit events matching the filter.

type PGAuditLogger

type PGAuditLogger struct {
	// contains filtered or unexported fields
}

PGAuditLogger implements AuditLogger using PostgreSQL via pgxpool.

func NewPGAuditLogger

func NewPGAuditLogger(pool *pgxpool.Pool) *PGAuditLogger

NewPGAuditLogger creates a new audit logger connected to the given pool.

func (*PGAuditLogger) Count

func (l *PGAuditLogger) Count(ctx context.Context, filter QueryFilter) (int, error)

Count returns the number of events matching the filter.

func (*PGAuditLogger) Initialize

func (l *PGAuditLogger) Initialize(ctx context.Context) error

Initialize creates the audit_logs table if it doesn't exist.

func (*PGAuditLogger) Log

func (l *PGAuditLogger) Log(ctx context.Context, event Event) error

Log records an audit event.

func (*PGAuditLogger) Query

func (l *PGAuditLogger) Query(ctx context.Context, filter QueryFilter) ([]Event, error)

Query retrieves audit events matching the filter.

type QueryFilter

type QueryFilter struct {
	TenantID  string
	UserID    string
	RequestID string
	Action    string
	From      time.Time
	To        time.Time
	Limit     int
}

QueryFilter defines filters for audit queries.

Jump to

Keyboard shortcuts

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