admin

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: 66 Imported by: 0

Documentation

Overview

DynamoStore provides DynamoDB-backed persistence for admin API state (dashboards, saved views, deploy events) as an alternative to file-backed persistence via SetPersistDir.

Index

Constants

This section is empty.

Variables

View Source
var BuildTime = "unknown"
View Source
var Version = "dev"

Version and BuildTime are set via ldflags at build time.

Functions

func AdminAuthMiddleware

func AdminAuthMiddleware(next http.Handler, apiKey string) http.Handler

AdminAuthMiddleware protects admin endpoints with API key authentication. Checks X-Admin-Key header or ?key= query param against the configured key. Health and stream endpoints are excluded to allow monitoring.

Types

type API

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

API is the admin HTTP handler.

func New

func New(cfg *config.Config, registry *routing.Registry, log *gateway.RequestLog, stats *gateway.RequestStats) *API

New creates an admin API handler wired to the given registry, config, and request log/stats.

func NewWithDataPlane

func NewWithDataPlane(cfg *config.Config, registry *routing.Registry, dp *dataplane.DataPlane) *API

NewWithDataPlane creates an admin API handler wired to the given registry, config, and DataPlane. When dp is non-nil, handlers use DataPlane stores for reads/writes instead of the legacy in-memory fields.

func (*API) AppendLazyInitFunc

func (a *API) AppendLazyInitFunc(fn func())

AppendLazyInitFunc appends an additional lazy init function.

func (*API) Broadcaster

func (a *API) Broadcaster() *EventBroadcaster

Broadcaster returns the event broadcaster for use by middleware.

func (*API) ChaosEngine

func (a *API) ChaosEngine() *gateway.ChaosEngine

ChaosEngine returns the configured chaos engine.

func (*API) NotifyRouter

func (a *API) NotifyRouter() *notify.Router

NotifyRouter returns the notification router, or nil if not configured.

func (*API) ServeHTTP

func (a *API) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

func (*API) SetAnnotationStore

func (a *API) SetAnnotationStore(s *annotations.Store)

SetAnnotationStore sets the annotation store for the admin API.

func (*API) SetAnomalyDetector

func (a *API) SetAnomalyDetector(d *anomaly.Detector)

SetAnomalyDetector wires the anomaly detector to the admin API and registers routes.

func (*API) SetAuditLogger

func (a *API) SetAuditLogger(l audit.Logger)

SetAuditLogger sets the audit logger for recording mutating API actions.

func (*API) SetAuthSecret

func (a *API) SetAuthSecret(secret []byte)

SetAuthSecret sets the JWT signing secret.

func (*API) SetCICDStore

func (a *API) SetCICDStore(s cicd.Store)

SetCICDStore sets the CI/CD store for the admin API.

func (*API) SetChaosEngine

func (a *API) SetChaosEngine(engine *gateway.ChaosEngine)

SetChaosEngine sets the chaos engine for the admin API to manage fault injection rules.

func (*API) SetClerkVerifier

func (a *API) SetClerkVerifier(v *clerk.JWTVerifier)

SetClerkVerifier sets the Clerk JWT verifier for authenticating SaaS requests.

func (*API) SetClerkWebhook

func (a *API) SetClerkWebhook(h *clerk.WebhookHandler)

SetClerkWebhook sets the Clerk webhook handler for /api/webhooks/clerk.

func (*API) SetCostEngine

func (a *API) SetCostEngine(engine *cost.Engine)

SetCostEngine wires the cost engine to the admin API.

func (*API) SetDependencyGraph

func (a *API) SetDependencyGraph(g *iac.DependencyGraph)

SetDependencyGraph sets the IaC dependency graph for the topology tree endpoint.

func (*API) SetDynamoStore

func (a *API) SetDynamoStore(ds *DynamoStore)

SetDynamoStore configures DynamoDB-backed persistence for dashboards, views, and deploy events. On startup it loads existing data from DynamoDB.

func (*API) SetErrorStore

func (a *API) SetErrorStore(store errs.ErrorStore)

SetErrorStore wires the error store to the admin API and registers routes.

func (*API) SetIAMEngine

func (a *API) SetIAMEngine(engine *iam.Engine)

SetIAMEngine sets the IAM engine for the admin API to use for policy evaluation.

