event

package
v0.5.10 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetEventRecorder

func SetEventRecorder(r Recorder)

Types

type APIEvent

type APIEvent struct {
	// Request metadata
	RequestID string // Unique request identifier (X-Request-ID)
	Method    string // HTTP method (GET, POST, PUT, DELETE, PATCH)
	Path      string // API path (e.g., /api/recommend/{user-id})

	// Response metadata
	StatusCode   int       // HTTP response status code
	ResponseTime int64     // Response time in milliseconds
	Timestamp    time.Time // Event timestamp

	// Additional metadata
	RemoteAddr string // Client remote address
}

APIEvent represents an API call event for billing purposes.

type NopRecorder

type NopRecorder struct{}

func (*NopRecorder) RecordAPI

func (n *NopRecorder) RecordAPI(ctx context.Context, event APIEvent)

func (*NopRecorder) RecordStorage

func (n *NopRecorder) RecordStorage(ctx context.Context, event StorageEvent)

type Recorder

type Recorder interface {
	RecordAPI(ctx context.Context, event APIEvent)
	RecordStorage(ctx context.Context, event StorageEvent)
}

func EventRecorder

func EventRecorder() Recorder

type StorageEvent

type StorageEvent struct {
	UserCount     int       // Number of users in storage
	ItemCount     int       // Number of items in storage
	FeedbackCount int       // Number of feedbacks in storage
	Timestamp     time.Time // Event timestamp
}

StorageEvent represents data storage usage for billing purposes.

Jump to

Keyboard shortcuts

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