timeline

package
v0.367.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeLog               = sql.EventTypeLog
	EventTypeCall              = sql.EventTypeCall
	EventTypeDeploymentCreated = sql.EventTypeDeploymentCreated
	EventTypeDeploymentUpdated = sql.EventTypeDeploymentUpdated
)

Supported event types.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

type Call struct {
	DeploymentKey    model.DeploymentKey
	RequestKey       model.RequestKey
	ParentRequestKey optional.Option[model.RequestKey]
	StartTime        time.Time
	DestVerb         *schema.Ref
	Callers          []*schema.Ref
	Request          *ftlv1.CallRequest
	Response         either.Either[*ftlv1.CallResponse, error]
}

type CallEvent added in v0.367.0

type CallEvent struct {
	ID               int64
	DeploymentKey    model.DeploymentKey
	RequestKey       optional.Option[model.RequestKey]
	ParentRequestKey optional.Option[model.RequestKey]
	Time             time.Time
	SourceVerb       optional.Option[schema.Ref]
	DestVerb         schema.Ref
	Duration         time.Duration
	Request          json.RawMessage
	Response         json.RawMessage
	Error            optional.Option[string]
	Stack            optional.Option[string]
}

func (*CallEvent) GetID added in v0.367.0

func (e *CallEvent) GetID() int64

type DeploymentCreatedEvent added in v0.367.0

type DeploymentCreatedEvent struct {
	ID                 int64
	DeploymentKey      model.DeploymentKey
	Time               time.Time
	Language           string
	ModuleName         string
	MinReplicas        int
	ReplacedDeployment optional.Option[model.DeploymentKey]
}

func (*DeploymentCreatedEvent) GetID added in v0.367.0

func (e *DeploymentCreatedEvent) GetID() int64

type DeploymentUpdatedEvent added in v0.367.0

type DeploymentUpdatedEvent struct {
	ID              int64
	DeploymentKey   model.DeploymentKey
	Time            time.Time
	MinReplicas     int
	PrevMinReplicas int
}

func (*DeploymentUpdatedEvent) GetID added in v0.367.0

func (e *DeploymentUpdatedEvent) GetID() int64

type EventType added in v0.367.0

type EventType = sql.EventType

type IngresEvent added in v0.367.0

type IngresEvent struct {
	DeploymentKey model.DeploymentKey
	RequestKey    model.RequestKey
}

type Log

type Log struct {
	DeploymentKey model.DeploymentKey
	RequestKey    optional.Option[model.RequestKey]
	Msg           *ftlv1.StreamDeploymentLogsRequest
}

type LogEvent added in v0.367.0

type LogEvent struct {
	ID            int64
	DeploymentKey model.DeploymentKey
	RequestKey    optional.Option[model.RequestKey]
	Time          time.Time
	Level         int32
	Attributes    map[string]string
	Message       string
	Error         optional.Option[string]
}

func (*LogEvent) GetID added in v0.367.0

func (e *LogEvent) GetID() int64

type Service

type Service struct {
	*libdal.Handle[Service]
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, conn libdal.Connection, encryption *encryption.Service) *Service

func (*Service) DeleteOldEvents

func (s *Service) DeleteOldEvents(ctx context.Context, eventType EventType, age time.Duration) (int64, error)

func (*Service) InsertIngress added in v0.367.0

func (s *Service) InsertIngress(ctx context.Context, ingress *IngresEvent) error

func (*Service) InsertLogEvent

func (s *Service) InsertLogEvent(ctx context.Context, log *LogEvent) error

func (*Service) QueryTimeline

func (s *Service) QueryTimeline(ctx context.Context, limit int, filters ...TimelineFilter) ([]TimelineEvent, error)

func (*Service) RecordCall

func (s *Service) RecordCall(ctx context.Context, call *Call)

func (*Service) RecordLog

func (s *Service) RecordLog(ctx context.Context, log *Log) error

type TimelineEvent added in v0.367.0

type TimelineEvent interface {
	GetID() int64
	// contains filtered or unexported methods
}

TimelineEvent types.

type TimelineFilter added in v0.367.0

type TimelineFilter func(query *eventFilter)

func FilterCall added in v0.367.0

func FilterCall(sourceModule optional.Option[string], destModule string, destVerb optional.Option[string]) TimelineFilter

FilterCall filters call events between the given modules.

May be called multiple times.

func FilterDeployments added in v0.367.0

func FilterDeployments(deploymentKeys ...model.DeploymentKey) TimelineFilter

func FilterDescending added in v0.367.0

func FilterDescending() TimelineFilter

FilterDescending returns events in descending order.

func FilterIDRange added in v0.367.0

func FilterIDRange(higherThan, lowerThan int64) TimelineFilter

FilterIDRange filters events between the given IDs, inclusive.

func FilterLogLevel added in v0.367.0

func FilterLogLevel(level log.Level) TimelineFilter

func FilterRequests added in v0.367.0

func FilterRequests(requestKeys ...model.RequestKey) TimelineFilter

func FilterTimeRange added in v0.367.0

func FilterTimeRange(olderThan, newerThan time.Time) TimelineFilter

FilterTimeRange filters events between the given times, inclusive.

Either maybe be zero to indicate no upper or lower bound.

func FilterTypes added in v0.367.0

func FilterTypes(types ...sql.EventType) TimelineFilter

Directories

Path Synopsis
internal
sql

Jump to

Keyboard shortcuts

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