func (*API) SetIaCResult

func (a *API) SetIaCResult(result *iac.IaCImportResult)

SetIaCResult stores the latest IaC scan result for the diff endpoint. Called by the gateway's watcher callback after each re-scan.

func (*API) SetIncidentService

func (a *API) SetIncidentService(svc *incident.Service)

SetIncidentService sets the incident service for the admin API.

func (*API) SetLambdaLogs

func (a *API) SetLambdaLogs(logs *lambda.LogBuffer)

SetLambdaLogs sets the Lambda log buffer for the admin API to serve.

func (*API) SetLazyInitFunc

func (a *API) SetLazyInitFunc(fn func())

SetLazyInitFunc registers a function to be called once, on first admin API access. Used to defer heavyweight devtools initialization in the minimal profile.

func (*API) SetLocalData

func (a *API) SetLocalData(ld LocalData)

SetLocalData records this instance's on-disk persistence footprint for the /api/local-data endpoints.

func (*API) SetLogStore

func (a *API) SetLogStore(store logstore.LogStore)

SetLogStore wires the log store to the admin API and registers routes.

func (*API) SetMarketplace

func (a *API) SetMarketplace(registry *marketplace.Registry)

SetMarketplace sets the marketplace registry on the admin API and registers routes.

func (*API) SetMicroservices

func (a *API) SetMicroservices(ms []iac.MicroserviceDef)

SetMicroservices sets the IaC-extracted microservice definitions for topology.

func (*API) SetMonitorService

func (a *API) SetMonitorService(svc *monitor.Service)

SetMonitorService sets the monitor service for the admin API.

func (*API) SetNotificationRouter

func (a *API) SetNotificationRouter(nr *notify.Router)

SetNotificationRouter sets the notification router for alert routing.

func (*API) SetOrchestrator

func (a *API) SetOrchestrator(o *provisioning.Orchestrator)

SetOrchestrator sets the provisioning orchestrator for tenant lifecycle.

func (*API) SetPersistDir

func (a *API) SetPersistDir(dir string)

SetPersistDir configures the directory where dashboards, views, and deploys are persisted as JSON files. On startup it loads any existing files. The directory structure is:

{dir}/dashboards/{id}.json
{dir}/views/{id}.json
{dir}/deploys/{id}.json

func (*API) SetPlatformStores

func (a *API) SetPlatformStores(apps *platformstore.AppStore, keys *platformstore.APIKeyStore, audit *platformstore.AuditStore, usage *platformstore.UsageStore, retention *platformstore.RetentionStore)

SetPlatformStores wires the Postgres-backed platform stores for apps, keys, audit, usage, retention.

func (*API) SetPluginInstaller

func (a *API) SetPluginInstaller(inst *marketplace.Installer)

SetPluginInstaller sets the marketplace installer for plugin management.

func (*API) SetPluginManager

func (a *API) SetPluginManager(pm *plugin.Manager)

SetPluginManager sets the plugin manager for the admin API to expose plugin info.

func (*API) SetProfilingEngine

func (a *API) SetProfilingEngine(e *profiling.Engine)

SetProfilingEngine sets the profiling engine for the admin API.

func (*API) SetRUMEngine

func (a *API) SetRUMEngine(engine *rum.Engine)

SetRUMEngine wires the RUM engine to the admin API.

func (*API) SetRegressionEngine

func (a *API) SetRegressionEngine(engine *regression.Engine)

SetRegressionEngine sets the regression detection engine for the admin API.

func (*API) SetReplayStore

func (a *API) SetReplayStore(store replay.Store)

SetReplayStore wires the replay session store to the admin API and registers routes.

func (*API) SetReportGenerator

func (a *API) SetReportGenerator(g *report.Generator)

SetReportGenerator sets the incident report generator for the admin API.

func (*API) SetRequestLog

func (a *API) SetRequestLog(log *gateway.RequestLog, stats *gateway.RequestStats)

SetRequestLog sets the direct in-memory request log and stats on the API. This is needed for topology edge enrichment even when DataPlane is used, because the DataPlane stores requests but the topology enrichment reads from the direct RequestLog.

func (*API) SetSCMConfig

func (a *API) SetSCMConfig(cfg scm.Config)

