devdash

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevEventKind           = "scenery.dev.event"
	DevEventSchemaRevision = "sha256:88d7bd9bd7e38e93de754e8508bde933e9d49d48a5391c29686e11737bb5ba2e"
)
View Source
const (
	DashboardAddr = "127.0.0.1:9401"
	WebSocketPath = "/__scenery"
	ReportPath    = "/__scenery/report"
)

Variables

This section is empty.

Functions

func ListenAddr

func ListenAddr() string

func SortTraceSummariesByDuration

func SortTraceSummariesByDuration(items []*TraceSummary)

Types

type APICallRequest

type APICallRequest struct {
	AppID         string          `json:"app_id"`
	Service       string          `json:"service"`
	Endpoint      string          `json:"endpoint"`
	Path          string          `json:"path"`
	Method        string          `json:"method"`
	Payload       json.RawMessage `json:"payload"`
	AuthPayload   json.RawMessage `json:"auth_payload,omitempty"`
	AuthToken     string          `json:"auth_token,omitempty"`
	CorrelationID string          `json:"correlation_id,omitempty"`
}

type AppRecord

type AppRecord struct {
	RouteID             string
	ID                  string
	BaseAppID           string
	RuntimeAppID        string
	SessionID           string
	Name                string
	Root                string
	ListenAddr          string
	Metadata            json.RawMessage
	APIEncoding         json.RawMessage
	Routes              map[string]string
	Aliases             map[string]string
	Offline             bool
	Running             bool
	SessionStatus       string
	SessionStatusReason string
	Compiling           bool
	CompileError        string
	PID                 string
	UpdatedAt           time.Time
}

type AppStatus

type AppStatus struct {
	Running             bool                `json:"running"`
	AppID               string              `json:"appID"`
	BaseAppID           string              `json:"baseAppID,omitempty"`
	RuntimeAppID        string              `json:"runtimeAppID,omitempty"`
	SessionID           string              `json:"sessionID,omitempty"`
	AppRoot             string              `json:"appRoot"`
	PID                 string              `json:"pid,omitempty"`
	Meta                json.RawMessage     `json:"meta,omitempty"`
	Addr                string              `json:"addr,omitempty"`
	APIEncoding         json.RawMessage     `json:"apiEncoding,omitempty"`
	Observability       *ObservabilityState `json:"observability,omitempty"`
	Routes              map[string]string   `json:"routes,omitempty"`
	Aliases             map[string]string   `json:"aliases,omitempty"`
	SessionStatus       string              `json:"sessionStatus,omitempty"`
	SessionStatusReason string              `json:"sessionStatusReason,omitempty"`
	DashboardBundle     *DashboardBundle    `json:"dashboardBundle,omitempty"`
	Compiling           bool                `json:"compiling"`
	CompileError        string              `json:"compileError,omitempty"`
}

type DashboardBundle added in v0.3.2

type DashboardBundle struct {
	RunningHash string `json:"runningHash,omitempty"`
	DiskHash    string `json:"diskHash,omitempty"`
	DiskPath    string `json:"diskPath,omitempty"`
	Stale       bool   `json:"stale"`
	Warning     string `json:"warning,omitempty"`
}

type DevEvent

type DevEvent struct {
	ID        int64           `json:"id"`
	AppID     string          `json:"-"`
	AppRoot   string          `json:"-"`
	SessionID string          `json:"session_id,omitempty"`
	Source    DevSource       `json:"source"`
	Level     string          `json:"level"`
	Message   string          `json:"message"`
	Fields    json.RawMessage `json:"fields,omitempty"`
	Raw       string          `json:"raw,omitempty"`
	Parse     DevEventParse   `json:"parse"`
	CreatedAt time.Time       `json:"-"`
}

func DevEventFromOutput

func DevEventFromOutput(appID, sessionID string, source DevSource, output []byte, createdAt time.Time) DevEvent

func NewDevEvent

