apppeer

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxAppRunPeers = 8
	PruneInterval  = 15 * time.Second
)
View Source
const (
	AppStatusRunning      = "running"
	AppStatusDone         = "done"
	AppStatusDisconnected = "disconnected"
)
View Source
const GoRoutinePruneThreshold = 600 // Number of iterations after which inactive goroutines are pruned
View Source
const GoRoutineStackBufferSize = 600
View Source
const LogLineBufferSize = gensearch.LogLineBufferSize
View Source
const RuntimeStatsBufferSize = 600 // 10 minutes of 1-second samples
View Source
const WatchBufferSize = 600 // 10 minutes of 1-second samples

Variables

This section is empty.

Functions

func ConvertToRuntimeStatData

func ConvertToRuntimeStatData(stat ds.RuntimeStatsInfo) rpctypes.RuntimeStatData

ConvertToRuntimeStatData converts a ds.RuntimeStatsInfo to rpctypes.RuntimeStatData

func GetAllAppRunPeerInfos

func GetAllAppRunPeerInfos(since int64) []rpctypes.AppRunInfo

GetAllAppRunPeerInfos returns AppRunInfo for all valid app run peers If since > 0, only returns peers that have been modified since the given timestamp

func GetAppRunStatsDelta

func GetAppRunStatsDelta() (tevent.AppRunStats, int)

GetAppRunStatsDelta returns the delta of cumulative stats from all app runs since the last time this function was called, and the count of active app runs.

func PruneAppRunPeers

func PruneAppRunPeers() int

PruneAppRunPeers removes old app run peers to keep the total count under MaxAppRunPeers It will not prune peers that are running or have a non-zero reference count

Types

type AppRunPeer

type AppRunPeer struct {
	AppRunId    string
	AppInfo     *ds.AppInfo
	Status      string // Current status of the application
	LastModTime int64  // Last modification time in milliseconds

	Logs            *LogLinePeer
	GoRoutines      *GoRoutinePeer
	Watches         *WatchesPeer
	RuntimeStats    *RuntimeStatsPeer
	CollectorStatus map[string]ds.CollectorStatus // Collector statuses by name
	// contains filtered or unexported fields
}

AppRunPeer represents a peer connection to an app client

func GetAllAppRunPeers

func GetAllAppRunPeers() []*AppRunPeer

GetAllAppRunPeers returns all AppRunPeers

func GetAppRunPeer

func GetAppRunPeer(appRunId string, incRefCount bool) *AppRunPeer

GetAppRunPeer gets an existing AppRunPeer by ID or creates a new one if it doesn't exist If incRefCount is true, increments the reference counter

func (*AppRunPeer) GetAppRunInfo

func (p *AppRunPeer) GetAppRunInfo() rpctypes.AppRunInfo

GetAppRunInfo constructs and returns an AppRunInfo struct for this peer

func (*AppRunPeer) GetPeerStats

func (p *AppRunPeer) GetPeerStats() (tevent.AppRunStats, string)

GetPeerStats returns the stats and status for this peer

func (*AppRunPeer) GetRefCount

func (p *AppRunPeer) GetRefCount() int

GetRefCount safely returns the current reference count

func (*AppRunPeer) HandlePacket

func (p *AppRunPeer) HandlePacket(packetType string, packetData json.RawMessage) error

HandlePacket processes a packet received from the domain socket connection

func (*AppRunPeer) Release

func (p *AppRunPeer) Release()

Release decrements the reference counter and closes resources when it reaches zero

type GoRoutine

type GoRoutine struct {
	GoId                int64
	Name                string
	Tags                []string
	StackTraces         *utilds.CirBuf[ds.GoRoutineStack]
	FirstSeen           int64 // Timestamp when the goroutine was first seen
	LastSeen            int64 // Timestamp when the goroutine was last seen
	LastActiveIteration int64 // Iteration when the goroutine was last active
}

GoRoutine represents a goroutine with its stack traces

type GoRoutinePeer

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

GoRoutinePeer manages goroutines for an AppRunPeer

func MakeGoRoutinePeer

func MakeGoRoutinePeer(appRunId string) *GoRoutinePeer

MakeGoRoutinePeer creates a new GoRoutinePeer instance

func (*GoRoutinePeer) GetGoRoutineCounts

func (gp *GoRoutinePeer) GetGoRoutineCounts() (int, int, int)

GetGoRoutineCounts returns (total, active, activeOutrig) goroutine counts

func (*GoRoutinePeer) GetMaxGoId

func (gp *GoRoutinePeer) GetMaxGoId() int64

GetMaxGoId returns the maximum goroutine ID seen with proper locking

func (*GoRoutinePeer) GetParsedGoRoutines

func (gp *GoRoutinePeer) GetParsedGoRoutines(moduleName string) []rpctypes.ParsedGoRoutine

GetParsedGoRoutines returns parsed goroutines for RPC

func (*GoRoutinePeer) GetParsedGoRoutinesByIds