SetSCMConfig wires a pre-loaded SCM config to the admin API.

func (*API) SetSESStore

func (a *API) SetSESStore(store *ses.Store)

SetSESStore sets the SES store for the admin API to expose captured emails.

func (*API) SetSLOEngine

func (a *API) SetSLOEngine(engine *gateway.SLOEngine)

SetSLOEngine sets the SLO engine for the admin API.

func (*API) SetSecurityScanner

func (a *API) SetSecurityScanner(scanner *security.Scanner)

SetSecurityScanner sets the security scanner on the admin API and registers routes.

func (*API) SetSourceServer

func (a *API) SetSourceServer(ss *SourceServer)

SetSourceServer wires the source server for HTTP event ingestion.

func (*API) SetStripeWebhook

func (a *API) SetStripeWebhook(h *saasstripe.WebhookHandler)

SetStripeWebhook sets the Stripe webhook handler for /api/webhooks/stripe.

func (*API) SetSymbolizer

func (a *API) SetSymbolizer(s *profiling.Symbolizer)

SetSymbolizer sets the source-map symbolizer for the admin API.

func (*API) SetSyntheticsEngine

func (a *API) SetSyntheticsEngine(engine *synthetics.Engine)

SetSyntheticsEngine sets the synthetics engine on the admin API and registers routes.

func (*API) SetTenantStore

func (a *API) SetTenantStore(s tenant.Store)

SetTenantStore sets the SaaS tenant store for hosted-tier endpoints.

func (*API) SetTopologyConfigRaw

func (a *API) SetTopologyConfigRaw(nodesJSON, edgesJSON json.RawMessage)

SetTopologyConfigRaw sets the IaC topology from raw JSON (used by seed file at boot).

func (*API) SetTopologyFromIaC

func (a *API) SetTopologyFromIaC(nodes []TopologyNodeV2, edges []TopologyEdgeV2)

SetTopologyFromIaC sets the topology config from IaC-discovered nodes and edges.

func (*API) SetTraceComparer

func (a *API) SetTraceComparer(tc *tracecompare.Comparer)

SetTraceComparer sets the trace comparer for the /api/traces/compare endpoint.

func (*API) SetTraceStore

func (a *API) SetTraceStore(ts *gateway.TraceStore)

SetTraceStore sets the trace store for the admin API.

func (*API) SetTrafficEngine

func (a *API) SetTrafficEngine(e *traffic.Engine)

SetTrafficEngine sets the traffic recording/replay engine and registers routes.

func (*API) SetUptimeEngine

func (a *API) SetUptimeEngine(engine *uptime.Engine)

SetUptimeEngine wires the uptime engine to the admin API.

func (*API) SetUserStore

func (a *API) SetUserStore(s auth.UserStore)

SetUserStore sets the user store for auth endpoints.

func (*API) SetWebhookDispatcher

func (a *API) SetWebhookDispatcher(d *webhook.Dispatcher)

SetWebhookDispatcher sets the webhook dispatcher for the admin API.

type ActivityFeedItem

type ActivityFeedItem struct {
	Type      string    `json:"type"` // "comment", "annotation", "status_change"
	Timestamp time.Time `json:"timestamp"`
	Actor     string    `json:"actor"`
	Summary   string    `json:"summary"`
	Resource  string    `json:"resource"` // e.g., "incident:abc123"
}

ActivityFeedItem represents a single item in the team activity feed.

type BucketMetric

type BucketMetric struct {
	Calls  int     `json:"calls"`
	AvgMs  float64 `json:"avgMs"`
	Errors int     `json:"errors"`

	P50Ms float64 `json:"p50ms"`
	P95Ms float64 `json:"p95ms"`
	P99Ms float64 `json:"p99ms"`
	// contains filtered or unexported fields
}

BucketMetric holds per-service stats within a time bucket.

type Dashboard

type Dashboard struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description,omitempty"`
	Widgets     []Widget  `json:"widgets"`
	Owner       string    `json:"owner,omitempty"`
	Visibility  string    `json:"visibility,omitempty"` // "private" or "team"
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

Dashboard represents a user-defined dashboard containing widgets.

type DeployEvent