func NewDevEvent(appID, sessionID string, source DevSource, level, message string, fields map[string]any, createdAt time.Time) DevEvent

type DevEventParse

type DevEventParse struct {
	Format string `json:"format"`
	OK     bool   `json:"ok"`
}

type DevEventQuery

type DevEventQuery struct {
	AppID     string
	SessionID string
	SourceID  string
	Kind      string
	Level     string
	Stream    string
	Grep      string
	Since     time.Time
	AfterID   int64
	Limit     int
}

type DevSource

type DevSource struct {
	ID        string `json:"id"`
	Kind      string `json:"kind,omitempty"`
	Name      string `json:"name,omitempty"`
	Role      string `json:"role,omitempty"`
	PID       string `json:"pid,omitempty"`
	Stream    string `json:"stream,omitempty"`
	RestartID string `json:"restart_id,omitempty"`
	Status    string `json:"status,omitempty"`
	URL       string `json:"url,omitempty"`
	Reason    string `json:"reason,omitempty"`
}

type LogEvent

type LogEvent = devreport.LogEvent

type LogLevelCount

type LogLevelCount struct {
	Level string `json:"level"`
	Count int64  `json:"count"`
}

type Notification

type Notification struct {
	Method string `json:"method"`
	Params any    `json:"params"`
}

type ObservabilityBackendState added in v0.3.2

type ObservabilityBackendState struct {
	Enabled   bool   `json:"enabled"`
	Available bool   `json:"available"`
	Status    string `json:"status"`
	URL       string `json:"url,omitempty"`
	QueryPath string `json:"query_path,omitempty"`
	Dialect   string `json:"dialect,omitempty"`
	Message   string `json:"message,omitempty"`
}

type ObservabilityScope added in v0.3.2

type ObservabilityScope struct {
	AppID       string `json:"app_id,omitempty"`
	SessionID   string `json:"session_id,omitempty"`
	AppRootHash string `json:"app_root_hash,omitempty"`
	Worktree    string `json:"worktree,omitempty"`
	Branch      string `json:"branch,omitempty"`
}

type ObservabilityState added in v0.3.2

type ObservabilityState struct {
	Enabled bool                      `json:"enabled"`
	Backend string                    `json:"backend"`
	Metrics ObservabilityBackendState `json:"metrics"`
	Logs    ObservabilityBackendState `json:"logs"`
	Traces  ObservabilityBackendState `json:"traces"`
	Scope   *ObservabilityScope       `json:"scope,omitempty"`
	Message string                    `json:"message,omitempty"`
}

type ProcessEvent

type ProcessEvent struct {
	ID          int64           `json:"id"`
	AppID       string          `json:"app_id"`
	Kind        string          `json:"kind"`
	PayloadJSON json.RawMessage `json:"payload_json"`
	CreatedAt   time.Time       `json:"created_at"`
}

type ProcessOutput

type ProcessOutput struct {
	ID        int64     `json:"id"`
	AppID     string    `json:"appID"`
	SessionID string    `json:"session_id,omitempty"`
	PID       string    `json:"pid"`
	Stream    string    `json:"stream"`
	Output    []byte    `json:"output"`
	CreatedAt time.Time `json:"created_at"`
}

type QueryRequest

type QueryRequest struct {
	Query     string `json:"query"`
	Params    []any  `json:"params"`
	ArrayMode bool   `json:"arrayMode"`
	DbID      string `json:"dbId"`
	AppID     string `json:"appId"`
}

type ReportEnvelope

type ReportEnvelope = devreport.ReportEnvelope

type Store

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

func OpenStore

func OpenStore(cacheRoot string) (*Store, error)

func (*Store) AdvanceDevEventID

func (s *Store) AdvanceDevEventID(ctx context.Context, nextID int64) error

func (*Store) Close

func (s *Store) Close() error

func (*Store) CreateStoredRequest

func (s *Store) CreateStoredRequest(ctx context.Context, req StoredRequest) (StoredRequest, error)