func (gp *GoRoutinePeer) GetParsedGoRoutinesByIds(moduleName string, goIds []int64) []rpctypes.ParsedGoRoutine

GetParsedGoRoutinesByIds returns parsed goroutines for specific goroutine IDs

func (*GoRoutinePeer) ProcessGoroutineStacks

func (gp *GoRoutinePeer) ProcessGoroutineStacks(info ds.GoroutineInfo)

ProcessGoroutineStacks processes goroutine stacks from a packet

type LogLinePeer

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

LogLinePeer manages log lines for an AppRunPeer

func MakeLogLinePeer

func MakeLogLinePeer() *LogLinePeer

MakeLogLinePeer creates a new LogLinePeer instance

func (*LogLinePeer) GetLogLines

func (lp *LogLinePeer) GetLogLines() ([]ds.LogLine, int)

GetLogLines returns all log lines and the total count

func (*LogLinePeer) GetTotalCount

func (lp *LogLinePeer) GetTotalCount() int

GetTotalCount returns the total count of log lines

func (*LogLinePeer) NotifySearchManagers

func (lp *LogLinePeer) NotifySearchManagers(line ds.LogLine)

NotifySearchManagers notifies all registered search managers about a new log line

func (*LogLinePeer) ProcessLogLine

func (lp *LogLinePeer) ProcessLogLine(line ds.LogLine)

ProcessLogLine processes a log line

func (*LogLinePeer) ProcessMultiLogLines

func (lp *LogLinePeer) ProcessMultiLogLines(lines []ds.LogLine)

ProcessMultiLogLines processes multiple log lines at once

func (*LogLinePeer) RegisterSearchManager

func (lp *LogLinePeer) RegisterSearchManager(manager gensearch.SearchManagerInterface)

RegisterSearchManager registers a search manager with this LogLinePeer

func (*LogLinePeer) UnregisterSearchManager

func (lp *LogLinePeer) UnregisterSearchManager(manager gensearch.SearchManagerInterface)

UnregisterSearchManager removes a search manager from this LogLinePeer

type RuntimeStatsPeer

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

RuntimeStatsPeer manages runtime stats for an AppRunPeer

func MakeRuntimeStatsPeer

func MakeRuntimeStatsPeer() *RuntimeStatsPeer

MakeRuntimeStatsPeer creates a new RuntimeStatsPeer instance

func (*RuntimeStatsPeer) GetFilteredStats

func (rsp *RuntimeStatsPeer) GetFilteredStats(sinceTs int64) []ds.RuntimeStatsInfo

GetFilteredStats returns runtime stats filtered by a timestamp

func (*RuntimeStatsPeer) GetRuntimeStats

func (rsp *RuntimeStatsPeer) GetRuntimeStats(sinceTs int64) []rpctypes.RuntimeStatData

GetRuntimeStats retrieves runtime stats for RPC

func (*RuntimeStatsPeer) GetTotalCollectionCount

func (rsp *RuntimeStatsPeer) GetTotalCollectionCount() int

GetTotalCollectionCount returns the total number of runtime stats collected

func (*RuntimeStatsPeer) IsEmpty

func (rsp *RuntimeStatsPeer) IsEmpty() bool

IsEmpty returns true if the runtime stats buffer is empty

func (*RuntimeStatsPeer) ProcessRuntimeStats

func (rsp *RuntimeStatsPeer) ProcessRuntimeStats(stats ds.RuntimeStatsInfo)

ProcessRuntimeStats processes runtime stats from a packet

type Watch

type Watch struct {
	WatchNum  int64
	Decl      ds.WatchDecl
	WatchVals *utilds.CirBuf[ds.WatchSample]
}

Watch represents a single watch with its values

type WatchesPeer

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

WatchesPeer manages watches for an AppRunPeer

func MakeWatchesPeer

func MakeWatchesPeer(appRunId string) *WatchesPeer

MakeWatchesPeer creates a new WatchesPeer instance

func (*WatchesPeer) GetActiveWatchCount

func (wp *WatchesPeer) GetActiveWatchCount() int

GetActiveWatchCount returns the number of active watches

func (*WatchesPeer) GetAllWatches

func (wp *WatchesPeer) GetAllWatches() []rpctypes.CombinedWatchSample

GetAllWatches returns all watches with their most recent values as combined samples

func (*WatchesPeer) GetTotalWatchCount

func (wp *WatchesPeer) GetTotalWatchCount() int

GetTotalWatchCount returns the total number of watches (active and inactive)

func (*WatchesPeer) GetWatchesByIds

func (wp *WatchesPeer) GetWatchesByIds(watchIds []int64) []rpctypes.CombinedWatchSample

GetWatchesByIds returns watches for specific watch IDs

func (*WatchesPeer) ProcessWatchInfo

func (wp *WatchesPeer) ProcessWatchInfo(watchInfo ds.WatchInfo)

ProcessWatchInfo processes watch information from a packet

Jump to

Keyboard shortcuts

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