type DeployEvent struct {
	ID        string `json:"id"`
	Timestamp string `json:"timestamp"`
	Service   string `json:"service"`
	Commit    string `json:"commit"`
	Author    string `json:"author"`
	Message   string `json:"message"`
	Branch    string `json:"branch"`
	PR        string `json:"pr,omitempty"`
}

DeployEvent records a deployment for change correlation.

type DynamoStore

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

DynamoStore persists admin state to DynamoDB.

func NewDynamoStore

func NewDynamoStore(db *ds.Store) *DynamoStore

NewDynamoStore creates a DynamoDB-backed admin store.

func (*DynamoStore) DeleteDashboard

func (d *DynamoStore) DeleteDashboard(ctx context.Context, id string) error

DeleteDashboard removes a dashboard.

func (*DynamoStore) DeleteView

func (d *DynamoStore) DeleteView(ctx context.Context, id string) error

DeleteView removes a saved view.

func (*DynamoStore) LoadDashboards

func (d *DynamoStore) LoadDashboards(ctx context.Context) []Dashboard

LoadDashboards returns all dashboards from DynamoDB.

func (*DynamoStore) LoadDeploys

func (d *DynamoStore) LoadDeploys(ctx context.Context) []DeployEvent

LoadDeploys returns all deploy events from DynamoDB.

func (*DynamoStore) LoadViews

func (d *DynamoStore) LoadViews(ctx context.Context) []SavedView

LoadViews returns all saved views from DynamoDB.

func (*DynamoStore) SaveDashboard

func (d *DynamoStore) SaveDashboard(ctx context.Context, dash Dashboard) error

SaveDashboard persists a single dashboard.

func (*DynamoStore) SaveDeploy

func (d *DynamoStore) SaveDeploy(ctx context.Context, deploy DeployEvent) error

SaveDeploy persists a single deploy event.

func (*DynamoStore) SaveView

func (d *DynamoStore) SaveView(ctx context.Context, view SavedView) error

SaveView persists a single saved view.

type ErrorDeployLink struct {
	GroupID string        `json:"group_id"`
	Message string        `json:"message"`
	Release string        `json:"release"`
	Status  string        `json:"status"`
	Count   int           `json:"count"`
	Deploys []DeployEvent `json:"deploys"`
}

ErrorDeployLink links an error group to the deploy(s) it was first seen in, correlating ErrorGroup.Release against known deploy records.

type EventBroadcaster

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

EventBroadcaster fans out SSE events to all connected clients.

func NewEventBroadcaster

func NewEventBroadcaster() *EventBroadcaster

NewEventBroadcaster creates a new EventBroadcaster.

func (*EventBroadcaster) Broadcast

func (b *EventBroadcaster) Broadcast(eventType string, data any)

Broadcast sends a JSON-encoded event to all connected clients. If a client's channel is full, the event is dropped for that client.

func (*EventBroadcaster) Subscribe

func (b *EventBroadcaster) Subscribe() chan string

Subscribe registers a new client channel (buffered, size 100).

func (*EventBroadcaster) Unsubscribe

func (b *EventBroadcaster) Unsubscribe(ch chan string)

Unsubscribe removes a client channel and closes it.

type ExplainAnalysis

type ExplainAnalysis struct {
	IsSlow       bool     `json:"is_slow"`
	IsError      bool     `json:"is_error"`
	P50Ms        float64  `json:"p50_ms"`
	P95Ms        float64  `json:"p95_ms"`
	P99Ms        float64  `json:"p99_ms"`
	LatencyRatio float64  `json:"latency_ratio"` // request latency / p50 (>2 = slow)
	ErrorRate    float64  `json:"error_rate"`    // recent error rate for this service
	SpanCount    int      `json:"span_count"`
	SlowestSpan  string   `json:"slowest_span,omitempty"`
	Anomalies    []string `json:"anomalies,omitempty"`
}

ExplainAnalysis contains pre-computed analysis hints.

type ExplainContext

type ExplainContext struct {
	Request        *gateway.RequestEntry  `json:"request"`
	Trace          *gateway.TraceContext  `json:"trace,omitempty"`
	Timeline       []gateway.TimelineSpan `json:"timeline,omitempty"`
	SimilarRecent  []gateway.RequestEntry `json:"similar_recent"`
	ServiceMetrics any                    `json:"service_metrics,omitempty"`
	Topology       *TopologyResponseV2    `json:"topology_context,omitempty"`
	Analysis       ExplainAnalysis        `json:"analysis"`
	Structured     ExplainStructured      `json:"structured"`
	Narrative      string                 `json:"narrative"`
}

