Documentation
¶
Index ¶
- Constants
- Variables
- func CaptureConsoleLog(t *testing.T, level runtime.LogLevel) (*bytes.Buffer, func())
- func Debug(format string, args ...any)
- func Error(format string, args ...any)
- func Event(emoji, format string, args ...any)
- func Failure(format string, args ...any)
- func Info(format string, args ...any)
- func QuietTest(t *testing.T) func()
- func SetLogLevel(level runtime.LogLevel)
- func SetUseEmojis(use bool)
- func Start(format string, args ...any)
- func Stop(format string, args ...any)
- func Success(format string, args ...any)
- func ToProtoDiagramEdge(e DiagramEdge) *protos.DiagramEdge
- func ToProtoDiagramNode(n DiagramNode) *protos.DiagramNode
- func ToProtoSystemDiagram(d *SystemDiagram) *protos.SystemDiagram
- func Warn(format string, args ...any)
- type AggregateFunc
- type AggregateOptions
- type AggregateResult
- type BatchGeneratorResult
- type Canvas
- func (c *Canvas) AddGenerator(gen *GeneratorInfo) error
- func (c *Canvas) ApplyFlowStrategy(strategy string) error
- func (c *Canvas) BatchSetParameters(updates map[string]any) (map[string]decl.Value, error)
- func (c *Canvas) Close() error
- func (c *Canvas) CurrentSystem() *runtime.SystemInstance
- func (c *Canvas) EvaluateFlowWithStrategy(strategy string) (*runtime.FlowAnalysisResult, error)
- func (c *Canvas) ExecuteTrace(componentName, methodName string) (*runtime.TraceData, error)
- func (c *Canvas) GetAvailableSystemNames() []string
- func (c *Canvas) GetComponentTotalRPS(componentID string) float64
- func (c *Canvas) GetCurrentFlowRates() map[string]float64
- func (c *Canvas) GetCurrentFlowState() *runtime.FlowState
- func (c *Canvas) GetFlowStrategies() map[string]runtime.StrategyInfo
- func (c *Canvas) GetGenerator(id string) *GeneratorInfo
- func (c *Canvas) GetProposedFlowRates() map[string]float64
- func (c *Canvas) GetRuntime() *runtime.Runtime
- func (c *Canvas) GetSimulationTime() float64
- func (c *Canvas) GetSystemDiagram() (*SystemDiagram, error)
- func (c *Canvas) ListGenerators() map[string]*GeneratorInfo
- func (c *Canvas) Load(filePath string) error
- func (c *Canvas) RemoveGenerator(genId string) error
- func (c *Canvas) Reset() error
- func (c *Canvas) Set(path string, value any) error
- func (c *Canvas) SetComponentArrivalRate(component, method string, rate float64) error
- func (c *Canvas) StartAllGenerators() (*BatchGeneratorResult, error)
- func (c *Canvas) StartGenerator(genId string) error
- func (c *Canvas) StopAllGenerators() (*BatchGeneratorResult, error)
- func (c *Canvas) StopGenerator(genId string) error
- func (c *Canvas) ToProto() *protos.Canvas
- func (c *Canvas) ToggleAllGenerators(start bool) error
- func (c *Canvas) TraceAllPaths(componentName, methodName string, maxDepth int32) (*runtime.AllPathsTraceData, error)
- func (c *Canvas) UpdateGenerator(gen *protos.Generator) error
- func (c *Canvas) Use(systemName string) error
- type CanvasService
- func (s *CanvasService) AddGenerator(ctx context.Context, req *protos.AddGeneratorRequest) (resp *protos.AddGeneratorResponse, err error)
- func (s *CanvasService) AddMetric(ctx context.Context, req *protos.AddMetricRequest) (resp *protos.AddMetricResponse, err error)
- func (s *CanvasService) AggregateMetrics(ctx context.Context, req *protos.AggregateMetricsRequest) (resp *protos.AggregateMetricsResponse, err error)
- func (s *CanvasService) BatchSetParameters(ctx context.Context, req *protos.BatchSetParametersRequest) (resp *protos.BatchSetParametersResponse, err error)
- func (s *CanvasService) CreateCanvas(ctx context.Context, req *protos.CreateCanvasRequest) (resp *protos.CreateCanvasResponse, err error)
- func (s *CanvasService) DeleteCanvas(ctx context.Context, req *protos.DeleteCanvasRequest) (resp *protos.DeleteCanvasResponse, err error)
- func (s *CanvasService) DeleteGenerator(ctx context.Context, req *protos.DeleteGeneratorRequest) (resp *protos.DeleteGeneratorResponse, err error)
- func (s *CanvasService) DeleteMetric(ctx context.Context, req *protos.DeleteMetricRequest) (resp *protos.DeleteMetricResponse, err error)
- func (s *CanvasService) EvaluateFlows(ctx context.Context, req *protos.EvaluateFlowsRequest) (resp *protos.EvaluateFlowsResponse, err error)
- func (s *CanvasService) ExecuteTrace(ctx context.Context, req *protos.ExecuteTraceRequest) (resp *protos.ExecuteTraceResponse, err error)
- func (s *CanvasService) GetCanvas(ctx context.Context, req *protos.GetCanvasRequest) (resp *protos.GetCanvasResponse, err error)
- func (s *CanvasService) GetDefaultCanvas() *Canvas
- func (s *CanvasService) GetFlowState(ctx context.Context, req *protos.GetFlowStateRequest) (resp *protos.GetFlowStateResponse, err error)
- func (s *CanvasService) GetGenerator(ctx context.Context, req *protos.GetGeneratorRequest) (resp *protos.GetGeneratorResponse, err error)
- func (s *CanvasService) GetParameters(ctx context.Context, req *protos.GetParametersRequest) (resp *protos.GetParametersResponse, err error)
- func (s *CanvasService) GetSystemDiagram(ctx context.Context, req *protos.GetSystemDiagramRequest) (resp *protos.GetSystemDiagramResponse, err error)
- func (s *CanvasService) GetUtilization(ctx context.Context, req *protos.GetUtilizationRequest) (resp *protos.GetUtilizationResponse, err error)
- func (s *CanvasService) ListCanvases(ctx context.Context, req *protos.ListCanvasesRequest) (resp *protos.ListCanvasesResponse, err error)
- func (s *CanvasService) ListGenerators(ctx context.Context, req *protos.ListGeneratorsRequest) (resp *protos.ListGeneratorsResponse, err error)
- func (s *CanvasService) ListMetrics(ctx context.Context, req *protos.ListMetricsRequest) (resp *protos.ListMetricsResponse, err error)
- func (s *CanvasService) LoadFile(ctx context.Context, req *protos.LoadFileRequest) (resp *protos.LoadFileResponse, err error)
- func (s *CanvasService) QueryMetrics(ctx context.Context, req *protos.QueryMetricsRequest) (resp *protos.QueryMetricsResponse, err error)
- func (s *CanvasService) ResetCanvas(ctx context.Context, req *protos.ResetCanvasRequest) (resp *protos.ResetCanvasResponse, err error)
- func (s *CanvasService) SetParameter(ctx context.Context, req *protos.SetParameterRequest) (resp *protos.SetParameterResponse, err error)
- func (s *CanvasService) StartAllGenerators(ctx context.Context, req *protos.StartAllGeneratorsRequest) (resp *protos.StartAllGeneratorsResponse, err error)
- func (s *CanvasService) StartGenerator(ctx context.Context, req *protos.StartGeneratorRequest) (resp *protos.StartGeneratorResponse, err error)
- func (s *CanvasService) StopAllGenerators(ctx context.Context, req *protos.StopAllGeneratorsRequest) (resp *protos.StopAllGeneratorsResponse, err error)
- func (s *CanvasService) StopGenerator(ctx context.Context, req *protos.StopGeneratorRequest) (resp *protos.StopGeneratorResponse, err error)
- func (s *CanvasService) StreamMetrics(req *protos.StreamMetricsRequest, ...) error
- func (s *CanvasService) TraceAllPaths(ctx context.Context, req *protos.TraceAllPathsRequest) (resp *protos.TraceAllPathsResponse, err error)
- func (s *CanvasService) UpdateGenerator(ctx context.Context, req *protos.UpdateGeneratorRequest) (resp *protos.UpdateGeneratorResponse, err error)
- func (s *CanvasService) UseSystem(ctx context.Context, req *protos.UseSystemRequest) (resp *protos.UseSystemResponse, err error)
- type ClientMgr
- type ConsoleLogger
- func (l *ConsoleLogger) Event(emoji, format string, args ...any)
- func (l *ConsoleLogger) Failure(format string, args ...any)
- func (l *ConsoleLogger) SetUseEmojis(use bool)
- func (l *ConsoleLogger) Start(format string, args ...any)
- func (l *ConsoleLogger) Stop(format string, args ...any)
- func (l *ConsoleLogger) Success(format string, args ...any)
- type DiagramEdge
- type DiagramNode
- type ExactMatcher
- type FilesystemMeta
- type FilesystemService
- func (s *FilesystemService) CreateDirectory(ctx context.Context, req *protos.CreateDirectoryRequest) (*protos.CreateDirectoryResponse, error)
- func (s *FilesystemService) DeleteFile(ctx context.Context, req *protos.DeleteFileRequest) (*protos.DeleteFileResponse, error)
- func (s *FilesystemService) GetCompositeFS() *loader.CompositeFS
- func (s *FilesystemService) GetFileInfo(ctx context.Context, req *protos.GetFileInfoRequest) (*protos.GetFileInfoResponse, error)
- func (s *FilesystemService) ListFiles(ctx context.Context, req *protos.ListFilesRequest) (*protos.ListFilesResponse, error)
- func (s *FilesystemService) ListFilesystems(ctx context.Context, req *protos.ListFilesystemsRequest) (*protos.ListFilesystemsResponse, error)
- func (s *FilesystemService) MountGitHub()
- func (s *FilesystemService) MountHTTP()
- func (s *FilesystemService) MountLocal(id, basePath string, readOnly bool, extensions []string)
- func (s *FilesystemService) ReadFile(ctx context.Context, req *protos.ReadFileRequest) (*protos.ReadFileResponse, error)
- func (s *FilesystemService) WriteFile(ctx context.Context, req *protos.WriteFileRequest) (*protos.WriteFileResponse, error)
- type GeneratorInfo
- type MethodInfo
- type MetricPoint
- type MetricSpec
- type MetricStats
- type MetricStore
- type MetricStoreConfig
- type MetricStoreFactory
- type MetricTracer
- func (mt *MetricTracer) AddMetricSpec(spec *MetricSpec) error
- func (mt *MetricTracer) AggregateMetrics(ctx context.Context, specId string, opts AggregateOptions) (AggregateResult, error)
- func (mt *MetricTracer) Clear()
- func (mt *MetricTracer) Enter(ts core.Duration, kind runtime.TraceEventKind, comp *runtime.ComponentInstance, ...) int64
- func (mt *MetricTracer) Exit(ts core.Duration, duration core.Duration, comp *runtime.ComponentInstance, ...)
- func (mt *MetricTracer) GetMetricByID(id string) *protos.Metric
- func (mt *MetricTracer) GetMetricSpec(specId string) (spec *MetricSpec)
- func (mt *MetricTracer) GetMetricStore() MetricStore
- func (mt *MetricTracer) ListMetricSpec() []*MetricSpec
- func (mt *MetricTracer) ListMetrics() []*protos.Metric
- func (mt *MetricTracer) PopParent()
- func (mt *MetricTracer) PushParentID(id int64)
- func (mt *MetricTracer) QueryMetrics(ctx context.Context, specId string, opts QueryOptions) (QueryResult, error)
- func (mt *MetricTracer) RemoveMetricSpec(specId string)
- func (mt *MetricTracer) SetMetricStore(store MetricStore)
- type MetricType
- type MetricUpdateBatch
- type MetricUpdateItem
- type NotMatcher
- type QueryOptions
- type QueryResult
- type ResultMatcher
- type RingBufferStore
- func (s *RingBufferStore) Aggregate(ctx context.Context, metric *protos.Metric, opts AggregateOptions) (AggregateResult, error)
- func (s *RingBufferStore) Close() error
- func (s *RingBufferStore) GetMetricStats(metric *protos.Metric) MetricStats
- func (s *RingBufferStore) Query(ctx context.Context, metric *protos.Metric, opts QueryOptions) (QueryResult, error)
- func (s *RingBufferStore) QueryMultiple(ctx context.Context, metrics []*protos.Metric, opts QueryOptions) (map[string]QueryResult, error)
- func (s *RingBufferStore) Subscribe(ctx context.Context, metricIDs []string) (<-chan *MetricUpdateBatch, error)
- func (s *RingBufferStore) WriteBatch(ctx context.Context, metric *protos.Metric, points []*MetricPoint) error
- func (s *RingBufferStore) WritePoint(ctx context.Context, metric *protos.Metric, point *MetricPoint) error
- type SystemCatalogService
- type SystemDiagram
- type SystemInfo
- type SystemProject
- type SystemVersion
- type SystemsServiceImpl
- func (s *SystemsServiceImpl) GetSystem(ctx context.Context, req *v1.GetSystemRequest) (*v1.GetSystemResponse, error)
- func (s *SystemsServiceImpl) GetSystemContent(ctx context.Context, req *v1.GetSystemContentRequest) (*v1.GetSystemContentResponse, error)
- func (s *SystemsServiceImpl) ListSystems(ctx context.Context, req *v1.ListSystemsRequest) (*v1.ListSystemsResponse, error)
- type TimeBucket
Constants ¶
const ( // RingBuffer configuration ConfigRingBufferSize = "size" // number of points per metric ConfigRingBufferDuration = "duration" // time window to retain // Database configuration ConfigDBConnection = "connection" // connection string ConfigDBRetention = "retention" // data retention period ConfigDBBatchSize = "batch_size" // write batch size )
Common configuration keys
const APP_ID = "sdl"
Variables ¶
var ErrNoSuchEntity = errors.New("entity not found")
Functions ¶
func CaptureConsoleLog ¶
CaptureConsoleLog captures console log output during test execution
func ToProtoDiagramEdge ¶
func ToProtoDiagramEdge(e DiagramEdge) *protos.DiagramEdge
func ToProtoDiagramNode ¶
func ToProtoDiagramNode(n DiagramNode) *protos.DiagramNode
func ToProtoSystemDiagram ¶
func ToProtoSystemDiagram(d *SystemDiagram) *protos.SystemDiagram
Types ¶
type AggregateFunc ¶
type AggregateFunc string
AggregateFunc represents an aggregation function
const ( AggCount AggregateFunc = "count" AggSum AggregateFunc = "sum" AggAvg AggregateFunc = "avg" AggMin AggregateFunc = "min" AggMax AggregateFunc = "max" AggP50 AggregateFunc = "p50" AggP90 AggregateFunc = "p90" AggP95 AggregateFunc = "p95" AggP99 AggregateFunc = "p99" AggRate AggregateFunc = "rate" // points per second AggStdDev AggregateFunc = "stddev" // standard deviation )
type AggregateOptions ¶
type AggregateOptions struct {
// Time range
StartTime time.Time
EndTime time.Time
// Aggregation window (e.g., 1s, 5s, 1m)
Window time.Duration
// Additional tag filters
TagFilters map[string]string
// Aggregation functions to compute
Functions []AggregateFunc
}
AggregateOptions specifies parameters for aggregations
type AggregateResult ¶
type AggregateResult struct {
// Time buckets
Buckets []TimeBucket
// Reference to the metric this result is for
Metric *protos.Metric
// Aggregation window used
Window time.Duration
}
AggregateResult contains time-series aggregation results
type BatchGeneratorResult ¶
type BatchGeneratorResult struct {
TotalGenerators int
ProcessedCount int // started or stopped
AlreadyInStateCount int // already running/stopped
FailedCount int
FailedIDs []string
}
Starts/stops all generators BatchGeneratorResult holds the results of batch generator operations
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
func NewCanvas ¶
NewCanvas creates a new interactive canvas session with a custom runtime. If runtime is nil, a default runtime with no resolvers will be created.
func (*Canvas) AddGenerator ¶
func (c *Canvas) AddGenerator(gen *GeneratorInfo) error
AddGenerator adds a new traffic generator configuration
func (*Canvas) ApplyFlowStrategy ¶
ApplyFlowStrategy applies flows from specified strategy as current arrival rates
func (*Canvas) BatchSetParameters ¶
BatchSetParameters sets multiple parameters atomically
func (*Canvas) CurrentSystem ¶
func (c *Canvas) CurrentSystem() *runtime.SystemInstance
CurrentSystem returns the currently active system
func (*Canvas) EvaluateFlowWithStrategy ¶
func (c *Canvas) EvaluateFlowWithStrategy(strategy string) (*runtime.FlowAnalysisResult, error)
EvaluateFlowWithStrategy evaluates flows using specified strategy
func (*Canvas) ExecuteTrace ¶
ExecuteTrace runs a single method call and returns detailed trace data
func (*Canvas) GetAvailableSystemNames ¶
GetAvailableSystemNames returns all system names from loaded SDL files
func (*Canvas) GetComponentTotalRPS ¶
GetComponentTotalRPS calculates total RPS for a component by summing all its methods
func (*Canvas) GetCurrentFlowRates ¶
GetCurrentFlowRates returns the current (applied) flow rates
func (*Canvas) GetCurrentFlowState ¶
GetCurrentFlowState returns the current flow state
func (*Canvas) GetFlowStrategies ¶
func (c *Canvas) GetFlowStrategies() map[string]runtime.StrategyInfo
GetFlowStrategies returns all available flow strategies
func (*Canvas) GetGenerator ¶
func (c *Canvas) GetGenerator(id string) *GeneratorInfo
func (*Canvas) GetProposedFlowRates ¶
GetProposedFlowRates returns the proposed flow rates (being evaluated)
func (*Canvas) GetRuntime ¶
GetRuntime returns the runtime instance for this canvas
func (*Canvas) GetSimulationTime ¶
GetSimulationTime returns the current simulation time in seconds For now, we return 0 as we don't have virtual time tracking yet
func (*Canvas) GetSystemDiagram ¶
func (c *Canvas) GetSystemDiagram() (*SystemDiagram, error)
GetSystemDiagram returns the system topology with method-level nodes and edges
func (*Canvas) ListGenerators ¶
func (c *Canvas) ListGenerators() map[string]*GeneratorInfo
ListGenerators returns all generator configurations
func (*Canvas) Load ¶
Load parses, validates, and loads an SDL file and all its imports into the session. If the file is already loaded, it will be re-loaded and re-validated to ensure freshness.
func (*Canvas) RemoveGenerator ¶
func (*Canvas) Reset ¶
Reset clears the canvas completely - stops all generators, removes metrics, and resets state
func (*Canvas) Set ¶
Set modifies a component parameter at runtime. The path is a dot-separated string, e.g., "app.cache.HitRate".
func (*Canvas) SetComponentArrivalRate ¶
SetComponentArrivalRate sets a manual arrival rate override
func (*Canvas) StartAllGenerators ¶
func (c *Canvas) StartAllGenerators() (*BatchGeneratorResult, error)
StartAllGenerators starts all generators and returns detailed results
func (*Canvas) StartGenerator ¶
func (*Canvas) StopAllGenerators ¶
func (c *Canvas) StopAllGenerators() (*BatchGeneratorResult, error)
StopAllGenerators stops all generators and returns detailed results
func (*Canvas) StopGenerator ¶
func (*Canvas) ToggleAllGenerators ¶
ToggleAllGenerators toggles all generators (deprecated, use Start/StopAllGenerators)
func (*Canvas) TraceAllPaths ¶
func (c *Canvas) TraceAllPaths(componentName, methodName string, maxDepth int32) (*runtime.AllPathsTraceData, error)
TraceAllPaths performs breadth-first traversal to discover all possible execution paths
func (*Canvas) UpdateGenerator ¶
UpdateGenerator updates an existing traffic generator configuration
type CanvasService ¶
type CanvasService struct {
protoservices.UnimplementedCanvasServiceServer
// contains filtered or unexported fields
}
--- CanvasService struct holds configuration and state ---
func (*CanvasService) AddGenerator ¶
func (s *CanvasService) AddGenerator(ctx context.Context, req *protos.AddGeneratorRequest) (resp *protos.AddGeneratorResponse, err error)
func (*CanvasService) AddMetric ¶
func (s *CanvasService) AddMetric(ctx context.Context, req *protos.AddMetricRequest) (resp *protos.AddMetricResponse, err error)
func (*CanvasService) AggregateMetrics ¶
func (s *CanvasService) AggregateMetrics(ctx context.Context, req *protos.AggregateMetricsRequest) (resp *protos.AggregateMetricsResponse, err error)
AggregateMetrics returns aggregated metric data
func (*CanvasService) BatchSetParameters ¶
func (s *CanvasService) BatchSetParameters(ctx context.Context, req *protos.BatchSetParametersRequest) (resp *protos.BatchSetParametersResponse, err error)
BatchSetParameters sets multiple parameters atomically
func (*CanvasService) CreateCanvas ¶
func (s *CanvasService) CreateCanvas(ctx context.Context, req *protos.CreateCanvasRequest) (resp *protos.CreateCanvasResponse, err error)
func (*CanvasService) DeleteCanvas ¶
func (s *CanvasService) DeleteCanvas(ctx context.Context, req *protos.DeleteCanvasRequest) (resp *protos.DeleteCanvasResponse, err error)
func (*CanvasService) DeleteGenerator ¶
func (s *CanvasService) DeleteGenerator(ctx context.Context, req *protos.DeleteGeneratorRequest) (resp *protos.DeleteGeneratorResponse, err error)
func (*CanvasService) DeleteMetric ¶
func (s *CanvasService) DeleteMetric(ctx context.Context, req *protos.DeleteMetricRequest) (resp *protos.DeleteMetricResponse, err error)
func (*CanvasService) EvaluateFlows ¶
func (s *CanvasService) EvaluateFlows(ctx context.Context, req *protos.EvaluateFlowsRequest) (resp *protos.EvaluateFlowsResponse, err error)
EvaluateFlows evaluates system flows using specified strategy
func (*CanvasService) ExecuteTrace ¶
func (s *CanvasService) ExecuteTrace(ctx context.Context, req *protos.ExecuteTraceRequest) (resp *protos.ExecuteTraceResponse, err error)
func (*CanvasService) GetCanvas ¶
func (s *CanvasService) GetCanvas(ctx context.Context, req *protos.GetCanvasRequest) (resp *protos.GetCanvasResponse, err error)
func (*CanvasService) GetDefaultCanvas ¶
func (s *CanvasService) GetDefaultCanvas() *Canvas
GetDefaultCanvas returns the default canvas
func (*CanvasService) GetFlowState ¶
func (s *CanvasService) GetFlowState(ctx context.Context, req *protos.GetFlowStateRequest) (resp *protos.GetFlowStateResponse, err error)
GetFlowState returns the current flow state
func (*CanvasService) GetGenerator ¶
func (s *CanvasService) GetGenerator(ctx context.Context, req *protos.GetGeneratorRequest) (resp *protos.GetGeneratorResponse, err error)
GetGenerator returns a specific generator
func (*CanvasService) GetParameters ¶
func (s *CanvasService) GetParameters(ctx context.Context, req *protos.GetParametersRequest) (resp *protos.GetParametersResponse, err error)
GetParameters gets parameter values
func (*CanvasService) GetSystemDiagram ¶
func (s *CanvasService) GetSystemDiagram(ctx context.Context, req *protos.GetSystemDiagramRequest) (resp *protos.GetSystemDiagramResponse, err error)
GetSystemDiagram returns the system topology for visualization
func (*CanvasService) GetUtilization ¶
func (s *CanvasService) GetUtilization(ctx context.Context, req *protos.GetUtilizationRequest) (resp *protos.GetUtilizationResponse, err error)
GetUtilization returns resource utilization information
func (*CanvasService) ListCanvases ¶
func (s *CanvasService) ListCanvases(ctx context.Context, req *protos.ListCanvasesRequest) (resp *protos.ListCanvasesResponse, err error)
func (*CanvasService) ListGenerators ¶
func (s *CanvasService) ListGenerators(ctx context.Context, req *protos.ListGeneratorsRequest) (resp *protos.ListGeneratorsResponse, err error)
func (*CanvasService) ListMetrics ¶
func (s *CanvasService) ListMetrics(ctx context.Context, req *protos.ListMetricsRequest) (resp *protos.ListMetricsResponse, err error)
ListMetrics returns all available metrics
func (*CanvasService) LoadFile ¶
func (s *CanvasService) LoadFile(ctx context.Context, req *protos.LoadFileRequest) (resp *protos.LoadFileResponse, err error)
func (*CanvasService) QueryMetrics ¶
func (s *CanvasService) QueryMetrics(ctx context.Context, req *protos.QueryMetricsRequest) (resp *protos.QueryMetricsResponse, err error)
QueryMetrics returns raw metric data points
func (*CanvasService) ResetCanvas ¶
func (s *CanvasService) ResetCanvas(ctx context.Context, req *protos.ResetCanvasRequest) (resp *protos.ResetCanvasResponse, err error)
func (*CanvasService) SetParameter ¶
func (s *CanvasService) SetParameter(ctx context.Context, req *protos.SetParameterRequest) (resp *protos.SetParameterResponse, err error)
SetParameter sets a component parameter value
func (*CanvasService) StartAllGenerators ¶
func (s *CanvasService) StartAllGenerators(ctx context.Context, req *protos.StartAllGeneratorsRequest) (resp *protos.StartAllGeneratorsResponse, err error)
func (*CanvasService) StartGenerator ¶
func (s *CanvasService) StartGenerator(ctx context.Context, req *protos.StartGeneratorRequest) (resp *protos.StartGeneratorResponse, err error)
func (*CanvasService) StopAllGenerators ¶
func (s *CanvasService) StopAllGenerators(ctx context.Context, req *protos.StopAllGeneratorsRequest) (resp *protos.StopAllGeneratorsResponse, err error)
func (*CanvasService) StopGenerator ¶
func (s *CanvasService) StopGenerator(ctx context.Context, req *protos.StopGeneratorRequest) (resp *protos.StopGeneratorResponse, err error)
func (*CanvasService) StreamMetrics ¶
func (s *CanvasService) StreamMetrics(req *protos.StreamMetricsRequest, stream protoservices.CanvasService_StreamMetricsServer) error
StreamMetrics streams real-time metric updates
func (*CanvasService) TraceAllPaths ¶
func (s *CanvasService) TraceAllPaths(ctx context.Context, req *protos.TraceAllPathsRequest) (resp *protos.TraceAllPathsResponse, err error)
func (*CanvasService) UpdateGenerator ¶
func (s *CanvasService) UpdateGenerator(ctx context.Context, req *protos.UpdateGeneratorRequest) (resp *protos.UpdateGeneratorResponse, err error)
func (*CanvasService) UseSystem ¶
func (s *CanvasService) UseSystem(ctx context.Context, req *protos.UseSystemRequest) (resp *protos.UseSystemResponse, err error)
type ClientMgr ¶
type ClientMgr struct {
// contains filtered or unexported fields
}
func NewClientMgr ¶
func (*ClientMgr) ClientContext ¶
func (*ClientMgr) GetCanvasSvcClient ¶
func (c *ClientMgr) GetCanvasSvcClient() v1s.CanvasServiceClient
func (*ClientMgr) GetSystemsSvcClient ¶
func (c *ClientMgr) GetSystemsSvcClient() v1s.SystemsServiceClient
type ConsoleLogger ¶
ConsoleLogger wraps runtime.Logger with console-specific features
func NewConsoleLogger ¶
func NewConsoleLogger(output io.Writer, level runtime.LogLevel) *ConsoleLogger
NewConsoleLogger creates a logger suitable for console output
func (*ConsoleLogger) Event ¶
func (l *ConsoleLogger) Event(emoji, format string, args ...any)
Event logs an event with optional emoji
func (*ConsoleLogger) Failure ¶
func (l *ConsoleLogger) Failure(format string, args ...any)
Failure logs a failure message
func (*ConsoleLogger) SetUseEmojis ¶
func (l *ConsoleLogger) SetUseEmojis(use bool)
SetUseEmojis enables or disables emoji output
func (*ConsoleLogger) Start ¶
func (l *ConsoleLogger) Start(format string, args ...any)
Start logs a start event
func (*ConsoleLogger) Stop ¶
func (l *ConsoleLogger) Stop(format string, args ...any)
Stop logs a stop event
func (*ConsoleLogger) Success ¶
func (l *ConsoleLogger) Success(format string, args ...any)
Success logs a success message
type DiagramEdge ¶
type DiagramEdge struct {
FromID string
ToID string
FromMethod string // Source method name
ToMethod string // Target method name
Label string
Order float64 // Execution order
Condition string // Condition expression if conditional
Probability float64 // Probability of this path
GeneratorID string // ID of originating generator
Color string // Visualization color
}
DiagramEdge represents a connection between nodes
type DiagramNode ¶
type DiagramNode struct {
ID string
Name string
Type string // Component type for display
Methods []MethodInfo
Traffic string // Current traffic flow (e.g., "0 rps")
FullPath string // Full path from system root
Icon string // Icon identifier
}
DiagramNode represents a component in the system diagram
type ExactMatcher ¶
ExactMatcher matches an exact string value
type FilesystemMeta ¶
type FilesystemMeta struct {
ID string
Prefix string
Type string
ReadOnly bool
BasePath string
Extensions []string
}
FilesystemMeta stores metadata about a mounted filesystem
type FilesystemService ¶
type FilesystemService struct {
// contains filtered or unexported fields
}
FilesystemService wraps a loader.FileSystem to provide filesystem operations
func NewFilesystemService ¶
func NewFilesystemService() *FilesystemService
NewFilesystemService creates a new FilesystemService with default filesystems mounted
func NewFilesystemServiceWithLoader ¶
func NewFilesystemServiceWithLoader(l *loader.Loader) *FilesystemService
NewFilesystemServiceWithLoader creates a FilesystemService that wraps an existing loader's filesystem
func (*FilesystemService) CreateDirectory ¶
func (s *FilesystemService) CreateDirectory(ctx context.Context, req *protos.CreateDirectoryRequest) (*protos.CreateDirectoryResponse, error)
CreateDirectory creates a directory
func (*FilesystemService) DeleteFile ¶
func (s *FilesystemService) DeleteFile(ctx context.Context, req *protos.DeleteFileRequest) (*protos.DeleteFileResponse, error)
DeleteFile deletes a file
func (*FilesystemService) GetCompositeFS ¶
func (s *FilesystemService) GetCompositeFS() *loader.CompositeFS
GetCompositeFS returns the underlying composite filesystem
func (*FilesystemService) GetFileInfo ¶
func (s *FilesystemService) GetFileInfo(ctx context.Context, req *protos.GetFileInfoRequest) (*protos.GetFileInfoResponse, error)
GetFileInfo returns information about a file
func (*FilesystemService) ListFiles ¶
func (s *FilesystemService) ListFiles(ctx context.Context, req *protos.ListFilesRequest) (*protos.ListFilesResponse, error)
ListFiles lists files in a directory
func (*FilesystemService) ListFilesystems ¶
func (s *FilesystemService) ListFilesystems(ctx context.Context, req *protos.ListFilesystemsRequest) (*protos.ListFilesystemsResponse, error)
ListFilesystems returns all available filesystems
func (*FilesystemService) MountGitHub ¶
func (s *FilesystemService) MountGitHub()
MountGitHub mounts the GitHub filesystem
func (*FilesystemService) MountHTTP ¶
func (s *FilesystemService) MountHTTP()
MountHTTP mounts the HTTP filesystem
func (*FilesystemService) MountLocal ¶
func (s *FilesystemService) MountLocal(id, basePath string, readOnly bool, extensions []string)
MountLocal mounts a local filesystem at the given ID
func (*FilesystemService) ReadFile ¶
func (s *FilesystemService) ReadFile(ctx context.Context, req *protos.ReadFileRequest) (*protos.ReadFileResponse, error)
ReadFile reads file content
func (*FilesystemService) WriteFile ¶
func (s *FilesystemService) WriteFile(ctx context.Context, req *protos.WriteFileRequest) (*protos.WriteFileResponse, error)
WriteFile writes content to a file
type GeneratorInfo ¶
type GeneratorInfo struct {
*protos.Generator // Use proto type directly
System *sdlruntime.SystemInstance
GenFunc func(iter int)
// contains filtered or unexported fields
}
func (*GeneratorInfo) IsRunning ¶
func (g *GeneratorInfo) IsRunning() bool
IsRunning returns true if the generator is currently running
type MethodInfo ¶
type MethodInfo struct {
Name string
ReturnType string
Traffic float64 // Current traffic rate in RPS
}
MethodInfo represents information about a component method
type MetricPoint ¶
type MetricPoint struct {
// Timestamp of the measurement
Timestamp time.Time
// The actual value
Value float64
// Optional tags for additional dimensions (e.g., "cache_hit": "true")
Tags map[string]string
}
MetricPoint represents a single metric measurement
type MetricSpec ¶
type MetricSpec struct {
*protos.Metric // Use proto type directly
// The system this metric spec applies to
System *runtime.SystemInstance
Matcher ResultMatcher
// contains filtered or unexported fields
}
MetricSpec defines what to measure and how The tracer will use this to collect and process events and create metric points out of them This will corresponding to each "LiveMetric" that can be plotted and will result in a series of points
func (*MetricSpec) ProcessTraceEvent ¶
func (ms *MetricSpec) ProcessTraceEvent(ts core.Duration, duration core.Duration, comp *runtime.ComponentInstance, method *decl.MethodDecl, retVal decl.Value, err error) bool
Handles the next trace event. Returns true if event accepted, false otherwise
func (*MetricSpec) Start ¶
func (ms *MetricSpec) Start()
func (*MetricSpec) Stop ¶
func (ms *MetricSpec) Stop()
type MetricStats ¶
MetricStats contains summary statistics for a metric
type MetricStore ¶
type MetricStore interface {
// WritePoint stores a single metric point for a specific metric
WritePoint(ctx context.Context, metric *protos.Metric, point *MetricPoint) error
// WriteBatch stores multiple metric points for a specific metric
WriteBatch(ctx context.Context, metric *protos.Metric, points []*MetricPoint) error
// Query retrieves raw metric points for a specific metric
Query(ctx context.Context, metric *protos.Metric, opts QueryOptions) (QueryResult, error)
// QueryMultiple retrieves points for multiple metrics (e.g., for correlation)
QueryMultiple(ctx context.Context, metrics []*protos.Metric, opts QueryOptions) (map[string]QueryResult, error)
// Aggregate computes aggregations for a specific metric
Aggregate(ctx context.Context, metric *protos.Metric, opts AggregateOptions) (AggregateResult, error)
// Subscribe creates a subscription for real-time metric updates
Subscribe(ctx context.Context, metricIDs []string) (<-chan *MetricUpdateBatch, error)
// GetMetricStats returns statistics for a metric
GetMetricStats(metric *protos.Metric) MetricStats
// Close cleanly shuts down the store
Close() error
}
MetricStore defines the interface for storing and querying metrics
type MetricStoreConfig ¶
type MetricStoreConfig struct {
// Type of store (e.g., "ringbuffer", "timescaledb", "influxdb")
Type string
// Store-specific configuration
Config map[string]interface{}
}
MetricStoreConfig holds configuration for a metric store
type MetricStoreFactory ¶
type MetricStoreFactory interface {
// CreateStore creates a new metric store with the given configuration
CreateStore(config MetricStoreConfig) (MetricStore, error)
}
MetricStoreFactory creates MetricStore instances
type MetricTracer ¶
type MetricTracer struct {
// contains filtered or unexported fields
}
The main tracer that processes TraceEvents and generates metrics from them
func NewMetricTracer ¶
func NewMetricTracer(system *runtime.SystemInstance, canvas *Canvas) *MetricTracer
func (*MetricTracer) AddMetricSpec ¶
func (mt *MetricTracer) AddMetricSpec(spec *MetricSpec) error
func (*MetricTracer) AggregateMetrics ¶
func (mt *MetricTracer) AggregateMetrics(ctx context.Context, specId string, opts AggregateOptions) (AggregateResult, error)
AggregateMetrics computes aggregations for a metric
func (*MetricTracer) Clear ¶
func (mt *MetricTracer) Clear()
func (*MetricTracer) Enter ¶
func (mt *MetricTracer) Enter(ts core.Duration, kind runtime.TraceEventKind, comp *runtime.ComponentInstance, method *decl.MethodDecl, args ...string) int64
func (*MetricTracer) Exit ¶
func (mt *MetricTracer) Exit(ts core.Duration, duration core.Duration, comp *runtime.ComponentInstance, method *decl.MethodDecl, retVal decl.Value, err error)
Main Tracer interface methods
func (*MetricTracer) GetMetricByID ¶
func (mt *MetricTracer) GetMetricByID(id string) *protos.Metric
GetMetricByID finds a metric by its ID
func (*MetricTracer) GetMetricSpec ¶
func (mt *MetricTracer) GetMetricSpec(specId string) (spec *MetricSpec)
func (*MetricTracer) GetMetricStore ¶
func (mt *MetricTracer) GetMetricStore() MetricStore
GetMetricStore returns the current metric store
func (*MetricTracer) ListMetricSpec ¶
func (mt *MetricTracer) ListMetricSpec() []*MetricSpec
func (*MetricTracer) ListMetrics ¶
func (mt *MetricTracer) ListMetrics() []*protos.Metric
ListMetrics returns all configured metrics with statistics
func (*MetricTracer) PopParent ¶
func (mt *MetricTracer) PopParent()
PopParent removes the most recent event ID from the stack.
func (*MetricTracer) PushParentID ¶
func (mt *MetricTracer) PushParentID(id int64)
PushParentID manually pushes a parent ID onto the stack. Used by the aggregator to set the context for evaluating futures.
func (*MetricTracer) QueryMetrics ¶
func (mt *MetricTracer) QueryMetrics(ctx context.Context, specId string, opts QueryOptions) (QueryResult, error)
QueryMetrics queries metrics from the store
func (*MetricTracer) RemoveMetricSpec ¶
func (mt *MetricTracer) RemoveMetricSpec(specId string)
func (*MetricTracer) SetMetricStore ¶
func (mt *MetricTracer) SetMetricStore(store MetricStore)
SetMetricStore sets a custom metric store
type MetricType ¶
type MetricType = string
MetricType represents the type of metric being measured
const ( // MetricCount tracks the number of events MetricCount MetricType = "count" // MetricLatency tracks duration values MetricLatency MetricType = "latency" // MetricUtilization tracks resource utilization (0.0 to 1.0) MetricUtilization MetricType = "utilization" )
type MetricUpdateBatch ¶
type MetricUpdateBatch struct {
Updates []*MetricUpdateItem
}
MetricUpdateBatch contains metric updates that can be sent to subscribers
type MetricUpdateItem ¶
type MetricUpdateItem struct {
MetricID string
Point *MetricPoint
}
MetricUpdateItem represents a single metric update
type NotMatcher ¶
type NotMatcher struct {
Inner ResultMatcher
}
NotMatcher inverts the match result
type QueryOptions ¶
type QueryOptions struct {
// Time range
StartTime time.Time
EndTime time.Time
// Additional tag filters
TagFilters map[string]string
// Maximum number of results
Limit int
// Offset for pagination
Offset int
}
QueryOptions specifies parameters for metric queries
type QueryResult ¶
type QueryResult struct {
Points []*MetricPoint
TotalRows int64
HasMore bool
}
QueryResult contains the results of a metric query
type ResultMatcher ¶
ResultMatcher determines if a return value matches the expected result
func CreateResultMatcher ¶
func CreateResultMatcher(spec string) ResultMatcher
Helper function to create a result matcher from a string specification
type RingBufferStore ¶
type RingBufferStore struct {
// contains filtered or unexported fields
}
RingBufferStore implements MetricStore using in-memory ring buffers
func NewRingBufferStore ¶
func NewRingBufferStore(config MetricStoreConfig) (*RingBufferStore, error)
NewRingBufferStore creates a new ring buffer metric store
func (*RingBufferStore) Aggregate ¶
func (s *RingBufferStore) Aggregate(ctx context.Context, metric *protos.Metric, opts AggregateOptions) (AggregateResult, error)
Aggregate computes aggregations over time windows
func (*RingBufferStore) Close ¶
func (s *RingBufferStore) Close() error
func (*RingBufferStore) GetMetricStats ¶
func (s *RingBufferStore) GetMetricStats(metric *protos.Metric) MetricStats
GetMetricStats returns statistics for a specific metric
func (*RingBufferStore) Query ¶
func (s *RingBufferStore) Query(ctx context.Context, metric *protos.Metric, opts QueryOptions) (QueryResult, error)
Query retrieves raw metric points
func (*RingBufferStore) QueryMultiple ¶
func (s *RingBufferStore) QueryMultiple(ctx context.Context, metrics []*protos.Metric, opts QueryOptions) (map[string]QueryResult, error)
QueryMultiple retrieves points for multiple metrics
func (*RingBufferStore) Subscribe ¶
func (s *RingBufferStore) Subscribe(ctx context.Context, metricIDs []string) (<-chan *MetricUpdateBatch, error)
Close shuts down the store Subscribe creates a subscription for real-time metric updates
func (*RingBufferStore) WriteBatch ¶
func (s *RingBufferStore) WriteBatch(ctx context.Context, metric *protos.Metric, points []*MetricPoint) error
WriteBatch stores multiple metric points efficiently
func (*RingBufferStore) WritePoint ¶
func (s *RingBufferStore) WritePoint(ctx context.Context, metric *protos.Metric, point *MetricPoint) error
WritePoint stores a single metric point
type SystemCatalogService ¶
type SystemCatalogService struct {
// contains filtered or unexported fields
}
SystemCatalogService manages the system examples catalog
func NewSystemCatalogService ¶
func NewSystemCatalogService() *SystemCatalogService
NewSystemCatalogService creates a new system catalog service
func (*SystemCatalogService) GetSystem ¶
func (s *SystemCatalogService) GetSystem(id string) *SystemProject
GetSystem returns a specific system project
func (*SystemCatalogService) ListSystems ¶
func (s *SystemCatalogService) ListSystems() []SystemInfo
ListSystems returns all systems as SystemInfo
type SystemDiagram ¶
type SystemDiagram struct {
SystemName string
Nodes []DiagramNode
Edges []DiagramEdge
}
SystemDiagram represents the visual structure of a system
type SystemInfo ¶
type SystemInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Category string `json:"category"`
Difficulty string `json:"difficulty"`
Tags []string `json:"tags"`
Icon string `json:"icon,omitempty"`
LastUpdated string `json:"lastUpdated"`
}
SystemInfo represents a system in the catalog
type SystemProject ¶
type SystemProject struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Category string `json:"category"`
Difficulty string `json:"difficulty"`
Tags []string `json:"tags"`
Icon string `json:"icon,omitempty"`
Versions map[string]SystemVersion `json:"versions"`
DefaultVersion string `json:"defaultVersion"`
LastUpdated string `json:"lastUpdated"`
// contains filtered or unexported fields
}
SystemProject represents a full system project
type SystemVersion ¶
type SystemVersion struct {
SDL string `json:"sdl"`
Recipe string `json:"recipe"`
Readme string `json:"readme,omitempty"`
}
SystemVersion represents a version of a system
type SystemsServiceImpl ¶
type SystemsServiceImpl struct {
// contains filtered or unexported fields
}
SystemsServiceImpl implements the SystemsService gRPC interface
func NewSystemsService ¶
func NewSystemsService() *SystemsServiceImpl
NewSystemsService creates a new SystemsService implementation
func (*SystemsServiceImpl) GetSystem ¶
func (s *SystemsServiceImpl) GetSystem(ctx context.Context, req *v1.GetSystemRequest) (*v1.GetSystemResponse, error)
GetSystem returns a specific system with metadata
func (*SystemsServiceImpl) GetSystemContent ¶
func (s *SystemsServiceImpl) GetSystemContent(ctx context.Context, req *v1.GetSystemContentRequest) (*v1.GetSystemContentResponse, error)
GetSystemContent returns the SDL and recipe content for a system
func (*SystemsServiceImpl) ListSystems ¶
func (s *SystemsServiceImpl) ListSystems(ctx context.Context, req *v1.ListSystemsRequest) (*v1.ListSystemsResponse, error)
ListSystems returns all available systems
type TimeBucket ¶
type TimeBucket struct {
// Start time of this bucket
Time time.Time
// Aggregated values keyed by function name
Values map[AggregateFunc]float64
// Number of points in this bucket
Count int64
}
TimeBucket represents aggregated metrics for a time window