timeline

package
v0.398.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeLog               = sql.EventTypeLog
	EventTypeCall              = sql.EventTypeCall
	EventTypeDeploymentCreated = sql.EventTypeDeploymentCreated
	EventTypeDeploymentUpdated = sql.EventTypeDeploymentUpdated
	EventTypeIngress           = sql.EventTypeIngress
	EventTypeCronScheduled     = sql.EventTypeCronScheduled
	EventTypeAsyncExecute      = sql.EventTypeAsyncExecute
	EventTypePubSubPublish     = sql.EventTypePubsubPublish
	EventTypePubSubConsume     = sql.EventTypePubsubConsume
)

Supported event types.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncExecute added in v0.393.0

type AsyncExecute struct {
	DeploymentKey model.DeploymentKey
	RequestKey    optional.Option[string]
	EventType     AsyncExecuteEventType
	Verb          schema.Ref
	Time          time.Time
	Error         optional.Option[string]
}

type AsyncExecuteEvent added in v0.393.0

type AsyncExecuteEvent struct {
	ID       int64
	Duration time.Duration
	AsyncExecute
}

func (*AsyncExecuteEvent) GetID added in v0.393.0

func (e *AsyncExecuteEvent) GetID() int64

type AsyncExecuteEventType added in v0.393.0

type AsyncExecuteEventType string
const (
	AsyncExecuteEventTypeUnkown AsyncExecuteEventType = "unknown"
	AsyncExecuteEventTypeCron   AsyncExecuteEventType = "cron"
	AsyncExecuteEventTypePubSub AsyncExecuteEventType = "pubsub"
)

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]
}

func CallEventToCallForTesting added in v0.383.1

func CallEventToCallForTesting(event *CallEvent) *Call

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 CronScheduled added in v0.377.0

type CronScheduled struct {
	DeploymentKey model.DeploymentKey
	Verb          schema.Ref

	Time        time.Time
	ScheduledAt time.Time
	Schedule    string
	Error       optional.Option[string]
}

type CronScheduledEvent added in v0.377.0

type CronScheduledEvent struct {
	ID       int64
	Duration time.Duration
	CronScheduled
}

func (*CronScheduledEvent) GetID added in v0.377.0

func (e *CronScheduledEvent) 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 Event added in v0.373.1

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

Event types.

type EventType added in v0.367.0

type EventType = sql.EventType

type InEvent added in v0.373.1

type InEvent interface {
	// contains filtered or unexported methods
}

InEvent is a marker interface for events that are inserted into the timeline.

type Ingress added in v0.368.0

type Ingress struct {
	DeploymentKey   model.DeploymentKey
	RequestKey      model.RequestKey
	StartTime       time.Time
	Verb            *schema.Ref
	RequestMethod   string
	RequestPath     string
	RequestHeaders  http.Header
	ResponseStatus  int
	ResponseHeaders http.Header
	RequestBody     []byte
	ResponseBody    []byte
	Error           optional.Option[string]
}

type IngressEvent added in v0.368.0

type IngressEvent struct {
	ID            int64
	DeploymentKey model.DeploymentKey
	RequestKey    optional.Option[model.RequestKey]
	Verb          schema.Ref
	Method        string
	Path          string

	StatusCode     int
	Time           time.Time
	Duration       time.Duration
	Request        json.RawMessage
	RequestHeader  json.RawMessage
	Response       json.RawMessage
	ResponseHeader json.RawMessage
	Error          optional.Option[string]
}

func (*IngressEvent) GetID added in v0.368.0

func (e *IngressEvent) GetID() int64

type Log

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

type LogEvent added in v0.367.0

type LogEvent struct {
	ID int64
	Log
}

func (*LogEvent) GetID added in v0.367.0

func (e *LogEvent) GetID() int64

type PubSubConsume added in v0.395.0

type PubSubConsume struct {
	DeploymentKey model.DeploymentKey
	RequestKey    optional.Option[string]
	Time          time.Time
	DestVerb      optional.Option[schema.RefKey]
	Topic         string
	Error         optional.Option[string]
}

type PubSubConsumeEvent added in v0.395.0

type PubSubConsumeEvent struct {
	ID       int64
	Duration time.Duration
	PubSubConsume
}

func (*PubSubConsumeEvent) GetID added in v0.395.0

func (e *PubSubConsumeEvent) GetID() int64

type PubSubPublish added in v0.395.0

type PubSubPublish struct {
	DeploymentKey model.DeploymentKey
	RequestKey    optional.Option[string]
	Time          time.Time
	SourceVerb    schema.Ref
	Topic         string
	Request       *ftlv1.PublishEventRequest
	Error         optional.Option[string]
}

type PubSubPublishEvent added in v0.395.0

type PubSubPublishEvent struct {
	ID       int64
	Duration time.Duration
	Request  json.RawMessage
	PubSubPublish
}

func (*PubSubPublishEvent) GetID added in v0.395.0

func (e *PubSubPublishEvent) GetID() int64

type Service

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

func New

func New(ctx context.Context, conn *stdsql.DB, encryption *encryption.Service) *Service

func (*Service) DeleteOldEvents

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

func (*Service) EnqueueEvent added in v0.373.1

func (s *Service) EnqueueEvent(ctx context.Context, inEvent InEvent)

EnqueueEvent asynchronously enqueues an event for insertion into the timeline.

func (*Service) QueryTimeline

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

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 FilterModule added in v0.375.0

func FilterModule(module string, verb optional.Option[string]) 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