ExplainContext aggregates all data needed for AI analysis of a request.

type ExplainStructured

type ExplainStructured struct {
	ProbableCause    string          `json:"probable_cause"`
	AffectedServices []string        `json:"affected_services"`
	RelatedDeploys   []RelatedDeploy `json:"related_deploys,omitempty"`
	SuggestedFix     string          `json:"suggested_fix,omitempty"`
}

ExplainStructured is a deterministic, machine-readable summary derived from the explain analysis: probable cause, affected services, related deploys, and a suggested fix. (No external LLM — purely rule-based over the gathered data.)

type GridPosition

type GridPosition struct {
	X int `json:"x"`
	Y int `json:"y"`
}

GridPosition is the x,y origin of a widget on the dashboard grid.

type GridSize

type GridSize struct {
	W int `json:"w"`
	H int `json:"h"`
}

GridSize is the width and height of a widget in grid units.

type HealthResponse

type HealthResponse struct {
	Status    string          `json:"status"`
	Services  map[string]bool `json:"services"`
	DataPlane string          `json:"dataplane,omitempty"`
}

HealthResponse is the response body for the /api/health endpoint.

type IAMEvalRequest

type IAMEvalRequest struct {
	Principal string `json:"principal"`
	Action    string `json:"action"`
	Resource  string `json:"resource"`
}

IAMEvalRequest is the request body for the IAM evaluate endpoint.

type IAMEvalResponse

type IAMEvalResponse struct {
	Decision         string         `json:"decision"`
	Reason           string         `json:"reason"`
	MatchedStatement *iam.Statement `json:"matched_statement,omitempty"`
}

IAMEvalResponse is the response for the IAM evaluate endpoint.

type IaCTopologyConfig

type IaCTopologyConfig struct {
	Nodes    []TopologyNodeV2      `json:"nodes"`
	Edges    []TopologyEdgeV2      `json:"edges"`
	Services []iac.MicroserviceDef `json:"services,omitempty"`
}

IaCTopologyConfig holds the topology graph pushed from the IaC layer. Services carries the per-microservice route manifest so the devtools EndpointsTab can render real endpoints for each compute node instead of falling back to the AWS-plugin action registry.

type LocalData

type LocalData struct {
	Project   string   // project/database name; "" when unnamed (default ~/.cloudmock)
	Dir       string   // root data directory (baseDir)
	StateFile string   // snapshot file path; "" when disk persistence is off
	Subdirs   []string // data subdirectories under Dir that a wipe may remove
}

LocalData describes the on-disk persistence footprint of the running cloudmock instance: its named project, the root data directory, the snapshot state file, and the data subdirectories cloudmock manages under the data directory. It is set from the gateway at startup via SetLocalData and powers the /api/local-data endpoints (report + wipe). The shared plugins/ directory is deliberately NOT included so a wipe never deletes plugin binaries.

type MetricQuery

type MetricQuery struct {
	Aggregation string            `json:"aggregation"` // avg, sum, max, min, count, p50, p95, p99
	Metric      string            `json:"metric"`      // latency_ms, request_count, error_count, error_rate
	Filters     map[string]string `json:"filters"`     // service, action, method, status
}

MetricQuery is the parsed representation of a DSL query string such as "avg:latency_ms{service:dynamodb}".

func ParseMetricQuery

func ParseMetricQuery(raw string) (MetricQuery, error)

ParseMetricQuery parses a DSL string like "avg:latency_ms{service:dynamodb,method:POST}" into a MetricQuery. The grammar is:

<aggregation>:<metric>{<key>:<value>,...}

The filter block "{...}" is optional.

type MetricsTimeBucket

type MetricsTimeBucket struct {
	Timestamp time.Time                `json:"timestamp"`
	Services  map[string]*BucketMetric `json:"services"`
}

MetricsTimeBucket is a single time bucket for the timeline endpoint.

type PlatformApp

