rpctypes

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Command_Message         = "message"
	Command_RouteAnnounce   = "routeannounce"
	Command_RouteUnannounce = "routeunannounce"
	Command_EventRecv       = "eventrecv"
)
View Source
const (
	Event_RouteDown       = "route:down"
	Event_RouteUp         = "route:up"
	Event_AppStatusUpdate = "app:statusupdate"
)

Variables

Functions

This section is empty.

Types

type AppRunGoRoutinesByIdsRequest

type AppRunGoRoutinesByIdsRequest struct {
	AppRunId string  `json:"apprunid"`
	GoIds    []int64 `json:"goids"`
}

AppRunGoRoutinesByIdsRequest defines the request for getting specific goroutines by their IDs

type AppRunGoRoutinesData

type AppRunGoRoutinesData struct {
	AppRunId   string            `json:"apprunid"`
	AppName    string            `json:"appname"`
	GoRoutines []ParsedGoRoutine `json:"goroutines"`
}

type AppRunInfo

type AppRunInfo struct {
	AppRunId            string         `json:"apprunid"`
	AppName             string         `json:"appname"`
	StartTime           int64          `json:"starttime"`
	IsRunning           bool           `json:"isrunning"`
	Status              string         `json:"status"`
	NumLogs             int            `json:"numlogs"`
	NumActiveGoRoutines int            `json:"numactivegoroutines"`
	NumTotalGoRoutines  int            `json:"numtotalgoroutines"`
	NumActiveWatches    int            `json:"numactivewatches"`
	NumTotalWatches     int            `json:"numtotalwatches"`
	LastModTime         int64          `json:"lastmodtime"`
	BuildInfo           *BuildInfoData `json:"buildinfo,omitempty"`
	ModuleName          string         `json:"modulename,omitempty"`
	Executable          string         `json:"executable,omitempty"`
}

App run data types

type AppRunLogsData

type AppRunLogsData struct {
	AppRunId string       `json:"apprunid"`
	AppName  string       `json:"appname"`
	Logs     []ds.LogLine `json:"logs"`
}

type AppRunRequest

type AppRunRequest struct {
	AppRunId string `json:"apprunid"`
	Since    int64  `json:"since,omitempty"`
}

type AppRunRuntimeStatsData

type AppRunRuntimeStatsData struct {
	AppRunId string            `json:"apprunid"`
	AppName  string            `json:"appname"`
	Stats    []RuntimeStatData `json:"stats"`
}

type AppRunUpdatesRequest

type AppRunUpdatesRequest struct {
	Since int64 `json:"since"`
}

type AppRunWatchesByIdsRequest

type AppRunWatchesByIdsRequest struct {
	AppRunId string  `json:"apprunid"`
	WatchIds []int64 `json:"watchids"`
}

AppRunWatchesByIdsRequest defines the request for getting specific watches by their IDs

type AppRunWatchesData

type AppRunWatchesData struct {
	AppRunId string           `json:"apprunid"`
	AppName  string           `json:"appname"`
	Watches  []ds.WatchSample `json:"watches"`
}

type AppRunsData

type AppRunsData struct {
	AppRuns []AppRunInfo `json:"appruns"`
}

type BrowserTabUrlData

type BrowserTabUrlData struct {
	Url        string `json:"url"`
	AppRunId   string `json:"apprunid,omitempty"`
	Focused    bool   `json:"focused"`
	AutoFollow bool   `json:"autofollow"`
}

BrowserTabUrlData represents the data for tracking browser tabs

type BuildInfoData

type BuildInfoData struct {
	GoVersion string            `json:"goversion"`
	Path      string            `json:"path"`
	Version   string            `json:"version,omitempty"`
	Settings  map[string]string `json:"settings,omitempty"`
}

BuildInfoData represents a simplified version of runtime/debug.BuildInfo

type CommandMessageData

type CommandMessageData struct {
	Message string `json:"message"`
}

type DropRequestData

type DropRequestData struct {
	WidgetId string `json:"widgetid"`
}

type EventCommonFields

