eventrecorder

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: Apache-2.0, MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateEvent

type AggregateEvent struct {
	InstanceID        string    `json:"instanceId"`                  // The ID of the Lassie instance generating the event
	RetrievalID       string    `json:"retrievalId"`                 // The unique ID of the retrieval
	StorageProviderID string    `json:"storageProviderId,omitempty"` // The ID of the storage provider that served the retrieval content
	TimeToFirstByte   string    `json:"timeToFirstByte,omitempty"`   // The time it took to receive the first byte in milliseconds
	Bandwidth         uint64    `json:"bandwidth,omitempty"`         // The bandwidth of the retrieval in bytes per second
	BytesTransferred  uint64    `json:"bytesTransferred,omitempty"`  // The total transmitted deal size
	Success           bool      `json:"success"`                     // Wether or not the retreival ended with a success event
	StartTime         time.Time `json:"startTime"`                   // The time the retrieval started
	EndTime           time.Time `json:"endTime"`                     // The time the retrieval ended

	TimeToFirstIndexerResult  string                       `json:"timeToFirstIndexerResult,omitempty"` // time it took to receive our first "CandidateFound" event
	IndexerCandidatesReceived int                          `json:"indexerCandidatesReceived"`          // The number of candidates received from the indexer
	IndexerCandidatesFiltered int                          `json:"indexerCandidatesFiltered"`          // The number of candidates that made it through the filtering stage
	ProtocolsAllowed          []string                     `json:"protocolsAllowed,omitempty"`         // The available protocols that could be used for this retrieval
	ProtocolsAttempted        []string                     `json:"protocolsAttempted,omitempty"`       // The protocols that were used to attempt this retrieval
	RetrievalAttempts         map[string]*RetrievalAttempt `json:"retrievalAttempts,omitempty"`        // All of the retrieval attempts, indexed by their SP ID
}

func (AggregateEvent) Validate

func (e AggregateEvent) Validate() error

type AggregateEventBatch

type AggregateEventBatch struct {
	Events []AggregateEvent `json:"events"`
}

func (AggregateEventBatch) Validate

func (e AggregateEventBatch) Validate() error

type Event

type Event struct {
	RetrievalId       types.RetrievalID `json:"retrievalId"`
	InstanceId        string            `json:"instanceId,omitempty"`
	Cid               string            `json:"cid"`
	StorageProviderId string            `json:"storageProviderId"`
	Phase             types.Phase       `json:"phase"`
	PhaseStartTime    time.Time         `json:"phaseStartTime"`
	EventName         types.EventCode   `json:"eventName"`
	EventTime         time.Time         `json:"eventTime"`
	EventDetails      any               `json:"eventDetails,omitempty"`
}

func (Event) Validate

func (e Event) Validate() error

type EventBatch

type EventBatch struct {
	Events []Event `json:"events"`
}

func (EventBatch) Validate

func (e EventBatch) Validate() error

type EventRecorder

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

func New

func New(opts ...Option) (*EventRecorder, error)

func (*EventRecorder) RecordAggregateEvents

func (r *EventRecorder) RecordAggregateEvents(ctx context.Context, events []AggregateEvent) error

func (*EventRecorder) RecordEvents

func (r *EventRecorder) RecordEvents(ctx context.Context, events []Event) error

func (*EventRecorder) Shutdown

func (r *EventRecorder) Shutdown()

func (*EventRecorder) Start

func (r *EventRecorder) Start(ctx context.Context) error

type Option

type Option func(*config) error

func WithDatabaseDSN

func WithDatabaseDSN(url string) Option

func WithMetrics

func WithMetrics(metrics *metrics.Metrics) Option

func WithMongoSubmissions

func WithMongoSubmissions(endpoint, db, collection string, percentage float32) Option

type RetrievalAttempt

type RetrievalAttempt struct {
	Error           string `json:"error,omitempty"`
	TimeToFirstByte string `json:"timeToFirstByte,omitempty"`
}

Jump to

Keyboard shortcuts

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