flowviz

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package flowviz builds bounded, privacy-preserving funnel and transition visualizations from pseudonymous sessions and registered route templates.

Index

Constants

View Source
const (
	SchemaVersion      = 1
	MaxConfigBytes     = 64 << 10
	MaxConfigNesting   = 32
	MaxStructuralBytes = 4096
	MaxFunnels         = 16
	MaxStepsPerFunnel  = 16
	MaxNodeBytes       = 512
	DefaultMaxNodes    = 16
	DefaultMaxEdges    = 48
	DefaultMaxSessions = 10000
	HardMaxNodes       = 32
	HardMaxEdges       = 128
	HardMaxSessions    = 10000
	ModeOrdered        = "ordered"
)
View Source
const (
	EnvMode        = "ISUTOOLS_FLOW_VIZ"
	EnvConfig      = "ISUTOOLS_FUNNEL_CONFIG"
	EnvMaxNodes    = "ISUTOOLS_FLOW_MAX_NODES"
	EnvMaxEdges    = "ISUTOOLS_FLOW_MAX_EDGES"
	StatusReady    = "ready"
	StatusDisabled = "disabled"
	StatusPartial  = "partial"
)
View Source
const OtherNode = "(other)"

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

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

func New

func New(options Options) (*Aggregator, error)

func (*Aggregator) Enabled

func (a *Aggregator) Enabled() bool

func (*Aggregator) Observe

func (a *Aggregator) Observe(event Event)

func (*Aggregator) Reset

func (a *Aggregator) Reset()

func (*Aggregator) Snapshot

func (a *Aggregator) Snapshot(transitions []Transition) Snapshot

type Config

type Config struct {
	Version int                `json:"version" yaml:"version"`
	Funnels []FunnelDefinition `json:"funnels,omitempty" yaml:"funnels,omitempty"`
}

func LoadConfig

func LoadConfig(path string) (Config, error)

LoadConfig reads one regular, single-link, bounded YAML or JSON file. Error messages are stable codes and never include configuration contents.

func (Config) Validate

func (c Config) Validate() error

type Event

type Event struct {
	Session  string
	Scenario string
	Method   string
	Route    string
	Status   int
	Latency  time.Duration
	At       time.Time
}

type FunnelDefinition

type FunnelDefinition struct {
	ID       string           `json:"id" yaml:"id"`
	Scenario string           `json:"scenario" yaml:"scenario"`
	Mode     string           `json:"mode" yaml:"mode"`
	Within   string           `json:"within,omitempty" yaml:"within,omitempty"`
	Steps    []StepDefinition `json:"steps" yaml:"steps"`
}

type FunnelSnapshot

type FunnelSnapshot struct {
	ID           string               `json:"id"`
	Scenario     string               `json:"scenario"`
	Mode         string               `json:"mode"`
	Within       string               `json:"within,omitempty"`
	Entered      int64                `json:"entered"`
	Completed    int64                `json:"completed"`
	Expired      int64                `json:"expired,omitempty"`
	ConversionBP int64                `json:"conversion_basis_points"`
	Steps        []FunnelStepSnapshot `json:"steps"`
}

type FunnelStepSnapshot

type FunnelStepSnapshot struct {
	ID             string        `json:"id"`
	Route          string        `json:"route"`
	Sessions       int64         `json:"sessions"`
	Requests       int64         `json:"requests"`
	DropOff        int64         `json:"drop_off"`
	Retries        int64         `json:"retries"`
	Status4xx      int64         `json:"status_4xx"`
	Status5xx      int64         `json:"status_5xx"`
	RequestP95     time.Duration `json:"request_p95_ns"`
	FromStartBP    int64         `json:"from_start_basis_points"`
	FromPreviousBP int64         `json:"from_previous_basis_points"`
}

type GraphEdge

type GraphEdge struct {
	From  string `json:"from"`
	To    string `json:"to"`
	Count int64  `json:"count"`
}

type GraphNode

type GraphNode struct {
	ID    string `json:"id"`
	Count int64  `json:"count"`
}

type GraphSnapshot

type GraphSnapshot struct {
	Nodes       []GraphNode `json:"nodes,omitempty"`
	Edges       []GraphEdge `json:"edges,omitempty"`
	InputEdges  int         `json:"input_edges"`
	HiddenCount int64       `json:"hidden_count,omitempty"`
	Dropped     int64       `json:"dropped,omitempty"`
	Truncated   bool        `json:"truncated,omitempty"`
	Partial     bool        `json:"partial,omitempty"`
}

func BuildGraph

func BuildGraph(transitions []Transition, maxNodes, maxEdges int) GraphSnapshot

func (GraphSnapshot) Canonical

func (g GraphSnapshot) Canonical() string

type Options

type Options struct {
	Enabled     bool
	MaxNodes    int
	MaxEdges    int
	MaxSessions int
	Config      Config
}

type Snapshot

type Snapshot struct {
	Status         string           `json:"status"`
	Reason         string           `json:"reason,omitempty"`
	Partial        bool             `json:"partial,omitempty"`
	SessionDropped int64            `json:"session_dropped,omitempty"`
	TimingMissing  int64            `json:"timing_missing,omitempty"`
	Funnels        []FunnelSnapshot `json:"funnels,omitempty"`
	Graph          GraphSnapshot    `json:"graph"`
}

func CloneSnapshot

func CloneSnapshot(value *Snapshot) *Snapshot

CloneSnapshot returns a deep copy suitable for immutable run handoff.

type StepDefinition

type StepDefinition struct {
	ID    string `json:"id" yaml:"id"`
	Route string `json:"route" yaml:"route"`
}

type Transition

type Transition struct {
	From  string `json:"from"`
	To    string `json:"to"`
	Count int64  `json:"count"`
}

Jump to

Keyboard shortcuts

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