type EventCommonFields struct {
	Scopes  []string `json:"scopes,omitempty"`
	Sender  string   `json:"sender,omitempty"`
	Persist int      `json:"persist,omitempty"`
}

for FE (for discrimated union)

type EventReadHistoryData

type EventReadHistoryData struct {
	Event    string `json:"event"`
	Scope    string `json:"scope"`
	MaxItems int    `json:"maxitems"`
}

type EventType

type EventType struct {
	Event   string   `json:"event"`
	Scopes  []string `json:"scopes,omitempty"`
	Sender  string   `json:"sender,omitempty"`
	Persist int      `json:"persist,omitempty"`
	Data    any      `json:"data,omitempty"`
}

type FullRpcInterface

type FullRpcInterface interface {
	MessageCommand(ctx context.Context, data CommandMessageData) error

	LogSearchRequestCommand(ctx context.Context, data SearchRequestData) (SearchResultData, error)
	LogWidgetAdminCommand(ctx context.Context, data LogWidgetAdminData) error
	LogStreamUpdateCommand(ctx context.Context, data StreamUpdateData) error
	LogUpdateMarkedLinesCommand(ctx context.Context, data MarkedLinesData) error
	LogGetMarkedLinesCommand(ctx context.Context, data MarkedLinesRequestData) (MarkedLinesResultData, error)

	UpdateStatusCommand(ctx context.Context, data StatusUpdateData) error

	// app run commands
	GetAppRunsCommand(ctx context.Context, data AppRunUpdatesRequest) (AppRunsData, error)
	GetAppRunGoRoutinesCommand(ctx context.Context, data AppRunRequest) (AppRunGoRoutinesData, error)
	GetAppRunWatchesCommand(ctx context.Context, data AppRunRequest) (AppRunWatchesData, error)
	GetAppRunRuntimeStatsCommand(ctx context.Context, data AppRunRequest) (AppRunRuntimeStatsData, error)

	// goroutine search
	GetAppRunGoRoutinesByIdsCommand(ctx context.Context, data AppRunGoRoutinesByIdsRequest) (AppRunGoRoutinesData, error)
	GoRoutineSearchRequestCommand(ctx context.Context, data GoRoutineSearchRequestData) (GoRoutineSearchResultData, error)

	// watch search
	GetAppRunWatchesByIdsCommand(ctx context.Context, data AppRunWatchesByIdsRequest) (AppRunWatchesData, error)
	GetWatchHistoryCommand(ctx context.Context, data WatchHistoryRequest) (WatchHistoryData, error)
	GetWatchNumericCommand(ctx context.Context, data WatchNumericRequest) (WatchNumericData, error)
	WatchSearchRequestCommand(ctx context.Context, data WatchSearchRequestData) (WatchSearchResultData, error)

	// event commands
	EventPublishCommand(ctx context.Context, data EventType) error
	EventSubCommand(ctx context.Context, data SubscriptionRequest) error
	EventUnsubCommand(ctx context.Context, data string) error
	EventUnsubAllCommand(ctx context.Context) error
	EventReadHistoryCommand(ctx context.Context, data EventReadHistoryData) ([]*EventType, error)

	// browser tab tracking
	UpdateBrowserTabUrlCommand(ctx context.Context, data BrowserTabUrlData) error
}

type GoRoutineSearchRequestData

type GoRoutineSearchRequestData struct {
	AppRunId    string `json:"apprunid"`
	SearchTerm  string `json:"searchterm"`
	SystemQuery string `json:"systemquery,omitempty"`
}

GoRoutineSearchRequestData defines the request for goroutine search

type GoRoutineSearchResultData

type GoRoutineSearchResultData struct {
	SearchedCount int               `json:"searchedcount"`
	TotalCount    int               `json:"totalcount"`
	Results       []int64           `json:"results"`
	ErrorSpans    []SearchErrorSpan `json:"errorspans,omitempty"` // Error spans in the search query
}

GoRoutineSearchResultData defines the response for goroutine search

type LogWidgetAdminData

type LogWidgetAdminData struct {
	WidgetId  string `json:"widgetid"`
	Drop      bool   `json:"drop,omitempty"`
	KeepAlive bool   `json:"keepalive,omitempty"`
}