type PlatformApp struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Slug      string `json:"slug"`
	Endpoint  string `json:"endpoint"`
	InfraType string `json:"infra_type"`
	Status    string `json:"status"`
	Requests  int64  `json:"request_count"`
	CreatedAt string `json:"created_at"`
}

type PlatformAuditEntry

type PlatformAuditEntry struct {
	ID         string `json:"id"`
	Actor      string `json:"actor"`
	ActorType  string `json:"actor_type"`
	Action     string `json:"action"`
	Resource   string `json:"resource"`
	ResourceID string `json:"resource_id"`
	IP         string `json:"ip_address"`
	CreatedAt  string `json:"created_at"`
}

type PlatformKey

type PlatformKey struct {
	ID         string  `json:"id"`
	Prefix     string  `json:"prefix"`
	Name       string  `json:"name"`
	Role       string  `json:"role"`
	LastUsedAt *string `json:"last_used_at"`
	CreatedAt  string  `json:"created_at"`
}

type PlatformStore

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

PlatformStore is an in-memory fallback for local mode (no Postgres).

type QueryBucket

type QueryBucket struct {
	Timestamp time.Time `json:"timestamp"`
	Value     float64   `json:"value"`
}

QueryBucket is a single time bucket in a timeseries query result.

type QueryResult

type QueryResult struct {
	Query   string        `json:"query"`
	Mode    string        `json:"mode"` // "timeseries" or "scalar"
	Scalar  *float64      `json:"scalar,omitempty"`
	Buckets []QueryBucket `json:"buckets,omitempty"`
}

QueryResult is the response from executing a MetricQuery.

func ExecuteQuery

func ExecuteQuery(log *gateway.RequestLog, q MetricQuery, mode string, minutes int, bucketDur time.Duration) QueryResult

ExecuteQuery runs a MetricQuery against the request log in either timeseries or scalar mode. The minutes parameter controls the lookback window. For timeseries mode, bucketDur controls bucket width (defaults to 1m).

type RelatedDeploy

type RelatedDeploy struct {
	Service   string `json:"service"`
	Author    string `json:"author"`
	Commit    string `json:"commit"`
	Message   string `json:"message"`
	Timestamp string `json:"timestamp"`
}

RelatedDeploy is a deploy that occurred near the request's timestamp.

type ReplayResult

type ReplayResult struct {
	OriginalID     string  `json:"original_id"`
	OriginalStatus int     `json:"original_status"`
	OriginalMs     float64 `json:"original_latency_ms"`
	ReplayStatus   int     `json:"replay_status"`
	ReplayMs       float64 `json:"replay_latency_ms"`
	ReplayBody     string  `json:"replay_response_body"`
	Match          bool    `json:"match"`            // status codes match
	LatencyDelta   float64 `json:"latency_delta_ms"` // replay - original
}

ReplayResult captures the result of replaying a captured request.

type Resettable

type Resettable interface {
	Reset()
}

Resettable is an optional interface that services can implement to support state reset.

type ResourcesResponse

type ResourcesResponse struct {
	Service   string `json:"service"`
	Resources any    `json:"resources"`
}

ResourcesResponse is the response body for the /api/resources/:service endpoint.

type SESEmailSummary

type SESEmailSummary struct {
	MessageId string   `json:"message_id"`
	Source    string   `json:"source"`
	To        []string `json:"to"`
	Subject   string   `json:"subject"`
	Timestamp string   `json:"timestamp"`
}

SESEmailSummary is a summary of a captured email for listing.

type SavedView

type SavedView struct {
	ID        string            `json:"id"`
	Name      string            `json:"name"`
	Filters   map[string]string `json:"filters"`
	CreatedBy string            `json:"created_by"`
	CreatedAt string            `json:"created_at"`
}

SavedView represents a named filter preset that users can save and recall.

type ServiceInfo

type ServiceInfo struct {
	Name        string `json:"name"`
	ActionCount int    `json:"action_count"`
	Healthy     bool   `json:"healthy"`
}

ServiceInfo describes a registered service for the admin API.

type ServiceMetrics

