Help us shape the future of Go! Take the 2026 Go Developer Survey

timelineclient

package
v0.510.3 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NullConfig = Config{
	TimelineEndpoint: must.Get(url.Parse("discard://")),
}

Functions

This section is empty.

Types

type Call

type Call struct {
	DeploymentKey    key.Deployment
	RequestKey       key.Request
	ParentRequestKey optional.Option[key.Request]
	StartTime        time.Time
	DestVerb         *schema.Ref
	Callers          []*schema.Ref
	Request          *ftlv1.CallRequest
	Response         result.Result[*ftlv1.CallResponse]
}

func (Call) ToEntry

type ChangesetCreated added in v0.460.0

type ChangesetCreated struct {
	Key       key.Changeset
	CreatedAt time.Time
	Modules   []string // Names of modules being added or modified
	ToRemove  []string // Names of modules being removed
}

ChangesetCreated represents a timeline event for when a changeset is created

func (ChangesetCreated) ToEntry added in v0.460.0

type ChangesetStateChanged added in v0.460.0

type ChangesetStateChanged struct {
	Key   key.Changeset
	State schema.ChangesetState
	Error optional.Option[string] // Present if state is FAILED
}

ChangesetStateChanged represents a timeline event for when a changeset changes state

func (ChangesetStateChanged) ToEntry added in v0.460.0

type Client

type Client struct {
	timelinepbconnect.TimelineServiceClient
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, config Config) *Client

NewClient creates a new Timeline client.

If endpoint is discard:// the client will not create an RPC client or send any RPC requests, and all events will be immediately discarded.

func (*Client) Publish

func (c *Client) Publish(ctx context.Context, event Event)

Publish asynchronously enqueues an event for publication to the timeline.

type Config added in v0.506.0

type Config struct {
	TimelineEndpoint *url.URL `help:"Timeline endpoint (discard:// to disable)." env:"FTL_TIMELINE_ENDPOINT" default:"http://127.0.0.1:8892"`
}

type CronScheduled

type CronScheduled struct {
	DeploymentKey key.Deployment
	Verb          schema.Ref
	Time          time.Time
	ScheduledAt   time.Time
	Schedule      string
	Error         optional.Option[string]
}

func (CronScheduled) ToEntry

type DeploymentRuntime added in v0.460.0

type DeploymentRuntime struct {
	Deployment key.Deployment
	Changeset  optional.Option[key.Changeset]
	Element    *schema.RuntimeElement
	UpdatedAt  time.Time
}

DeploymentRuntime represents a timeline event for deployment runtime changes

func (DeploymentRuntime) ToEntry added in v0.460.0

type Event

type Event interface {
	ToEntry() (*timelinepb.CreateEventsRequest_EventEntry, error)
	// contains filtered or unexported methods
}

type Ingress

type Ingress struct {
	DeploymentKey   key.Deployment
	RequestKey      key.Request
	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]
}

func (Ingress) ToEntry

type Log

type Log struct {
	DeploymentKey key.Deployment
	ChangesetKey  optional.Option[key.Changeset]
	RequestKey    optional.Option[key.Request]
	Time          time.Time
	Level         int32
	Attributes    map[string]string
	Message       string
	Error         optional.Option[string]
}

func (Log) ToEntry

type LogSink added in v0.461.0

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

LogSink is a log sink that sends logs to the timeline client.

It needs to be run in a separate goroutine after creation by calling RunLogLoop.

func NewLogSink added in v0.461.0

func NewLogSink(client *Client, level log.Level) *LogSink

func (*LogSink) Log added in v0.461.0

func (l *LogSink) Log(entry log.Entry) error

Log implements Sink

func (*LogSink) RunLogLoop added in v0.461.0

func (l *LogSink) RunLogLoop(ctx context.Context)

RunLogLoop runs the log loop.

It will run until the context is cancelled.

type Metrics

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

func (*Metrics) Failed

func (m *Metrics) Failed(ctx context.Context, count int)

func (*Metrics) Inserted

func (m *Metrics) Inserted(ctx context.Context, count int)

type PubSubConsume

type PubSubConsume struct {
	DeploymentKey key.Deployment
	RequestKey    optional.Option[string]
	Time          time.Time
	DestVerb      optional.Option[schema.RefKey]
	Topic         string
	Partition     int
	Offset        int
	Error         optional.Option[string]
}

func (PubSubConsume) ToEntry

type PubSubPublish

type PubSubPublish struct {
	DeploymentKey key.Deployment
	RequestKey    optional.Option[string]
	Time          time.Time
	SourceVerb    schema.Ref
	Topic         string
	Partition     int
	Offset        int
	Request       []byte
	Error         optional.Option[string]
}

func (PubSubPublish) ToEntry

Jump to

Keyboard shortcuts

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