type MarkedLinesData

type MarkedLinesData struct {
	WidgetId    string          `json:"widgetid"`
	MarkedLines map[string]bool `json:"markedlines"`
	Clear       bool            `json:"clear,omitempty"`
}

MarkedLinesData represents the data for managing marked lines

type MarkedLinesRequestData

type MarkedLinesRequestData struct {
	WidgetId string `json:"widgetid"`
}

MarkedLinesRequestData represents the request for getting marked lines

type MarkedLinesResultData

type MarkedLinesResultData struct {
	Lines []ds.LogLine `json:"lines"`
}

MarkedLinesResultData represents the response with marked log lines

type PageData

type PageData struct {
	PageNum int          `json:"pagenum"`
	Lines   []ds.LogLine `json:"lines"`
}

type ParsedGoRoutine

type ParsedGoRoutine struct {
	GoId            int64        `json:"goid"`
	Name            string       `json:"name,omitempty"`            // Optional name for the goroutine
	Tags            []string     `json:"tags,omitempty"`            // Optional tags for the goroutine
	FirstSeen       int64        `json:"firstseen,omitempty"`       // Timestamp when the goroutine was first seen
	LastSeen        int64        `json:"lastseen,omitempty"`        // Timestamp when the goroutine was last seen
	Active          bool         `json:"active"`                    // Whether the goroutine is currently active
	RawStackTrace   string       `json:"rawstacktrace"`             // The raw stack trace string
	RawState        string       `json:"rawstate"`                  // The complete state information
	PrimaryState    string       `json:"primarystate"`              // The first part of the state (before any commas)
	StateDurationMs int64        `json:"statedurationms,omitempty"` // Duration of state in milliseconds (if available)
	StateDuration   string       `json:"stateduration,omitempty"`   // Duration of state as a string (if available)
	ExtraStates     []string     `json:"extrastates,omitempty"`     // Array of additional state information
	ParsedFrames    []StackFrame `json:"parsedframes,omitempty"`    // Structured frame information
	CreatedByGoId   int64        `json:"createdbygoid,omitempty"`   // ID of the goroutine that created this one
	CreatedByFrame  *StackFrame  `json:"createdbyframe,omitempty"`  // Frame information for the creation point
	Parsed          bool         `json:"parsed"`                    // Whether the stack trace was successfully parsed
	ParseError      string       `json:"parseerror,omitempty"`      // Error message if parsing failed
}

ParsedGoRoutine represents a parsed goroutine stack trace

type RespUnion

type RespUnion[T any] struct {
	Response T
	Error    error
}

type RuntimeStatData

type RuntimeStatData struct {
	Ts             int64              `json:"ts"`
	CPUUsage       float64            `json:"cpuusage"`
	GoRoutineCount int                `json:"goroutinecount"`
	GoMaxProcs     int                `json:"gomaxprocs"`
	NumCPU         int                `json:"numcpu"`
	GOOS           string             `json:"goos"`
	GOARCH         string             `json:"goarch"`
	GoVersion      string             `json:"goversion"`
	Pid            int                `json:"pid"`
	Cwd            string             `json:"cwd"`
	MemStats       ds.MemoryStatsInfo `json:"memstats"`
}

type SearchErrorSpan

type SearchErrorSpan struct {
	Start        int    `json:"start"`        // Start position in the search term
	End          int    `json:"end"`          // End position in the search term
	ErrorMessage string `json:"errormessage"` // The error message
}

SearchErrorSpan represents an error in a search query with position information

type SearchRequestData

type SearchRequestData struct {
	WidgetId     string `json:"widgetid"`
	AppRunId     string `json:"apprunid"`
	SearchTerm   string `json:"searchterm"`
	SystemQuery  string `json:"systemquery,omitempty"`
	PageSize     int    `json:"pagesize"`
	RequestPages []int  `json:"requestpages"`
	Streaming    bool   `json:"streaming"`
}

type SearchResultData