type ServiceMetrics struct {
	Service    string  `json:"service"`
	P50Ms      float64 `json:"p50ms"`
	P95Ms      float64 `json:"p95ms"`
	P99Ms      float64 `json:"p99ms"`
	AvgMs      float64 `json:"avgMs"`
	ErrorRate  float64 `json:"errorRate"`
	TotalCalls int     `json:"totalCalls"`
	ErrorCalls int     `json:"errorCalls"`
}

ServiceMetrics holds computed latency percentiles and error rate for a single service.

type SourceServer

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

SourceServer accepts TCP connections from @cloudmock/node (and other SDKs) on a configurable port (default :4580). SDKs send JSON-line messages for every inbound HTTP request they capture. The source server converts these into gateway.RequestEntry objects and injects them into the shared RequestLog.

func NewSourceServer

func NewSourceServer(log *gateway.RequestLog, stats *gateway.RequestStats, bc *EventBroadcaster) *SourceServer

NewSourceServer creates a source server but does not start listening yet.

func (*SourceServer) Close

func (s *SourceServer) Close() error

Close shuts down the listener.

func (*SourceServer) ConnectedSources

func (s *SourceServer) ConnectedSources() []connectedSource

ConnectedSources returns the list of currently connected SDK sources.

func (*SourceServer) EventCount

func (s *SourceServer) EventCount() int64

EventCount returns total events ingested (TCP + HTTP).

func (*SourceServer) HTTPSources

func (s *SourceServer) HTTPSources() []string

HTTPSources returns app names that submitted events via HTTP.

func (*SourceServer) IngestSDKEvent

func (s *SourceServer) IngestSDKEvent(evt sdkEvent) error

IngestSDKEvent converts and ingests a single SDK event (used by HTTP endpoint).

func (*SourceServer) ListenAndServe

func (s *SourceServer) ListenAndServe(addr string) error

ListenAndServe starts accepting TCP connections on the given address. Blocks until the listener is closed.

type TopologyEdgeV2

type TopologyEdgeV2 struct {
	Source       string  `json:"source"`
	Target       string  `json:"target"`
	Type         string  `json:"type"` // "trigger", "read_write", "publish", "subscribe"
	Label        string  `json:"label"`
	Discovered   string  `json:"discovered"`   // "esm", "subscription", "rule", "traffic", "config", "alarm", "cfn"
	AvgLatencyMs float64 `json:"avgLatencyMs"` // average latency in milliseconds (0 = unknown)
	CallCount    int     `json:"callCount"`    // number of observed calls (0 = config-only)
}

TopologyEdgeV2 describes a connection between resources.

type TopologyGroupV2

type TopologyGroupV2 struct {
	ID    string `json:"id"`
	Label string `json:"label"`
	Color string `json:"color"`
}

TopologyGroupV2 describes a visual grouping.

type TopologyNodeV2

type TopologyNodeV2 struct {
	ID             string `json:"id"` // "lambda:attendance-handler" or "external:expo-app"
	Label          string `json:"label"`
	Service        string `json:"service"`
	Type           string `json:"type"`                     // "function", "table", "queue", "topic", "bucket", "client", "plugin"
	Group          string `json:"group"`                    // group ID
	RequestService string `json:"requestService,omitempty"` // service name in request log (e.g. "bff" for external:bff-service)
}

TopologyNodeV2 describes a resource in the topology graph.

type TopologyResponseV2

type TopologyResponseV2 struct {
	Nodes  []TopologyNodeV2  `json:"nodes"`
	Edges  []TopologyEdgeV2  `json:"edges"`
	Groups []TopologyGroupV2 `json:"groups"`
}

TopologyResponseV2 is the dynamic topology response.

type TopologyTreeResponse

type TopologyTreeResponse struct {
	Nodes           []iac.DependencyNode `json:"nodes"`
	Hierarchy       map[string][]string  `json:"hierarchy"`
	DependencyEdges []iac.DependencyEdge `json:"dependencyEdges"`
}

TopologyTreeResponse is the response for GET /api/topology/tree.

type Widget

type Widget struct {
	ID       string       `json:"id"`
	Title    string       `json:"title"`
	Type     string       `json:"type"` // "timeseries", "scalar", "table"
	Query    string       `json:"query"`
	Position GridPosition `json:"position"`
	Size     GridSize     `json:"size"`
}

Widget is a single chart or metric card placed on a dashboard.

Jump to

Keyboard shortcuts

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