stats

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package stats contains interfaces and utilities relating to the collection of statistics from a fleetspeak server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector interface {
	// MessageIngested is called when a message is received from a client, or as
	// a backlogged message from the datastore.
	MessageIngested(backlogged bool, m *fspb.Message, cd *db.ClientData)

	// MessageSaved is called when a message is first saved to the database.
	// m.Data will have been set to nil for fully processed messages.
	MessageSaved(forClient bool, m *fspb.Message, cd *db.ClientData)

	// MessageProcessed is called when a message is successfully processed by the
	// server.
	MessageProcessed(start, end time.Time, m *fspb.Message, isFirstTry bool, cd *db.ClientData)

	// MessageErrored is called when a message processing returned an error
	// (temporary, or permanent).
	MessageErrored(start, end time.Time, permanent bool, m *fspb.Message, isFirstTry bool, cd *db.ClientData)

	// MessageDropped is called when a message has been dropped because too many
	// messages for the services are being processed. Like a temporary error, the
	// message will be retried after some minutes.
	MessageDropped(m *fspb.Message, isFirstTry bool, cd *db.ClientData)

	// ClientPoll is called every time a client polls the server.
	ClientPoll(info PollInfo)

	// DatastoreOperation is called every time a database operation completes.
	DatastoreOperation(start, end time.Time, operation string, result error)

	// ResourceUsageDataReceived is called every time a client-resource-usage proto is received.
	ResourceUsageDataReceived(cd *db.ClientData, rud *mpb.ResourceUsageData, v *fspb.ValidationInfo)

	// KillNotificationReceived is called when a kill notification is received from a client.
	KillNotificationReceived(cd *db.ClientData, kn *mpb.KillNotification)
}

A Collector is a component which is notified when certain events occurred, to support performance monitoring of a fleetspeak installation.

type PollInfo

type PollInfo struct {
	// A Context associated with the poll operation, if available.
	CTX context.Context

	// The ClientID of the polling client, if available.
	ID common.ClientID

	// When the operation started and ended.
	Start, End time.Time

	// Http status code returned to the client.
	Status int

	// Bytes read and written.
	ReadBytes, WriteBytes int

	// Time spent reading and writing messages.
	ReadTime, WriteTime time.Duration

	// Whether the client was in the client cache.
	CacheHit bool

	// The 'type of poll.
	Type PollType
}

A PollInfo describes a client poll operation which has occurred.

type PollType

type PollType int

PollType indicates the type of poll, primarily differentiating between the original bidirectional contact and the different events within a streaming connection.

const (
	FullPoll         PollType = iota // Classic one-off bidirectional poll.
	StreamStart                      // Bidirectional poll that starts a streaming connection.
	StreamFromClient                 // 'Poll' that is really a client pushing data to the server.
	StreamToClient                   // 'Poll' that is really the server pushing data to the client.
)

PollType values.

func (PollType) String

func (t PollType) String() string

String implements fmt.Stringer.

Jump to

Keyboard shortcuts

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