flowtelemetry

package
v0.7.25 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package flowtelemetry lets a flow read the platform's own execution traces.

Every hop a flow makes is already recorded as a span. Nothing inside a flow could read them back, so an agent could act on a cluster but was blind to its own automations — it could not answer which of its flows failed, or where. The data was always there; this is the door to it.

Index

Constants

View Source
const (
	ComponentName = "flow_telemetry"
	RequestPort   = "request"
	ResultPort    = "result"
	ErrorPort     = "error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

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

func (*Component) GetInfo

func (c *Component) GetInfo() module.ComponentInfo

func (*Component) Handle

func (c *Component) Handle(ctx context.Context, handler module.Handler, port string, msg any) module.Result

func (*Component) Instance

func (c *Component) Instance() module.Component

func (*Component) OnClient

func (c *Component) OnClient(k8sClient module.K8sClient)

OnClient supplies the namespace the collector runs in. The k8s client itself is unused — the collector is reached over its own service, not the API server — but this is the only hook that reports the namespace.

func (*Component) OnSettings

func (c *Component) OnSettings(_ context.Context, msg any) error

func (*Component) Ports

func (c *Component) Ports() []module.Port

type Context

type Context any

type Request

type Request struct {
	Context Context `json:"context,omitempty" configurable:"true" title:"Context" description:"Passed through to the result unchanged."`
	Project string  `` /* 148-byte string literal not displayed */
	Flow    string  `json:"flow,omitempty" title:"Flow" description:"Limit to one flow. Empty reads every flow in the project."`
	// TraceID switches from listing to detail: an agent lists to find the
	// failing run, then asks for that one to see which hop broke.
	TraceID         string `` /* 145-byte string literal not displayed */
	LookbackMinutes int    `json:"lookbackMinutes,omitempty" title:"Lookback (minutes)" description:"How far back to look when listing. Defaults to 60."`
	ErrorsOnly      bool   `json:"errorsOnly,omitempty" title:"Errors Only" description:"List only traces that recorded at least one error."`
}

type Result

type Result struct {
	Context Context `json:"context,omitempty" title:"Context"`
	Traces  []Trace `json:"traces" title:"Traces" description:"Matching runs, newest first. Empty when a single trace was requested."`
	// Spans is populated only for a single-trace request, so a flow can branch
	// on which shape it asked for without a second field to check.
	Spans       []Span `json:"spans,omitempty" title:"Spans" description:"Hops of the requested trace. Empty when listing."`
	Total       int64  `json:"total" title:"Total" description:"Traces the collector holds for the window, before any filtering."`
	ErrorTraces int    `json:"errorTraces" title:"Error Traces" description:"Traces with at least one error among those scanned."`
	// Scanned and Truncated exist so a partial answer can never be mistaken for
	// a complete one. errorsOnly reads past its results, and a caller deciding
	// "nothing failed" deserves to know whether the whole window was examined.
	Scanned   int  `json:"scanned" title:"Scanned" description:"Traces examined. Below total when the scan stopped early."`
	Truncated bool `` /* 182-byte string literal not displayed */
}

type Settings

type Settings struct {
	// OtelService and OtelPort address the collector. Defaults match what the
	// operator chart installs, so the common case needs no configuration.
	OtelService     string `` /* 140-byte string literal not displayed */
	OtelPort        int    `json:"otelPort" required:"true" title:"Collector Port" description:"Port of the collector's statistics service."`
	Namespace       string `` /* 132-byte string literal not displayed */
	EnableErrorPort bool   `json:"enableErrorPort" title:"Enable Error Port" description:"Emit failures on the error port instead of failing the flow."`
}

type Span

type Span struct {
	ID         string `json:"id" title:"Span ID"`
	Name       string `json:"name" title:"Name"`
	From       string `json:"from,omitempty" title:"From" description:"Source node and port."`
	To         string `json:"to,omitempty" title:"To" description:"Target node and port."`
	DurationMs int64  `json:"durationMs" title:"Duration (ms)"`
}

Span is one hop within a trace: which port sent it, which port received it.

type Trace

type Trace struct {
	ID         string `json:"id" title:"Trace ID"`
	Spans      int64  `json:"spans" title:"Spans" description:"Hops the run made."`
	Errors     int64  `json:"errors" title:"Errors"`
	DurationMs int64  `json:"durationMs" title:"Duration (ms)"`
	StartedAt  string `json:"startedAt" title:"Started At" description:"RFC3339."`
}

Trace is one flow execution, summarised.

Jump to

Keyboard shortcuts

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