dataplane

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func InitTracer

func InitTracer(ctx context.Context, cfg config.OTelConfig) (func(context.Context) error, error)

InitTracer sets up the OTel trace provider for production mode. Returns a shutdown function that flushes pending spans.

Types

type ConfigStore

type ConfigStore interface {
	GetConfig(ctx context.Context) (*config.Config, error)
	SetConfig(ctx context.Context, cfg *config.Config) error
	ListDeploys(ctx context.Context, filter DeployFilter) ([]DeployEvent, error)
	AddDeploy(ctx context.Context, deploy DeployEvent) error
	ListViews(ctx context.Context) ([]SavedView, error)
	SaveView(ctx context.Context, view SavedView) error
	DeleteView(ctx context.Context, id string) error
	ListServices(ctx context.Context) ([]ServiceEntry, error)
	UpsertService(ctx context.Context, svc ServiceEntry) error
}

type DataPlane

type DataPlane struct {
	Traces      TraceReader
	TraceW      TraceWriter
	Requests    RequestReader
	RequestW    RequestWriter
	Metrics     MetricReader
	MetricW     MetricWriter
	SLO         SLOStore
	Config      ConfigStore
	Topology    TopologyStore
	Preferences PreferenceStore
	Mode        string
}

type DeployEvent

type DeployEvent struct {
	ID          string
	Service     string
	Version     string
	CommitSHA   string
	Author      string
	Description string
	DeployedAt  time.Time
	Metadata    map[string]string
}

type DeployFilter

type DeployFilter struct {
	Service string
	Limit   int
}

type LatencyPercentiles

type LatencyPercentiles struct {
	P50Ms float64
	P95Ms float64
	P99Ms float64
}

type MetricReader

type MetricReader interface {
	ServiceStats(ctx context.Context, service string, window time.Duration) (*ServiceMetrics, error)
	Percentiles(ctx context.Context, service, action string, window time.Duration) (*LatencyPercentiles, error)
}

type MetricWriter

type MetricWriter interface {
	Record(ctx context.Context, service, action string, latencyMs float64, statusCode int) error
}

type ObservedEdge

type ObservedEdge struct {
	Source       string
	Target       string
	EdgeType     string
	RequestCount int64
}

type PreferenceStore

type PreferenceStore interface {
	Get(ctx context.Context, namespace, key string) (json.RawMessage, error)
	Set(ctx context.Context, namespace, key string, value json.RawMessage) error
	Delete(ctx context.Context, namespace, key string) error
	ListByNamespace(ctx context.Context, namespace string) (map[string]json.RawMessage, error)
}

PreferenceStore provides backend-persisted key-value storage for user preferences, replacing frontend localStorage/sessionStorage.

type RequestEntry

type RequestEntry struct {
	ID             string
	TraceID        string
	SpanID         string
	Timestamp      time.Time
	Service        string
	Action         string
	Method         string
	Path           string
	StatusCode     int
	Latency        time.Duration
	LatencyMs      float64
	CallerID       string
	Error          string
	Level          string
	MemAllocKB     float64
	Goroutines     int
	RequestHeaders map[string]string
	RequestBody    string
	ResponseBody   string
	TenantID       string
	OrgID          string
	UserID         string
}

type RequestFilter

type RequestFilter struct {
	Service      string
	Path         string
	Method       string
	CallerID     string
	Action       string
	ErrorOnly    bool
	TraceID      string
	Level        string
	Limit        int
	TenantID     string
	OrgID        string
	UserID       string
	MinLatencyMs float64
	MaxLatencyMs float64
	From         time.Time
	To           time.Time
}

type RequestReader

type RequestReader interface {
	Query(ctx context.Context, filter RequestFilter) ([]RequestEntry, error)
	GetByID(ctx context.Context, id string) (*RequestEntry, error)
}

type RequestWriter

type RequestWriter interface {
	Write(ctx context.Context, entry RequestEntry) error
}

type SLOAlert

type SLOAlert struct {
	Service string
	Action  string
	Message string
}

type SLORuleChange