func (*Store) DeleteDevEventsForSession

func (s *Store) DeleteDevEventsForSession(ctx context.Context, appID, sessionID string) (int64, int64, error)

func (*Store) DeleteStoredRequest

func (s *Store) DeleteStoredRequest(ctx context.Context, appID, id string) error

func (*Store) Flush

func (s *Store) Flush(ctx context.Context) error

func (*Store) GetApp

func (s *Store) GetApp(ctx context.Context, appID string) (AppRecord, error)

func (*Store) GetAppForSession

func (s *Store) GetAppForSession(ctx context.Context, appID, sessionID string) (AppRecord, error)

func (*Store) GetAppSession

func (s *Store) GetAppSession(ctx context.Context, routeID string) (AppRecord, error)

func (*Store) ListAppSessions

func (s *Store) ListAppSessions(ctx context.Context) ([]AppRecord, error)

func (*Store) ListApps

func (s *Store) ListApps(ctx context.Context) ([]AppRecord, error)

func (*Store) ListDevEvents

func (s *Store) ListDevEvents(ctx context.Context, query DevEventQuery) ([]DevEvent, error)

func (*Store) ListDevSources

func (s *Store) ListDevSources(ctx context.Context, appID, sessionID string) ([]DevSource, error)

func (*Store) ListProcessEvents

func (s *Store) ListProcessEvents(ctx context.Context, appID string, limit int) ([]ProcessEvent, error)

func (*Store) ListProcessOutput

func (s *Store) ListProcessOutput(ctx context.Context, appID string, limit int) ([]ProcessOutput, error)

func (*Store) ListProcessOutputForSession

func (s *Store) ListProcessOutputForSession(ctx context.Context, appID, sessionID string, limit int) ([]ProcessOutput, error)

func (*Store) ListProcessOutputSince

func (s *Store) ListProcessOutputSince(ctx context.Context, appID string, afterID int64, limit int) ([]ProcessOutput, error)

func (*Store) ListProcessOutputSinceForSession

func (s *Store) ListProcessOutputSinceForSession(ctx context.Context, appID, sessionID string, afterID int64, limit int) ([]ProcessOutput, error)

func (*Store) ListStoredRequests

func (s *Store) ListStoredRequests(ctx context.Context, appID string) ([]StoredRequest, error)

func (*Store) NextDevEventID

func (s *Store) NextDevEventID(ctx context.Context) (int64, error)

func (*Store) UpdateStoredRequest

func (s *Store) UpdateStoredRequest(ctx context.Context, req StoredRequest) (StoredRequest, error)

func (*Store) UpsertApp

func (s *Store) UpsertApp(ctx context.Context, app AppRecord) error

func (*Store) UpsertDevSource

func (s *Store) UpsertDevSource(ctx context.Context, appID, sessionID string, source DevSource) error

func (*Store) WriteDevEvent

func (s *Store) WriteDevEvent(ctx context.Context, event DevEvent) error

func (*Store) WriteDevEventReturningID

func (s *Store) WriteDevEventReturningID(ctx context.Context, event DevEvent) (int64, error)

func (*Store) WriteProcessEvent

func (s *Store) WriteProcessEvent(ctx context.Context, appID, kind string, payload any) error

func (*Store) WriteProcessOutput

func (s *Store) WriteProcessOutput(ctx context.Context, output ProcessOutput) error

type StoredApp added in v0.2.9