type SearchResultData struct {
	FilteredCount int               `json:"filteredcount"`
	SearchedCount int               `json:"searchedcount"`
	TotalCount    int               `json:"totalcount"`
	MaxCount      int               `json:"maxcount"`
	Pages         []PageData        `json:"pages"`
	ErrorSpans    []SearchErrorSpan `json:"errorspans,omitempty"` // Error spans in the search query
}

type ServerCommandMeta

type ServerCommandMeta struct {
	CommandType string `json:"commandtype"`
}

for frontend

type StackFrame

type StackFrame struct {
	// Function information
	Package  string `json:"package"`            // The package name (e.g., "internal/poll")
	FuncName string `json:"funcname"`           // Just the function/method name, may include the receiver (e.g., "Read")
	FuncArgs string `json:"funcargs,omitempty"` // Raw argument string, no parens (e.g., "0x140003801e0, {0x140003ae723, 0x8dd, 0x8dd}")

	// Source file information
	FilePath   string `json:"filepath"`           // Full path to the source file (e.g., "/opt/homebrew/Cellar/go/1.23.4/libexec/src/internal/poll/fd_unix.go")
	LineNumber int    `json:"linenumber"`         // Line number in the source file (e.g., 165)
	PCOffset   string `json:"pcoffset,omitempty"` // Program counter offset (e.g., "+0x1fc")

	// Classification flags
	IsImportant bool `json:"isimportant,omitempty"` // True if the frame is from the user's own module
	IsSys       bool `json:"issys,omitempty"`       // True if the frame is from a system module (e.g., "os", "net", "internal")
}

StackFrame represents a single frame in a goroutine stack trace

type StatusUpdateData

type StatusUpdateData struct {
	AppId         string `json:"appid"`
	Status        string `json:"status"`
	NumLogLines   int    `json:"numloglines"`
	NumGoRoutines int    `json:"numgoroutines"`
}

type StreamUpdateData

type StreamUpdateData struct {
	WidgetId      string       `json:"widgetid"`
	FilteredCount int          `json:"filteredcount"`
	SearchedCount int          `json:"searchedcount"`
	TotalCount    int          `json:"totalcount"`
	TrimmedLines  int          `json:"trimmedlines"`
	Offset        int          `json:"offset"`
	Lines         []ds.LogLine `json:"lines"`
}

type SubscriptionRequest

type SubscriptionRequest struct {
	Event     string   `json:"event"`
	Scopes    []string `json:"scopes,omitempty"`
	AllScopes bool     `json:"allscopes,omitempty"`
}

type WatchHistoryData

type WatchHistoryData struct {
	AppRunId     string           `json:"apprunid"`
	AppName      string           `json:"appname"`
	WatchHistory []ds.WatchSample `json:"watchhistory"`
}

WatchHistoryData defines the response for watch history

type WatchHistoryRequest

type WatchHistoryRequest struct {
	AppRunId string `json:"apprunid"`
	WatchNum int64  `json:"watchnum"`
}

WatchHistoryRequest defines the request for getting watch history

type WatchNumericData

type WatchNumericData struct {
	AppRunId      string    `json:"apprunid"`
	AppName       string    `json:"appname"`
	NumericValues []float64 `json:"numericvalues"`
}

WatchNumericData defines the response for numeric watch values

type WatchNumericRequest

type WatchNumericRequest struct {
	AppRunId string `json:"apprunid"`
	WatchNum int64  `json:"watchnum"`
}

WatchNumericRequest defines the request for getting numeric watch values

type WatchSearchRequestData

type WatchSearchRequestData struct {
	AppRunId    string `json:"apprunid"`
	SearchTerm  string `json:"searchterm"`
	SystemQuery string `json:"systemquery,omitempty"`
}

WatchSearchRequestData defines the request for watch search

type WatchSearchResultData

type WatchSearchResultData struct {
	SearchedCount int               `json:"searchedcount"`
	TotalCount    int               `json:"totalcount"`
	Results       []int64           `json:"results"`
	ErrorSpans    []SearchErrorSpan `json:"errorspans,omitempty"` // Error spans in the search query
}

WatchSearchResultData defines the response for watch search

Jump to

Keyboard shortcuts

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