type SLORuleChange struct {
	RuleID     string
	ChangeType string
	OldValues  *config.SLORule
	NewValues  *config.SLORule
	ChangedBy  string
	ChangedAt  time.Time
}

type SLOStatus

type SLOStatus struct {
	Windows []SLOWindowStatus
	Healthy bool
	Alerts  []SLOAlert
}

type SLOStore

type SLOStore interface {
	Rules(ctx context.Context) ([]config.SLORule, error)
	SetRules(ctx context.Context, rules []config.SLORule) error
	Status(ctx context.Context) (*SLOStatus, error)
	History(ctx context.Context, limit int) ([]SLORuleChange, error)
}

type SLOWindowStatus

type SLOWindowStatus struct {
	Service    string
	Action     string
	Total      int64
	Violations int64
	Errors     int64
	ErrorRate  float64
	BudgetUsed float64
	BurnRate   float64
	P50Ms      float64
	P95Ms      float64
	P99Ms      float64
	Breaching  bool
}

type SavedView

type SavedView struct {
	ID        string
	Name      string
	Filters   map[string]any
	CreatedBy string
	CreatedAt time.Time
}

type ServiceEntry

type ServiceEntry struct {
	Name        string
	ServiceType string
	GroupName   string
	Description string
	Owner       string
	RepoURL     string
}

type ServiceMetrics

type ServiceMetrics struct {
	Service      string
	RequestCount int64
	ErrorCount   int64
	ErrorRate    float64
	P50Ms        float64
	P95Ms        float64
	P99Ms        float64
}

type Span

type Span struct {
	TraceID      string
	SpanID       string
	ParentSpanID string
	Service      string
	Action       string
	Method       string
	Path         string
	StartTime    time.Time
	EndTime      time.Time
	DurationNs   uint64
	StatusCode   int
	Error        string
	TenantID     string
	OrgID        string
	UserID       string
	MemAllocKB   float64
	Goroutines   uint32
	Metadata     map[string]string
	ReqHeaders   map[string]string
	ReqBody      string
	RespBody     string
}

type TimelineSpan

type TimelineSpan struct {
	SpanID        string
	ParentSpanID  string
	Service       string
	Action        string
	StartOffsetMs float64
	DurationMs    float64
	StatusCode    int
	Error         string
	Depth         int
	Metadata      map[string]string
}

type TopologyGraph

type TopologyGraph struct {
	Nodes []TopologyNode
	Edges []ObservedEdge
}

type TopologyNode

type TopologyNode struct {
	Name        string
	ServiceType string
	Group       string
}

type TopologyStore

type TopologyStore interface {
	GetTopology(ctx context.Context) (*TopologyGraph, error)
	RecordEdge(ctx context.Context, edge ObservedEdge) error
	Upstream(ctx context.Context, service string) ([]string, error)
	Downstream(ctx context.Context, service string) ([]string, error)
}

type TraceContext

type TraceContext struct {
	TraceID      string
	SpanID       string
	ParentSpanID string
	Service      string
	Action       string
	Method       string
	Path         string
	StartTime    time.Time
	EndTime      time.Time
	Duration     time.Duration
	DurationMs   float64
	StatusCode   int
	Error        string
	Children     []*TraceContext
	Metadata     map[string]string
}

type TraceFilter

type TraceFilter struct {
	Service  string
	HasError *bool
	TenantID string
	Limit    int
}

type TraceReader

type TraceReader interface {
	Get(ctx context.Context, traceID string) (*TraceContext, error)
	Search(ctx context.Context, filter TraceFilter) ([]TraceSummary, error)
	Timeline(ctx context.Context, traceID string) ([]TimelineSpan, error)
}

type TraceSummary

type TraceSummary struct {
	TraceID     string
	RootService string
	RootAction  string
	Method      string
	Path        string
	DurationMs  float64
	StatusCode  int
	SpanCount   int
	HasError    bool
	StartTime   time.Time
}

type TraceWriter

type TraceWriter interface {
	WriteSpans(ctx context.Context, spans []*Span) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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