type StoredApp struct {
	RouteID             string            `json:"route_id,omitempty"`
	ID                  string            `json:"id"`
	BaseAppID           string            `json:"base_app_id,omitempty"`
	RuntimeAppID        string            `json:"runtime_app_id,omitempty"`
	SessionID           string            `json:"session_id,omitempty"`
	Name                string            `json:"name,omitempty"`
	Root                string            `json:"root,omitempty"`
	ListenAddr          string            `json:"listen_addr,omitempty"`
	Routes              map[string]string `json:"routes,omitempty"`
	Aliases             map[string]string `json:"aliases,omitempty"`
	Offline             bool              `json:"offline,omitempty"`
	Running             bool              `json:"running,omitempty"`
	SessionStatus       string            `json:"session_status,omitempty"`
	SessionStatusReason string            `json:"session_status_reason,omitempty"`
	Compiling           bool              `json:"compiling,omitempty"`
	CompileError        string            `json:"compile_error,omitempty"`
	PID                 string            `json:"pid,omitempty"`
	UpdatedAt           time.Time         `json:"updated_at,omitempty"`
	MetadataRef         string            `json:"metadata_ref,omitempty"`
	MetadataHash        string            `json:"metadata_hash,omitempty"`
	APIEncodingRef      string            `json:"api_encoding_ref,omitempty"`
	APIEncodingHash     string            `json:"api_encoding_hash,omitempty"`
	AppRevision         string            `json:"app_revision,omitempty"`
}

type StoredAppModelRef added in v0.2.9

type StoredAppModelRef struct {
	Ref         string    `json:"ref"`
	Kind        string    `json:"kind"`
	Hash        string    `json:"hash"`
	AppID       string    `json:"app_id"`
	Root        string    `json:"root,omitempty"`
	AppRevision string    `json:"app_revision,omitempty"`
	Path        string    `json:"path,omitempty"`
	Bytes       int64     `json:"bytes,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
}

type StoredAppSession added in v0.2.9

type StoredAppSession struct {
	RouteID             string            `json:"route_id,omitempty"`
	ID                  string            `json:"id"`
	BaseAppID           string            `json:"base_app_id,omitempty"`
	RuntimeAppID        string            `json:"runtime_app_id,omitempty"`
	SessionID           string            `json:"session_id,omitempty"`
	Name                string            `json:"name,omitempty"`
	Root                string            `json:"root,omitempty"`
	ListenAddr          string            `json:"listen_addr,omitempty"`
	Routes              map[string]string `json:"routes,omitempty"`
	Aliases             map[string]string `json:"aliases,omitempty"`
	Offline             bool              `json:"offline,omitempty"`
	Running             bool              `json:"running,omitempty"`
	SessionStatus       string            `json:"session_status,omitempty"`
	SessionStatusReason string            `json:"session_status_reason,omitempty"`
	Compiling           bool              `json:"compiling,omitempty"`
	CompileError        string            `json:"compile_error,omitempty"`
	PID                 string            `json:"pid,omitempty"`
	UpdatedAt           time.Time         `json:"updated_at,omitempty"`
	MetadataRef         string            `json:"metadata_ref,omitempty"`
	MetadataHash        string            `json:"metadata_hash,omitempty"`
	APIEncodingRef      string            `json:"api_encoding_ref,omitempty"`
	APIEncodingHash     string            `json:"api_encoding_hash,omitempty"`
	AppRevision         string            `json:"app_revision,omitempty"`
}

type StoredRequest

type StoredRequest struct {
	ID     string            `json:"id"`
	AppID  string            `json:"-"`
	Title  string            `json:"title"`
	RPC    string            `json:"rpcName"`
	Svc    string            `json:"svcName"`
	Shared bool              `json:"shared"`
	Data   StoredRequestData `json:"data"`
}

type StoredRequestData

type StoredRequestData struct {
	Method     string          `json:"method"`
	PathParams json.RawMessage `json:"pathParams"`
	Payload    json.RawMessage `json:"payload"`
}

type TraceEvent

type TraceEvent = devreport.TraceEvent

type TraceQuery

type TraceQuery struct {
	AppID            string
	SessionID        string
	TraceID          string
	ServiceName      string
	EndpointName     string
	Status           string
	Since            time.Time
	MinDurationNanos uint64
	Limit            int
}

type TraceSummary

type TraceSummary = devreport.TraceSummary

Jump to

Keyboard shortcuts

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