dal

package
v0.366.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 15 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 CallEvent

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

func (e *CallEvent) GetID() int64

type DAL

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

func New

func New(conn libdal.Connection, encryption *encryption.Service) *DAL

func (*DAL) DeleteOldEvents

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

func (*DAL) InsertCallEvent

func (d *DAL) InsertCallEvent(ctx context.Context, call *CallEvent) error

func (*DAL) InsertLogEvent

func (d *DAL) InsertLogEvent(ctx context.Context, log *LogEvent) error

func (*DAL) QueryTimeline

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

type DeploymentCreatedEvent

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

func (e *DeploymentCreatedEvent) GetID() int64

type DeploymentUpdatedEvent

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

func (*DeploymentUpdatedEvent) GetID

func (e *DeploymentUpdatedEvent) GetID() int64

type EventType

type EventType = sql.EventType

type LogEvent

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]
	Stack         optional.Option[string]
}

func (*LogEvent) GetID

func (e *LogEvent) GetID() int64

type TimelineEvent

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

TimelineEvent types.

type TimelineFilter

type TimelineFilter func(query *eventFilter)

func FilterCall

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

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

func FilterDescending

func FilterDescending() TimelineFilter

FilterDescending returns events in descending order.

func FilterIDRange

func FilterIDRange(higherThan, lowerThan int64) TimelineFilter

FilterIDRange filters events between the given IDs, inclusive.

func FilterLogLevel

func FilterLogLevel(level log.Level) TimelineFilter

func FilterRequests

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

func FilterTimeRange

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

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