model

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationDeploymentMetricsSnapshotShift  = 10 * timeseries.Minute
	ApplicationDeploymentMetricsSnapshotWindow = 20 * timeseries.Minute
	ApplicationDeploymentMinLifetime           = ApplicationDeploymentMetricsSnapshotShift + ApplicationDeploymentMetricsSnapshotWindow
)
View Source
const (
	CheckUnitPercent = "percent"
	CheckUnitSecond  = "second"
	CheckUnitByte    = "byte"
)
View Source
const (
	CloudProviderAWS   = "aws"
	CloudProviderAzure = "azure"
)
View Source
const (
	ProfileCategoryNone   = ""
	ProfileCategoryCPU    = "cpu"
	ProfileCategoryMemory = "memory"
)
View Source
const (
	ProtocolMongodb = "mongo"
)

Variables

View Source
var (
	AlertRules = []AlertRule{
		{LongWindow: timeseries.Hour, ShortWindow: 5 * timeseries.Minute, BurnRateThreshold: 14.4, Severity: CRITICAL},
		{LongWindow: 6 * timeseries.Hour, ShortWindow: 30 * timeseries.Minute, BurnRateThreshold: 6, Severity: CRITICAL},
		{LongWindow: timeseries.Day, ShortWindow: 2 * timeseries.Hour, BurnRateThreshold: 3, Severity: WARNING},
	}
	MaxAlertRuleWindow timeseries.Duration
)
View Source
var (
	ApplicationIdZero = ApplicationId{}
)
View Source
var BuiltinCategoryPatterns = map[ApplicationCategory][]string{
	ApplicationCategoryApplication: {},
	ApplicationCategoryControlPlane: {
		"kube-system/*",
		"*/kubelet",
		"*/kube-apiserver",
		"*/k3s",
		"*/k3s-agent",
		"*/systemd*",
		"*/containerd",
		"*/docker*",
		"*/*chaos-*",
		"istio-system/*",
		"amazon-cloudwatch/*",
		"karpenter/*",
		"cert-manager/*",
		"argocd/*",
		"flux-system/*",
		"linkerd/*",
		"vault/*",
		"keda/*",
		"keycloak/*",
	},
	ApplicationCategoryMonitoring: {
		"monitoring/*",
		"prometheus/*",
		"*/*prometheus*",
		"grafana/*",
		"*/*grafana*",
		"*/*alertmanager*",
		"coroot/*",
		"*/*coroot*",
		"metrics-server/*",
	},
}
View Source
var Checks = struct {
	index map[CheckId]*CheckConfig

	SLOAvailability        CheckConfig
	SLOLatency             CheckConfig
	CPUNode                CheckConfig
	CPUContainer           CheckConfig
	MemoryOOM              CheckConfig
	MemoryLeakPercent      CheckConfig
	StorageSpace           CheckConfig
	StorageIO              CheckConfig
	NetworkRTT             CheckConfig
	NetworkConnectivity    CheckConfig
	NetworkTCPConnections  CheckConfig
	InstanceAvailability   CheckConfig
	DeploymentStatus       CheckConfig
	InstanceRestarts       CheckConfig
	RedisAvailability      CheckConfig
	RedisLatency           CheckConfig
	MongodbAvailability    CheckConfig
	MongodbReplicationLag  CheckConfig
	PostgresAvailability   CheckConfig
	PostgresLatency        CheckConfig
	PostgresErrors         CheckConfig
	PostgresReplicationLag CheckConfig
	PostgresConnections    CheckConfig
	LogErrors              CheckConfig
	JvmAvailability        CheckConfig
	JvmSafepointTime       CheckConfig
	DotNetAvailability     CheckConfig
}{

	SLOAvailability: CheckConfig{
		Type:                    CheckTypeManual,
		Title:                   "Availability",
		MessageTemplate:         `the app is serving errors`,
		DefaultThreshold:        99,
		Unit:                    CheckUnitPercent,
		ConditionFormatTemplate: "the successful request percentage < <threshold>",
	},
	SLOLatency: CheckConfig{
		Type:                    CheckTypeManual,
		Title:                   "Latency",
		MessageTemplate:         `the app is performing slowly`,
		DefaultThreshold:        99,
		Unit:                    CheckUnitPercent,
		ConditionFormatTemplate: "the percentage of requests served faster than <bucket> < <threshold>",
	},
	CPUNode: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "Node CPU utilization",
		MessageTemplate:         `high CPU utilization of {{.Items "node"}}`,
		DefaultThreshold:        80,
		Unit:                    CheckUnitPercent,
		ConditionFormatTemplate: "the CPU usage of a node > <threshold>",
	},
	CPUContainer: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "Container CPU utilization",
		DefaultThreshold:        80,
		Unit:                    CheckUnitPercent,
		MessageTemplate:         `high CPU utilization of {{.Items "container"}}`,
		ConditionFormatTemplate: "the CPU usage of a container > <threshold> of its CPU limit",
	},
	MemoryOOM: CheckConfig{
		Type:                    CheckTypeEventBased,
		Title:                   "Out of Memory",
		DefaultThreshold:        0,
		MessageTemplate:         `app containers have been restarted {{.Count "time"}} by the OOM killer`,
		ConditionFormatTemplate: "the number of container terminations due to Out of Memory > <threshold>",
	},
	MemoryLeakPercent: CheckConfig{
		Type:                    CheckTypeValueBased,
		Title:                   "Memory leak",
		DefaultThreshold:        10,
		MessageTemplate:         `memory usage is growing by {{.Value}} %% per hour`,
		ConditionFormatTemplate: "memory usage is growing by > <threshold> % per hour",
	},
	StorageIO: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "Disk I/O",
		DefaultThreshold:        80,
		Unit:                    CheckUnitPercent,
		MessageTemplate:         `high I/O utilization of {{.Items "volume"}}`,
		ConditionFormatTemplate: "the I/O utilization of a volume > <threshold>",
	},
	StorageSpace: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "Disk space",
		DefaultThreshold:        80,
		Unit:                    CheckUnitPercent,
		MessageTemplate:         `disk space on {{.Items "volume"}} will be exhausted soon`,
		ConditionFormatTemplate: "the space usage of a volume > <threshold>",
	},
	NetworkRTT: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "Network round-trip time (RTT)",
		DefaultThreshold:        0.01,
		Unit:                    CheckUnitSecond,
		MessageTemplate:         `high network latency to {{.Items "upstream service"}}`,
		ConditionFormatTemplate: "the RTT to an upstream service > <threshold>",
	},
	NetworkConnectivity: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "Network connectivity",
		DefaultThreshold:        0,
		MessageTemplate:         `no connectivity with {{.Items "upstream service"}}`,
		ConditionFormatTemplate: "the number of unavailable upstream services > <threshold>",
	},
	NetworkTCPConnections: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "TCP connections",
		DefaultThreshold:        0,
		MessageTemplate:         `failed to connect to {{.Items "upstream service"}}`,
		ConditionFormatTemplate: "the number of upstream services to which the app failed to connect > <threshold>",
	},
	InstanceAvailability: CheckConfig{
		Type:                    CheckTypeManual,
		Title:                   "Instance availability",
		DefaultThreshold:        75,
		Unit:                    CheckUnitPercent,
		MessageTemplate:         `{{.ItemsWithToBe "instance"}} unavailable`,
		ConditionFormatTemplate: "the number of available instances < <threshold> of the desired",
	},
	InstanceRestarts: CheckConfig{
		Type:                    CheckTypeEventBased,
		Title:                   "Restarts",
		DefaultThreshold:        0,
		MessageTemplate:         `app containers have been restarted {{.Count "time"}}`,
		ConditionFormatTemplate: "the number of container restarts > <threshold>",
	},
	DeploymentStatus: CheckConfig{
		Type:                    CheckTypeValueBased,
		Title:                   "Deployment status",
		DefaultThreshold:        180,
		Unit:                    CheckUnitSecond,
		MessageTemplate:         `the rollout has already been in progress for {{.Value}}`,
		ConditionFormatTemplate: "a rollout is in progress > <threshold>",
	},
	RedisAvailability: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "Redis availability",
		DefaultThreshold:        0,
		MessageTemplate:         `{{.ItemsWithToBe "redis instance"}} unavailable`,
		ConditionFormatTemplate: "the number of unavailable redis instances > <threshold>",
	},
	RedisLatency: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "Redis latency",
		DefaultThreshold:        0.005,
		Unit:                    CheckUnitSecond,
		MessageTemplate:         `{{.ItemsWithToBe "redis instance"}} performing slowly`,
		ConditionFormatTemplate: "the average command execution time of a redis instance > <threshold>",
	},
	MongodbAvailability: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "Mongodb availability",
		DefaultThreshold:        0,
		MessageTemplate:         `{{.ItemsWithToBe "mongodb instance"}} unavailable`,
		ConditionFormatTemplate: "the number of unavailable mongodb instances > <threshold>",
	},
	MongodbReplicationLag: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "Mongodb replication lag",
		DefaultThreshold:        30,
		MessageTemplate:         `{{.ItemsWithToBe "mongodb replica"}} far behind the primary`,
		ConditionFormatTemplate: "replication lag > <threshold>",
		Unit:                    CheckUnitSecond,
	},
	PostgresAvailability: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "Postgres availability",
		DefaultThreshold:        0,
		MessageTemplate:         `{{.ItemsWithToBe "postgres instance"}} unavailable`,
		ConditionFormatTemplate: "the number of unavailable postgres instances > <threshold>",
	},
	PostgresLatency: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "Postgres latency",
		DefaultThreshold:        0.1,
		Unit:                    CheckUnitSecond,
		MessageTemplate:         `{{.ItemsWithToBe "postgres instance"}} performing slowly`,
		ConditionFormatTemplate: "the average query execution time of a postgres instance > <threshold>",
	},
	PostgresErrors: CheckConfig{
		Type:                    CheckTypeEventBased,
		Title:                   "Postgres errors",
		DefaultThreshold:        0,
		MessageTemplate:         `{{.Count "error"}} occurred`,
		ConditionFormatTemplate: "the number of postgres errors > <threshold>",
	},
	PostgresReplicationLag: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "Postgres replication lag",
		DefaultThreshold:        30,
		MessageTemplate:         `{{.ItemsWithToBe "postgres replica"}} far behind the primary`,
		ConditionFormatTemplate: "replication lag > <threshold>",
		Unit:                    CheckUnitSecond,
	},
	PostgresConnections: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "Postgres connections",
		DefaultThreshold:        90,
		MessageTemplate:         `{{.ItemsWithHave "postgres instance"}} too many connections`,
		ConditionFormatTemplate: "the number of connections > <threshold> of `max_connections`",
		Unit:                    CheckUnitPercent,
	},
	LogErrors: CheckConfig{
		Type:                    CheckTypeEventBased,
		Title:                   "Errors",
		DefaultThreshold:        0,
		MessageTemplate:         `{{.Count "error"}} occurred`,
		ConditionFormatTemplate: "the number of messages with the ERROR and CRITICAL severity levels > <threshold>",
	},
	JvmAvailability: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "JVM availability",
		DefaultThreshold:        0,
		MessageTemplate:         `{{.ItemsWithToBe "JVM instance"}} unavailable`,
		ConditionFormatTemplate: "the number of unavailable JVM instances > <threshold>",
	},
	JvmSafepointTime: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   "JVM safepoints",
		DefaultThreshold:        0.05,
		MessageTemplate:         `high safepoint time on {{.Items "JVM instance"}}`,
		ConditionFormatTemplate: "the time application have been stopped for safepoint operations > <threshold>",
		Unit:                    CheckUnitSecond,
	},
	DotNetAvailability: CheckConfig{
		Type:                    CheckTypeItemBased,
		Title:                   ".NET runtime availability",
		DefaultThreshold:        0,
		MessageTemplate:         `{{.ItemsWithToBe ".NET instance"}} unavailable`,
		ConditionFormatTemplate: "the number of unavailable .NET instances > <threshold>",
	},
	// contains filtered or unexported fields
}
View Source
var (
	Profiles = map[ProfileType]ProfileMeta{
		ProfileTypeEbpfCPU: {
			Category:    ProfileCategoryCPU,
			Name:        "CPU (eBPF)",
			Aggregation: ProfileAggregationSum,
		},
		ProfileTypeGoCPU: {
			Category:    ProfileCategoryCPU,
			Name:        "CPU",
			Aggregation: ProfileAggregationSum,
			Featured:    true,
		},
		ProfileTypeGoHeapAllocObjects: {
			Category:    ProfileCategoryMemory,
			Name:        "Memory (alloc_objects)",
			Aggregation: ProfileAggregationSum,
		},
		ProfileTypeGoHeapAllocSpace: {
			Category:    ProfileCategoryMemory,
			Name:        "Memory (alloc_space)",
			Aggregation: ProfileAggregationSum,
		},
		ProfileTypeGoHeapInuseObjects: {
			Category:    ProfileCategoryMemory,
			Name:        "Memory (inuse_objects)",
			Aggregation: ProfileAggregationAvg,
		},
		ProfileTypeGoHeapInuseSpace: {
			Category:    ProfileCategoryMemory,
			Name:        "Memory (inuse_space)",
			Aggregation: ProfileAggregationAvg,
			Featured:    true,
		},
		ProfileTypeGoGoroutines: {
			Name:        "Golang (goroutines)",
			Aggregation: ProfileAggregationAvg,
		},
		ProfileTypeGoBlockContentions: {
			Name:        "Golang (block_contentions)",
			Aggregation: ProfileAggregationSum,
		},
		ProfileTypeGoBlockDelay: {
			Name:        "Golang (block_delay)",
			Aggregation: ProfileAggregationSum,
		},
		ProfileTypeGoMutexContentions: {
			Name:        "Golang (mutex_contentions)",
			Aggregation: ProfileAggregationSum,
		},
		ProfileTypeGoMutexDelay: {
			Name:        "Golang (mutex_delay)",
			Aggregation: ProfileAggregationSum,
		},
	}
)

Functions

func CalcApplicationDeploymentSummary

func CalcApplicationDeploymentSummary(app *Application, checkConfigs CheckConfigs, t timeseries.Time, curr, prev *MetricsSnapshot) ([]ApplicationDeploymentSummary, Status)

func ContainerIdToServiceName added in v0.23.0

func ContainerIdToServiceName(containerId string) string

func GetConnectionsErrorsSum

func GetConnectionsErrorsSum(connections []*Connection, protocolFilter func(protocol Protocol) bool) *timeseries.TimeSeries

func GetConnectionsRequestsLatency

func GetConnectionsRequestsLatency(connections []*Connection, protocolFilter func(protocol Protocol) bool) *timeseries.TimeSeries

func GetConnectionsRequestsSum

func GetConnectionsRequestsSum(connections []*Connection, protocolFilter func(protocol Protocol) bool) *timeseries.TimeSeries

func GuessService added in v0.27.0

func GuessService(services []string, appId ApplicationId) string

func IsRequestStatusFailed

func IsRequestStatusFailed(status string) bool

func Quantile added in v0.17.12

func Quantile(histogram []HistogramBucket, q float32) *timeseries.TimeSeries

Types

type AlertRule

type AlertRule struct {
	LongWindow        timeseries.Duration
	ShortWindow       timeseries.Duration
	BurnRateThreshold float32
	Severity          Status
}

type Annotation

type Annotation struct {
	Name string          `json:"name"`
	X1   timeseries.Time `json:"x1"`
	X2   timeseries.Time `json:"x2"`
	Icon string          `json:"icon"`
}

func EventsToAnnotations

func EventsToAnnotations(events []*ApplicationEvent, ctx timeseries.Context) []Annotation

func IncidentsToAnnotations

func IncidentsToAnnotations(incidents []*ApplicationIncident, ctx timeseries.Context) []Annotation

type Application

type Application struct {
	Id ApplicationId

	Category ApplicationCategory

	Instances   []*Instance
	Downstreams []*Connection

	DesiredInstances *timeseries.TimeSeries

	LatencySLIs      []*LatencySLI
	AvailabilitySLIs []*AvailabilitySLI

	Events      []*ApplicationEvent
	Deployments []*ApplicationDeployment
	Incidents   []*ApplicationIncident

	Status  Status
	Reports []*AuditReport
}

func NewApplication

func NewApplication(id ApplicationId) *Application

func (*Application) AddReport

func (app *Application) AddReport(name AuditReportName, widgets ...*Widget)

func (*Application) ApplicationTypes added in v1.0.0

func (app *Application) ApplicationTypes() map[ApplicationType]bool

func (*Application) GetClientsConnections

func (app *Application) GetClientsConnections() map[ApplicationId][]*Connection

func (*Application) GetInstance

func (app *Application) GetInstance(name, node string) *Instance

func (*Application) GetOrCreateInstance

func (app *Application) GetOrCreateInstance(name string, node *Node) *Instance

func (*Application) InstrumentationStatus

func (app *Application) InstrumentationStatus() map[ApplicationType]bool

func (*Application) IsDotNet added in v0.26.0

func (app *Application) IsDotNet() bool

func (*Application) IsJvm

func (app *Application) IsJvm() bool

func (*Application) IsK8s

func (app *Application) IsK8s() bool

func (*Application) IsMongodb added in v0.24.0

func (app *Application) IsMongodb() bool

func (*Application) IsPostgres

func (app *Application) IsPostgres() bool

func (*Application) IsRedis

func (app *Application) IsRedis() bool

func (*Application) IsStandalone

func (app *Application) IsStandalone() bool

func (*Application) Labels

func (app *Application) Labels() Labels

func (*Application) SLOStatus

func (app *Application) SLOStatus() Status

type ApplicationCategory

type ApplicationCategory string
const (
	ApplicationCategoryApplication  ApplicationCategory = "application"
	ApplicationCategoryControlPlane ApplicationCategory = "control-plane"
	ApplicationCategoryMonitoring   ApplicationCategory = "monitoring"
)

func CalcApplicationCategory

func CalcApplicationCategory(appId ApplicationId, customPatterns map[ApplicationCategory][]string) ApplicationCategory

func (ApplicationCategory) Auxiliary

func (c ApplicationCategory) Auxiliary() bool

func (ApplicationCategory) Builtin

func (c ApplicationCategory) Builtin() bool

func (ApplicationCategory) ControlPlane added in v1.0.0

func (c ApplicationCategory) ControlPlane() bool

func (ApplicationCategory) Default

func (c ApplicationCategory) Default() bool

func (ApplicationCategory) Monitoring

func (c ApplicationCategory) Monitoring() bool

type ApplicationDeployment

type ApplicationDeployment struct {
	ApplicationId ApplicationId
	Name          string
	StartedAt     timeseries.Time
	FinishedAt    timeseries.Time

	Details *ApplicationDeploymentDetails

	MetricsSnapshot *MetricsSnapshot

	Notifications *ApplicationDeploymentNotifications
}

func (*ApplicationDeployment) Hash

func (d *ApplicationDeployment) Hash() string

func (*ApplicationDeployment) Id

func (d *ApplicationDeployment) Id() string

func (*ApplicationDeployment) Version

func (d *ApplicationDeployment) Version() string

type ApplicationDeploymentDetails

type ApplicationDeploymentDetails struct {
	ContainerImages []string `json:"container_images"`
}

type ApplicationDeploymentNotifications

type ApplicationDeploymentNotifications struct {
	State ApplicationDeploymentState `json:"state"`
	Slack struct {
		State    ApplicationDeploymentState `json:"state"`
		Channel  string                     `json:"channel,omitempty"`
		ThreadTs string                     `json:"thread_ts,omitempty"`
	} `json:"slack"`
	Teams struct {
		State ApplicationDeploymentState `json:"state"`
	} `json:"teams"`
	Webhook struct {
		State ApplicationDeploymentState `json:"state"`
	} `json:"webhook"`
}

type ApplicationDeploymentState

type ApplicationDeploymentState int
const (
	ApplicationDeploymentStateStarted ApplicationDeploymentState = iota
	ApplicationDeploymentStateInProgress
	ApplicationDeploymentStateStuck
	ApplicationDeploymentStateCancelled
	ApplicationDeploymentStateDeployed
	ApplicationDeploymentStateSummary
)

type ApplicationDeploymentStatus

type ApplicationDeploymentStatus struct {
	Status     Status
	State      ApplicationDeploymentState
	Message    string
	Lifetime   timeseries.Duration
	Summary    []ApplicationDeploymentSummary
	Deployment *ApplicationDeployment
	Last       bool
}

func CalcApplicationDeploymentStatuses

func CalcApplicationDeploymentStatuses(app *Application, checkConfigs CheckConfigs, now timeseries.Time) []ApplicationDeploymentStatus

type ApplicationDeploymentSummary

type ApplicationDeploymentSummary struct {
	Report  AuditReportName `json:"report"`
	Ok      bool            `json:"ok"`
	Message string          `json:"message"`
	Time    timeseries.Time `json:"time"`
}

func (ApplicationDeploymentSummary) Emoji

type ApplicationEvent

type ApplicationEvent struct {
	Start   timeseries.Time
	End     timeseries.Time
	Type    ApplicationEventType
	Details string
}

func (*ApplicationEvent) String

func (e *ApplicationEvent) String() string

type ApplicationEventType

type ApplicationEventType int
const (
	ApplicationEventTypeSwitchover ApplicationEventType = iota
	ApplicationEventTypeRollout
	ApplicationEventTypeInstanceDown
	ApplicationEventTypeInstanceUp
)

type ApplicationId

type ApplicationId struct {
	Namespace string
	Kind      ApplicationKind
	Name      string
}

func NewApplicationId

func NewApplicationId(ns string, kind ApplicationKind, name string) ApplicationId

func NewApplicationIdFromString

func NewApplicationIdFromString(src string) (ApplicationId, error)

func (ApplicationId) IsZero

func (a ApplicationId) IsZero() bool

func (ApplicationId) MarshalText

func (a ApplicationId) MarshalText() ([]byte, error)

func (*ApplicationId) Scan

func (a *ApplicationId) Scan(src any) error

func (ApplicationId) String

func (a ApplicationId) String() string

func (*ApplicationId) UnmarshalText

func (a *ApplicationId) UnmarshalText(text []byte) error

func (ApplicationId) Value

func (a ApplicationId) Value() (driver.Value, error)

type ApplicationIncident

type ApplicationIncident struct {
	Key        string
	OpenedAt   timeseries.Time
	ResolvedAt timeseries.Time
	Severity   Status
}

func (*ApplicationIncident) Resolved

func (i *ApplicationIncident) Resolved() bool

type ApplicationKind

type ApplicationKind string
const (
	ApplicationKindDeployment         ApplicationKind = "Deployment"
	ApplicationKindStatefulSet        ApplicationKind = "StatefulSet"
	ApplicationKindDaemonSet          ApplicationKind = "DaemonSet"
	ApplicationKindCronJob            ApplicationKind = "CronJob"
	ApplicationKindJob                ApplicationKind = "Job"
	ApplicationKindReplicaSet         ApplicationKind = "ReplicaSet"
	ApplicationKindPod                ApplicationKind = "Pod"
	ApplicationKindStaticPods         ApplicationKind = "StaticPods"
	ApplicationKindUnknown            ApplicationKind = "Unknown"
	ApplicationKindDockerSwarmService ApplicationKind = "DockerSwarmService"
	ApplicationKindExternalService    ApplicationKind = "ExternalService"
	ApplicationKindDatabaseCluster    ApplicationKind = "DatabaseCluster"
	ApplicationKindRds                ApplicationKind = "RDS"
	ApplicationKindElasticacheCluster ApplicationKind = "ElasticacheCluster"
)

type ApplicationType

type ApplicationType string
const (
	ApplicationTypeUnknown       ApplicationType = ""
	ApplicationTypePostgres      ApplicationType = "postgres"
	ApplicationTypePgbouncer     ApplicationType = "pgbouncer"
	ApplicationTypeMysql         ApplicationType = "mysql"
	ApplicationTypeCassandra     ApplicationType = "cassandra"
	ApplicationTypeElasticsearch ApplicationType = "elasticsearch"
	ApplicationTypeMemcached     ApplicationType = "memcached"
	ApplicationTypeRedis         ApplicationType = "redis"
	ApplicationTypeKeyDB         ApplicationType = "keydb"
	ApplicationTypeMongodb       ApplicationType = "mongodb"
	ApplicationTypeMongos        ApplicationType = "mongos"
	ApplicationTypeRabbitmq      ApplicationType = "rabbitmq"
	ApplicationTypeKafka         ApplicationType = "kafka"
	ApplicationTypeZookeeper     ApplicationType = "zookeeper"
	ApplicationTypeRDS           ApplicationType = "aws-rds"
	ApplicationTypeElastiCache   ApplicationType = "aws-elasticache"
	ApplicationTypeNats          ApplicationType = "nats"
)

func (ApplicationType) IsDatabase

func (at ApplicationType) IsDatabase() bool

func (ApplicationType) IsQueue

func (at ApplicationType) IsQueue() bool

type AuditReport

type AuditReport struct {
	Name              AuditReportName    `json:"name"`
	Status            Status             `json:"status"`
	Widgets           []*Widget          `json:"widgets"`
	Checks            []*Check           `json:"checks"`
	Custom            bool               `json:"custom"`
	ConfigurationHint *ConfigurationHint `json:"configuration_hint"`
	// contains filtered or unexported fields
}

func NewAuditReport

func NewAuditReport(app *Application, ctx timeseries.Context, checkConfigs CheckConfigs, name AuditReportName, detailed bool) *AuditReport

func (*AuditReport) AddWidget added in v0.20.0

func (r *AuditReport) AddWidget(w *Widget) *Widget

func (*AuditReport) CreateCheck

func (r *AuditReport) CreateCheck(cfg CheckConfig) *Check

func (*AuditReport) GetOrCreateChart

func (r *AuditReport) GetOrCreateChart(title string, doc *DocLink) *Chart

func (*AuditReport) GetOrCreateChartGroup

func (r *AuditReport) GetOrCreateChartGroup(title string, doc *DocLink) *ChartGroup

func (*AuditReport) GetOrCreateChartInGroup

func (r *AuditReport) GetOrCreateChartInGroup(title string, chartTitle string, doc *DocLink) *Chart

func (*AuditReport) GetOrCreateDependencyMap

func (r *AuditReport) GetOrCreateDependencyMap() *DependencyMap

func (*AuditReport) GetOrCreateHeatmap

func (r *AuditReport) GetOrCreateHeatmap(title string) *Heatmap

func (*AuditReport) GetOrCreateTable

func (r *AuditReport) GetOrCreateTable(header ...string) *Table

type AuditReportName

type AuditReportName string
const (
	AuditReportSLO         AuditReportName = "SLO"
	AuditReportInstances   AuditReportName = "Instances"
	AuditReportCPU         AuditReportName = "CPU"
	AuditReportMemory      AuditReportName = "Memory"
	AuditReportStorage     AuditReportName = "Storage"
	AuditReportNetwork     AuditReportName = "Net"
	AuditReportLogs        AuditReportName = "Logs"
	AuditReportPostgres    AuditReportName = "Postgres"
	AuditReportRedis       AuditReportName = "Redis"
	AuditReportMongodb     AuditReportName = "Mongodb"
	AuditReportJvm         AuditReportName = "JVM"
	AuditReportDotNet      AuditReportName = ".NET"
	AuditReportNode        AuditReportName = "Node"
	AuditReportDeployments AuditReportName = "Deployments"
	AuditReportProfiling   AuditReportName = "Profiling"
	AuditReportTracing     AuditReportName = "Tracing"
)

type AvailabilitySLI

type AvailabilitySLI struct {
	Config CheckConfigSLOAvailability

	TotalRequests  *timeseries.TimeSeries
	FailedRequests *timeseries.TimeSeries

	TotalRequestsRaw  *timeseries.TimeSeries
	FailedRequestsRaw *timeseries.TimeSeries
}

type BurnRate

type BurnRate struct {
	Value    float32
	Window   timeseries.Duration
	Severity Status
}

func (BurnRate) FormatSLOStatus

func (br BurnRate) FormatSLOStatus() string

type Chart

type Chart struct {
	Ctx timeseries.Context `json:"ctx"`

	Title         string       `json:"title"`
	Series        SeriesList   `json:"series"`
	Threshold     *Series      `json:"threshold"`
	Featured      bool         `json:"featured"`
	IsStacked     bool         `json:"stacked"`
	IsSorted      bool         `json:"sorted"`
	IsColumn      bool         `json:"column"`
	ColorShift    int          `json:"color_shift"`
	Annotations   []Annotation `json:"annotations"`
	DrillDownLink *RouterLink  `json:"drill_down_link"`
	HideLegend    bool         `json:"hide_legend"`
	Flags         string       `json:"flags"`
}

func NewChart

func NewChart(ctx timeseries.Context, title string) *Chart

func (*Chart) AddAnnotation

func (ch *Chart) AddAnnotation(annotations ...Annotation) *Chart

func (*Chart) AddMany

func (ch *Chart) AddMany(series map[string]SeriesData, topN int, topF timeseries.F) *Chart

func (*Chart) AddSeries

func (ch *Chart) AddSeries(name string, data SeriesData, color ...string) *Chart

func (*Chart) Column

func (ch *Chart) Column() *Chart

func (*Chart) Feature

func (ch *Chart) Feature() *Chart

func (*Chart) IsEmpty

func (ch *Chart) IsEmpty() bool

func (*Chart) Legend added in v0.20.0

func (ch *Chart) Legend(on bool) *Chart

func (*Chart) PercentilesFrom added in v0.17.12

func (ch *Chart) PercentilesFrom(histogram []HistogramBucket, percentiles ...float32) *Chart

func (*Chart) SetThreshold

func (ch *Chart) SetThreshold(name string, data SeriesData) *Chart

func (*Chart) ShiftColors

func (ch *Chart) ShiftColors() *Chart

func (*Chart) Sorted

func (ch *Chart) Sorted() *Chart

func (*Chart) Stacked

func (ch *Chart) Stacked() *Chart

type ChartGroup

type ChartGroup struct {
	Title  string   `json:"title"`
	Charts []*Chart `json:"charts"`
	// contains filtered or unexported fields
}

func NewChartGroup added in v0.22.0

func NewChartGroup(ctx timeseries.Context, title string) *ChartGroup

func (*ChartGroup) GetOrCreateChart

func (cg *ChartGroup) GetOrCreateChart(title string) *Chart

func (*ChartGroup) MarshalJSON

func (cg *ChartGroup) MarshalJSON() ([]byte, error)

type Check

type Check struct {
	Id                      CheckId   `json:"id"`
	Title                   string    `json:"title"`
	Status                  Status    `json:"status"`
	Message                 string    `json:"message"`
	Threshold               float32   `json:"threshold"`
	Unit                    CheckUnit `json:"unit"`
	ConditionFormatTemplate string    `json:"condition_format_template"`
	// contains filtered or unexported fields
}

func (*Check) AddItem

func (ch *Check) AddItem(format string, a ...any)

func (*Check) Calc

func (ch *Check) Calc()

func (*Check) Count added in v0.21.0

func (ch *Check) Count() int64

func (*Check) Desired added in v0.21.0

func (ch *Check) Desired() int64

func (*Check) Fire

func (ch *Check) Fire()

func (*Check) Inc

func (ch *Check) Inc(amount int64)

func (*Check) Items added in v0.21.0

func (ch *Check) Items() *utils.StringSet

func (*Check) SetDesired added in v0.21.0

func (ch *Check) SetDesired(desired int64)

func (*Check) SetStatus

func (ch *Check) SetStatus(status Status, format string, a ...any)

func (*Check) SetValue

func (ch *Check) SetValue(v float32)

func (*Check) SetValues added in v0.21.0

func (ch *Check) SetValues(vs *timeseries.TimeSeries)

func (*Check) Value added in v0.21.0

func (ch *Check) Value() float32

func (*Check) Values added in v0.21.0

func (ch *Check) Values() *timeseries.TimeSeries

type CheckConfig

type CheckConfig struct {
	Id    CheckId
	Type  CheckType
	Title string

	DefaultThreshold        float32
	Unit                    CheckUnit
	MessageTemplate         string
	ConditionFormatTemplate string
}

type CheckConfigSLOAvailability

type CheckConfigSLOAvailability struct {
	Custom              bool    `json:"custom"`
	TotalRequestsQuery  string  `json:"total_requests_query"`
	FailedRequestsQuery string  `json:"failed_requests_query"`
	ObjectivePercentage float32 `json:"objective_percentage"`
}

func (*CheckConfigSLOAvailability) Failed

func (cfg *CheckConfigSLOAvailability) Failed() string

func (*CheckConfigSLOAvailability) Total

func (cfg *CheckConfigSLOAvailability) Total() string

type CheckConfigSLOLatency

type CheckConfigSLOLatency struct {
	Custom              bool    `json:"custom"`
	HistogramQuery      string  `json:"histogram_query"`
	ObjectiveBucket     float32 `json:"objective_bucket"`
	ObjectivePercentage float32 `json:"objective_percentage"`
}

func (*CheckConfigSLOLatency) Histogram

func (cfg *CheckConfigSLOLatency) Histogram() string

type CheckConfigSimple

type CheckConfigSimple struct {
	Threshold float32 `json:"threshold"`
}

type CheckConfigs

type CheckConfigs map[ApplicationId]map[CheckId]json.RawMessage

func (CheckConfigs) GetAvailability

func (cc CheckConfigs) GetAvailability(appId ApplicationId) (CheckConfigSLOAvailability, bool)

func (CheckConfigs) GetByCheck

func (cc CheckConfigs) GetByCheck(id CheckId) map[ApplicationId][]any

func (CheckConfigs) GetLatency

func (cc CheckConfigs) GetLatency(appId ApplicationId, category ApplicationCategory) (CheckConfigSLOLatency, bool)

func (CheckConfigs) GetSimple

func (cc CheckConfigs) GetSimple(checkId CheckId, appId ApplicationId) CheckConfigSimple

func (CheckConfigs) GetSimpleAll

func (cc CheckConfigs) GetSimpleAll(checkId CheckId, appId ApplicationId) []*CheckConfigSimple

type CheckContext

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

func (CheckContext) Count

func (c CheckContext) Count(singular string) string

func (CheckContext) Items

func (c CheckContext) Items(singular string) string

func (CheckContext) ItemsWithHave

func (c CheckContext) ItemsWithHave(singular string) string

func (CheckContext) ItemsWithToBe

func (c CheckContext) ItemsWithToBe(singular string) string

func (CheckContext) Value

func (c CheckContext) Value() string

type CheckId

type CheckId string

type CheckType

type CheckType int
const (
	CheckTypeEventBased CheckType = iota
	CheckTypeItemBased
	CheckTypeValueBased
	CheckTypeManual
)

type CheckUnit

type CheckUnit string

func (CheckUnit) FormatValue

func (u CheckUnit) FormatValue(v float32) string

type ClusterRole

type ClusterRole int
const (
	ClusterRoleNone ClusterRole = iota
	ClusterRolePrimary
	ClusterRoleReplica
)

func (ClusterRole) String

func (r ClusterRole) String() string

type ConfigurationHint added in v1.0.0

type ConfigurationHint struct {
	Message      string `json:"message"`
	ReadMoreLink string `json:"read_more_link"`
}

type Connection

type Connection struct {
	ActualRemotePort string
	ActualRemoteIP   string
	Instance         *Instance
	RemoteInstance   *Instance

	Container string

	Rtt *timeseries.TimeSeries

	SuccessfulConnections *timeseries.TimeSeries
	Active                *timeseries.TimeSeries
	FailedConnections     *timeseries.TimeSeries

	Retransmissions *timeseries.TimeSeries

	RequestsCount     map[Protocol]map[string]*timeseries.TimeSeries // by status
	RequestsLatency   map[Protocol]*timeseries.TimeSeries
	RequestsHistogram map[Protocol]map[float32]*timeseries.TimeSeries // by le

	Service           *Service
	RemoteApplication *Application

	ServiceRemoteIP   string
	ServiceRemotePort string
}

func (*Connection) HasConnectivityIssues added in v0.29.5

func (c *Connection) HasConnectivityIssues() bool

func (*Connection) HasFailedConnectionAttempts added in v0.29.5

func (c *Connection) HasFailedConnectionAttempts() bool

func (*Connection) IsActual

func (c *Connection) IsActual() bool

func (*Connection) IsEmpty added in v0.25.1

func (c *Connection) IsEmpty() bool

func (*Connection) IsObsolete

func (c *Connection) IsObsolete() bool

func (*Connection) Status

func (c *Connection) Status() Status

type Container

type Container struct {
	Id   string
	Name string

	InitContainer bool

	ApplicationTypes map[ApplicationType]bool

	Image string

	Status   ContainerStatus
	Reason   string
	Ready    bool
	Restarts *timeseries.TimeSeries

	LastTerminatedReason string

	CpuLimit      *timeseries.TimeSeries
	CpuRequest    *timeseries.TimeSeries
	CpuUsage      *timeseries.TimeSeries
	CpuDelay      *timeseries.TimeSeries
	ThrottledTime *timeseries.TimeSeries

	MemoryRss         *timeseries.TimeSeries
	MemoryRssForTrend *timeseries.TimeSeries

	MemoryCache   *timeseries.TimeSeries
	MemoryLimit   *timeseries.TimeSeries
	MemoryRequest *timeseries.TimeSeries

	OOMKills *timeseries.TimeSeries
}

func NewContainer

func NewContainer(id, name string) *Container

type ContainerStatus

type ContainerStatus string
const (
	ContainerStatusWaiting    ContainerStatus = "waiting"
	ContainerStatusRunning    ContainerStatus = "running"
	ContainerStatusTerminated ContainerStatus = "terminated"
)

type Costs

type Costs struct {
	CPUUsagePerHour      float32
	CPURequestPerHour    float32
	MemoryUsagePerHour   float32
	MemoryRequestPerHour float32
}

func (*Costs) CPURequestPerMonth

func (c *Costs) CPURequestPerMonth() float32

func (*Costs) CPUUsagePerMonth

func (c *Costs) CPUUsagePerMonth() float32

func (*Costs) MemoryRequestPerMonth

func (c *Costs) MemoryRequestPerMonth() float32

func (*Costs) MemoryUsagePerMonth

func (c *Costs) MemoryUsagePerMonth() float32

func (*Costs) RequestPerMonth

func (c *Costs) RequestPerMonth() float32

func (*Costs) UsagePerMonth

func (c *Costs) UsagePerMonth() float32

type CronJob

type CronJob struct {
	Schedule          LabelLastValue
	ConcurrencyPolicy LabelLastValue
	StatusActive      *timeseries.TimeSeries
	LastScheduleTime  *timeseries.TimeSeries
	NextScheduleTime  *timeseries.TimeSeries
}

type DaemonSet

type DaemonSet struct {
	ReplicasDesired *timeseries.TimeSeries
}

type DependencyMap

type DependencyMap struct {
	Nodes []*DependencyMapNode `json:"nodes"`
	Links []*DependencyMapLink `json:"links"`
}

func (*DependencyMap) GetOrCreateNode

func (m *DependencyMap) GetOrCreateNode(node DependencyMapNode) *DependencyMapNode
func (m *DependencyMap) UpdateLink(src DependencyMapInstance, sNode DependencyMapNode, dst DependencyMapInstance, dNode DependencyMapNode, linkStatus Status)

type DependencyMapInstance

type DependencyMapInstance struct {
	Id       string `json:"id"`
	Name     string `json:"name"`
	Obsolete bool   `json:"obsolete"`
}
type DependencyMapLink struct {
	SrcInstance string `json:"src_instance"`
	DstInstance string `json:"dst_instance"`

	Status Status `json:"status"`
}

type DependencyMapNode

type DependencyMapNode struct {
	Name     string `json:"name"`
	Provider string `json:"provider"`
	Region   string `json:"region"`
	AZ       string `json:"az"`

	SrcInstances []DependencyMapInstance `json:"src_instances"`
	DstInstances []DependencyMapInstance `json:"dst_instances"`
}

func (*DependencyMapNode) AddDstInstance

func (n *DependencyMapNode) AddDstInstance(i DependencyMapInstance)

func (*DependencyMapNode) AddSrcInstance

func (n *DependencyMapNode) AddSrcInstance(i DependencyMapInstance)

type Deployment

type Deployment struct {
	ReplicasDesired *timeseries.TimeSeries
	ReplicaSets     map[string]*ReplicaSet
}

type DiskStats

type DiskStats struct {
	IOUtilizationPercent *timeseries.TimeSeries
	ReadOps              *timeseries.TimeSeries
	WriteOps             *timeseries.TimeSeries
	WrittenBytes         *timeseries.TimeSeries
	ReadBytes            *timeseries.TimeSeries
	ReadTime             *timeseries.TimeSeries
	WriteTime            *timeseries.TimeSeries
	Wait                 *timeseries.TimeSeries
	Await                *timeseries.TimeSeries
}
type DocLink struct {
	Group string `json:"group"`
	Item  string `json:"item"`
	Hash  string `json:"hash"`
}
func NewDocLink(group, item, hash string) *DocLink

type DotNet added in v0.26.0

type DotNet struct {
	RuntimeVersion LabelLastValue
	Up             *timeseries.TimeSeries

	Exceptions *timeseries.TimeSeries

	MemoryAllocationRate     *timeseries.TimeSeries
	HeapSize                 map[string]*timeseries.TimeSeries
	HeapFragmentationPercent *timeseries.TimeSeries
	GcCount                  map[string]*timeseries.TimeSeries

	MonitorLockContentions   *timeseries.TimeSeries
	ThreadPoolCompletedItems *timeseries.TimeSeries
	ThreadPoolQueueSize      *timeseries.TimeSeries
	ThreadPoolSize           *timeseries.TimeSeries
}

func (*DotNet) IsUp added in v0.26.0

func (dn *DotNet) IsUp() bool

type EBS

type EBS struct {
	AllocatedGibs   *timeseries.TimeSeries
	StorageType     LabelLastValue
	ProvisionedIOPS *timeseries.TimeSeries
	VolumeId        string
}

type Elasticache added in v0.17.5

type Elasticache struct {
	Status LabelLastValue

	Engine        LabelLastValue
	EngineVersion LabelLastValue

	LifeSpan *timeseries.TimeSeries
}

type FlameGraphNode added in v0.27.0

type FlameGraphNode struct {
	Name     string            `json:"name"`
	Total    int64             `json:"total"`
	Self     int64             `json:"self"`
	Comp     int64             `json:"comp"`
	Children []*FlameGraphNode `json:"children"`
	ColorBy  string            `json:"color_by"`
	Data     map[string]string `json:"data"`
}

func (*FlameGraphNode) Diff added in v1.0.0

func (n *FlameGraphNode) Diff(comparison *FlameGraphNode)

func (*FlameGraphNode) Insert added in v0.27.0

func (n *FlameGraphNode) Insert(name string) *FlameGraphNode

func (*FlameGraphNode) InsertStack added in v0.27.0

func (n *FlameGraphNode) InsertStack(stack []string, value int64, comp *int64)

type Heatmap

type Heatmap struct {
	Ctx timeseries.Context `json:"ctx"`

	Title  string     `json:"title"`
	Series SeriesList `json:"series"`

	Annotations []Annotation `json:"annotations"`

	DrillDownLink *RouterLink `json:"drill_down_link"`
}

func NewHeatmap

func NewHeatmap(ctx timeseries.Context, title string) *Heatmap

func (*Heatmap) AddAnnotation

func (hm *Heatmap) AddAnnotation(annotations ...Annotation) *Heatmap

func (*Heatmap) AddSeries

func (hm *Heatmap) AddSeries(name, title string, data SeriesData, threshold string, value string) *Heatmap

func (*Heatmap) IsEmpty added in v0.18.0

func (hm *Heatmap) IsEmpty() bool

type HistogramBucket

type HistogramBucket struct {
	Le         float32
	TimeSeries *timeseries.TimeSeries
}

type Icon

type Icon struct {
	Name  string `json:"name"`
	Color string `json:"color"`
}

type Indicator

type Indicator struct {
	Status  Status `json:"status"`
	Message string `json:"message"`
}

func CalcIndicators

func CalcIndicators(app *Application) []Indicator

type Instance

type Instance struct {
	Name    string
	OwnerId ApplicationId

	Node *Node

	Pod *Pod

	Rds         *Rds
	Elasticache *Elasticache

	Jvms   map[string]*Jvm
	DotNet map[string]*DotNet

	Volumes []*Volume

	Upstreams []*Connection

	TcpListens map[Listen]bool

	Containers map[string]*Container

	LogMessages map[LogLevel]*LogMessages

	ClusterName LabelLastValue

	ClusterComponent *Application

	Postgres *Postgres
	Redis    *Redis
	Mongodb  *Mongodb
	// contains filtered or unexported fields
}

func NewInstance

func NewInstance(name string, owner ApplicationId) *Instance

func (*Instance) AddUpstreamConnection

func (instance *Instance) AddUpstreamConnection(actualIP, actualPort, serviceIP, servicePort, container string) *Connection

func (*Instance) ApplicationTypes

func (instance *Instance) ApplicationTypes() map[ApplicationType]bool

func (*Instance) ClusterRole

func (instance *Instance) ClusterRole() *timeseries.TimeSeries

func (*Instance) ClusterRoleLast

func (instance *Instance) ClusterRoleLast() ClusterRole

func (*Instance) GetOrCreateContainer

func (instance *Instance) GetOrCreateContainer(id, name string) *Container

func (*Instance) InstrumentedType

func (instance *Instance) InstrumentedType() ApplicationType

func (*Instance) IsFailed

func (instance *Instance) IsFailed() bool

func (*Instance) IsListenActive

func (instance *Instance) IsListenActive(ip, port string) bool

func (*Instance) IsObsolete

func (instance *Instance) IsObsolete() bool

func (*Instance) IsUp

func (instance *Instance) IsUp() bool

func (*Instance) LifeSpan

func (instance *Instance) LifeSpan() *timeseries.TimeSeries

func (*Instance) NodeName

func (instance *Instance) NodeName() string

func (*Instance) UpAndRunning

func (instance *Instance) UpAndRunning() *timeseries.TimeSeries

func (*Instance) UpdateClusterRole

func (instance *Instance) UpdateClusterRole(role string, v *timeseries.TimeSeries)

type IntegrationStatus

type IntegrationStatus struct {
	NodeAgent struct {
		Installed bool
	}
	KubeStateMetrics struct {
		Required  bool
		Installed bool
	}
}

type InterfaceStats

type InterfaceStats struct {
	Name      string
	Addresses []string
	Up        *timeseries.TimeSeries
	RxBytes   *timeseries.TimeSeries
	TxBytes   *timeseries.TimeSeries
}

type Job

type Job struct{}

type Jvm

type Jvm struct {
	JavaVersion LabelLastValue

	HeapSize *timeseries.TimeSeries
	HeapUsed *timeseries.TimeSeries

	SafepointTime     *timeseries.TimeSeries
	SafepointSyncTime *timeseries.TimeSeries

	GcTime map[string]*timeseries.TimeSeries
}

func (*Jvm) IsUp

func (j *Jvm) IsUp() bool

type LabelLastValue

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

func (LabelLastValue) MarshalJSON

func (lv LabelLastValue) MarshalJSON() ([]byte, error)

func (*LabelLastValue) Update

func (lv *LabelLastValue) Update(ts *timeseries.TimeSeries, value string)

func (LabelLastValue) Value

func (lv LabelLastValue) Value() string

type Labels

type Labels map[string]string

func (Labels) Hash added in v1.0.0

func (ls Labels) Hash() uint64

func (Labels) String added in v1.0.0

func (ls Labels) String() string

type LatencySLI

type LatencySLI struct {
	Config CheckConfigSLOLatency

	Histogram    []HistogramBucket
	HistogramRaw []HistogramBucket
}

func (*LatencySLI) GetTotalAndFast

func (sli *LatencySLI) GetTotalAndFast(raw bool) (*timeseries.TimeSeries, *timeseries.TimeSeries)

type Listen

type Listen struct {
	IP      string
	Port    string
	Proxied bool
}

type LogEntry added in v0.27.0

type LogEntry struct {
	Timestamp          time.Time
	Severity           string
	Body               string
	TraceId            string
	LogAttributes      map[string]string
	ResourceAttributes map[string]string
}

type LogLevel

type LogLevel string
const (
	LogLevelWarning  LogLevel = "warning"
	LogLevelError    LogLevel = "error"
	LogLevelCritical LogLevel = "critical"
)

func (LogLevel) IsError added in v0.20.0

func (s LogLevel) IsError() bool

type LogMessages added in v0.20.0

type LogMessages struct {
	Messages *timeseries.TimeSeries
	Patterns map[string]*LogPattern
}

type LogPattern

type LogPattern struct {
	Pattern   *logparser.Pattern
	Level     LogLevel
	Sample    string
	Multiline bool
	Messages  *timeseries.TimeSeries
}

type LogSource added in v0.27.0

type LogSource string
const (
	LogSourceOtel  LogSource = "otel"
	LogSourceAgent LogSource = "agent"
)

type Logs added in v0.20.0

type Logs struct {
	ApplicationId ApplicationId `json:"application_id"`
	Check         *Check        `json:"check"`
}

type MetricValues

type MetricValues struct {
	Labels     Labels
	LabelsHash uint64
	Values     *timeseries.TimeSeries
}

type MetricsSnapshot

type MetricsSnapshot struct {
	Timestamp timeseries.Time     `json:"timestamp"`
	Duration  timeseries.Duration `json:"duration"`

	Requests int64            `json:"requests"`
	Errors   int64            `json:"errors"`
	Latency  map[string]int64 `json:"latency"`

	Restarts          int64   `json:"restarts"`
	CPUUsage          float32 `json:"cpu_usage"`
	MemoryLeakPercent float32 `json:"memory_leak_percent"`
	MemoryUsage       int64   `json:"memory_usage"`
	OOMKills          int64   `json:"oom_kills"`
	LogErrors         int64   `json:"log_errors"`
	LogWarnings       int64   `json:"log_warnings"`
}

type Mongodb added in v0.24.0

type Mongodb struct {
	Up          *timeseries.TimeSeries
	ReplicaSet  LabelLastValue
	State       LabelLastValue
	LastApplied *timeseries.TimeSeries
}

func NewMongodb added in v0.24.0

func NewMongodb() *Mongodb

func (*Mongodb) IsUp added in v0.24.0

func (m *Mongodb) IsUp() bool

type NetInterface

type NetInterface struct {
	Name string
	Rx   string
	Tx   string
}

type Node

type Node struct {
	AgentVersion LabelLastValue

	Name      LabelLastValue
	K8sName   LabelLastValue
	MachineID string
	Uptime    *timeseries.TimeSeries

	CpuCapacity     *timeseries.TimeSeries
	CpuUsagePercent *timeseries.TimeSeries
	CpuUsageByMode  map[string]*timeseries.TimeSeries

	MemoryTotalBytes     *timeseries.TimeSeries
	MemoryFreeBytes      *timeseries.TimeSeries
	MemoryAvailableBytes *timeseries.TimeSeries
	MemoryCachedBytes    *timeseries.TimeSeries

	Disks         map[string]*DiskStats
	NetInterfaces []*InterfaceStats

	Instances []*Instance `json:"-"`

	CloudProvider     LabelLastValue
	Region            LabelLastValue
	AvailabilityZone  LabelLastValue
	InstanceType      LabelLastValue
	InstanceLifeCycle LabelLastValue

	Fargate bool
	Price   *NodePrice
}

func NewNode

func NewNode(machineId string) *Node

func (*Node) GetName added in v0.22.0

func (n *Node) GetName() string

func (*Node) IsAgentInstalled added in v0.22.0

func (n *Node) IsAgentInstalled() bool

func (*Node) IsDown added in v0.22.0

func (n *Node) IsDown() bool

func (*Node) IsUp

func (n *Node) IsUp() bool

func (*Node) Status added in v0.22.0

func (n *Node) Status() Status

type NodePrice

type NodePrice struct {
	Total         float32
	PerCPUCore    float32
	PerMemoryByte float32
}

type PgConnectionKey

type PgConnectionKey struct {
	Db            string
	User          string
	State         string
	Query         string
	WaitEventType string
}

func (PgConnectionKey) String

func (k PgConnectionKey) String() string

type PgSetting

type PgSetting struct {
	Samples *timeseries.TimeSeries
	Unit    string
}

type Pod

type Pod struct {
	Phase     string
	Reason    string
	Scheduled bool

	Running  *timeseries.TimeSeries
	Ready    *timeseries.TimeSeries
	LifeSpan *timeseries.TimeSeries

	ReplicaSet string

	InitContainers map[string]*Container
}

func (*Pod) IsFailed

func (pod *Pod) IsFailed() bool

func (*Pod) IsObsolete

func (pod *Pod) IsObsolete() bool

func (*Pod) IsPending

func (pod *Pod) IsPending() bool

func (*Pod) IsReady

func (pod *Pod) IsReady() bool

func (*Pod) IsRunning

func (pod *Pod) IsRunning() bool

type Postgres

type Postgres struct {
	Up *timeseries.TimeSeries

	Version LabelLastValue

	Connections                   map[PgConnectionKey]*timeseries.TimeSeries
	AwaitingQueriesByLockingQuery map[QueryKey]*timeseries.TimeSeries

	Settings map[string]PgSetting

	PerQuery    map[QueryKey]*QueryStat
	QueriesByDB map[string]*timeseries.TimeSeries

	Avg *timeseries.TimeSeries
	P50 *timeseries.TimeSeries
	P95 *timeseries.TimeSeries
	P99 *timeseries.TimeSeries

	WalCurrentLsn *timeseries.TimeSeries
	WalReceiveLsn *timeseries.TimeSeries
	WalReplayLsn  *timeseries.TimeSeries
}

func NewPostgres

func NewPostgres() *Postgres

func (*Postgres) IsUp

func (p *Postgres) IsUp() bool

func (*Postgres) Unavailability

func (p *Postgres) Unavailability() *timeseries.TimeSeries

type Profile

type Profile struct {
	Type       ProfileType     `json:"type"`
	FlameGraph *FlameGraphNode `json:"flamegraph"`
	Diff       bool            `json:"diff"`
}

type ProfileAggregation added in v0.27.0

type ProfileAggregation string
const (
	ProfileAggregationSum ProfileAggregation = "sum"
	ProfileAggregationAvg ProfileAggregation = "avg"
)

type ProfileCategory added in v0.27.0

type ProfileCategory string

type ProfileMeta added in v0.27.0

type ProfileMeta struct {
	Category    ProfileCategory
	Name        string
	Aggregation ProfileAggregation
	Featured    bool
}

type ProfileType added in v0.27.0

type ProfileType string
const (
	ProfileTypeEbpfCPU            ProfileType = "ebpf:cpu:nanoseconds"
	ProfileTypeGoCPU              ProfileType = "go:profile_cpu:nanoseconds"
	ProfileTypeGoHeapAllocObjects ProfileType = "go:heap_alloc_objects:count"
	ProfileTypeGoHeapAllocSpace   ProfileType = "go:heap_alloc_space:bytes"
	ProfileTypeGoHeapInuseObjects ProfileType = "go:heap_inuse_objects:count"
	ProfileTypeGoHeapInuseSpace   ProfileType = "go:heap_inuse_space:bytes"
	ProfileTypeGoGoroutines       ProfileType = "go:goroutine_goroutine:count"
	ProfileTypeGoBlockContentions ProfileType = "go:block_contentions:count"
	ProfileTypeGoBlockDelay       ProfileType = "go:block_delay:nanoseconds"
	ProfileTypeGoMutexContentions ProfileType = "go:mutex_contentions:count"
	ProfileTypeGoMutexDelay       ProfileType = "go:mutex_delay:nanoseconds"
)

type Profiling added in v0.27.0

type Profiling struct {
	ApplicationId ApplicationId `json:"application_id"`
}

type Progress

type Progress struct {
	Percent int    `json:"percent"`
	Color   string `json:"color"`
}

type Protocol

type Protocol string

type QueryKey

type QueryKey struct {
	Db    string
	User  string
	Query string
}

func (QueryKey) String

func (k QueryKey) String() string

type QueryStat

type QueryStat struct {
	Calls     *timeseries.TimeSeries
	TotalTime *timeseries.TimeSeries
	IoTime    *timeseries.TimeSeries
}

type Rds

type Rds struct {
	Status LabelLastValue

	Engine        LabelLastValue
	EngineVersion LabelLastValue
	MultiAz       LabelLastValue

	LifeSpan *timeseries.TimeSeries
}

type Redis

type Redis struct {
	Up        *timeseries.TimeSeries
	Version   LabelLastValue
	Role      LabelLastValue
	Calls     map[string]*timeseries.TimeSeries
	CallsTime map[string]*timeseries.TimeSeries
}

func NewRedis

func NewRedis() *Redis

func (*Redis) IsUp

func (r *Redis) IsUp() bool

type ReplicaSet

type ReplicaSet struct {
}
type RouterLink struct {
	Title  string         `json:"title"`
	Route  string         `json:"name,omitempty"`
	Params map[string]any `json:"params,omitempty"`
	Args   map[string]any `json:"query,omitempty"`
	Hash   string         `json:"hash,omitempty"`
}
func NewRouterLink(title string, route string) *RouterLink

func (*RouterLink) SetArg

func (l *RouterLink) SetArg(k string, v any) *RouterLink

func (*RouterLink) SetHash

func (l *RouterLink) SetHash(v string) *RouterLink

func (*RouterLink) SetParam

func (l *RouterLink) SetParam(k string, v any) *RouterLink

type Series

type Series struct {
	Name      string `json:"name"`
	Title     string `json:"title,omitempty"`
	Color     string `json:"color,omitempty"`
	Fill      bool   `json:"fill,omitempty"`
	Threshold string `json:"threshold,omitempty"`

	Data  SeriesData `json:"data"`
	Value string     `json:"value"`
}

func HistogramSeries

func HistogramSeries(buckets []HistogramBucket, objectiveBucket, objectivePercentage float32) []Series

type SeriesData

type SeriesData interface {
	IsEmpty() bool
	Get() *timeseries.TimeSeries
	Reduce(timeseries.F) float32
}

type SeriesList

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

func (SeriesList) IsEmpty added in v0.17.12

func (sl SeriesList) IsEmpty() bool

func (SeriesList) MarshalJSON

func (sl SeriesList) MarshalJSON() ([]byte, error)

type Service

type Service struct {
	Name      string
	Namespace string
	ClusterIP string

	Connections []*Connection
}

func (*Service) GetDestinationApplicationId

func (svc *Service) GetDestinationApplicationId() (ApplicationId, bool)

type StatefulSet

type StatefulSet struct {
	ReplicasDesired *timeseries.TimeSeries
	ReplicasUpdated *timeseries.TimeSeries
}

type Status

type Status int
const (
	UNKNOWN Status = iota
	OK
	INFO
	WARNING
	CRITICAL
)

func (Status) Color

func (s Status) Color() string

func (Status) MarshalJSON

func (s Status) MarshalJSON() ([]byte, error)

func (Status) String

func (s Status) String() string

type Table

type Table struct {
	Header []string    `json:"header"`
	Rows   []*TableRow `json:"rows"`
	// contains filtered or unexported fields
}

func NewTable

func NewTable(header ...string) *Table

func (*Table) AddRow

func (t *Table) AddRow(cells ...*TableCell) *TableRow

func (*Table) SetSorted

func (t *Table) SetSorted(s bool) *Table

func (*Table) SortRows

func (t *Table) SortRows()

type TableCell

type TableCell struct {
	Icon          *Icon                  `json:"icon"`
	Value         string                 `json:"value"`
	ShortValue    string                 `json:"short_value"`
	Values        []string               `json:"values"`
	Tags          []string               `json:"tags"`
	Unit          string                 `json:"unit"`
	Status        *Status                `json:"status"`
	Link          *RouterLink            `json:"link"`
	Progress      *Progress              `json:"progress"`
	NetInterfaces []NetInterface         `json:"net_interfaces"`
	Chart         *timeseries.TimeSeries `json:"chart"`
	IsStub        bool                   `json:"is_stub"`
	MaxWidth      int                    `json:"max_width"`

	DeploymentSummaries []ApplicationDeploymentSummary `json:"deployment_summaries"`
}

func NewTableCell

func NewTableCell(values ...string) *TableCell

func (*TableCell) AddTag

func (c *TableCell) AddTag(format string, a ...any) *TableCell

func (*TableCell) SetChart

func (c *TableCell) SetChart(ts *timeseries.TimeSeries) *TableCell

func (*TableCell) SetIcon

func (c *TableCell) SetIcon(name, color string) *TableCell

func (*TableCell) SetMaxWidth added in v0.25.0

func (c *TableCell) SetMaxWidth(w int) *TableCell

func (*TableCell) SetProgress

func (c *TableCell) SetProgress(percent int, color string) *TableCell

func (*TableCell) SetShortValue

func (c *TableCell) SetShortValue(value string) *TableCell

func (*TableCell) SetStatus

func (c *TableCell) SetStatus(status Status, msg string) *TableCell

func (*TableCell) SetStub

func (c *TableCell) SetStub(format string, a ...any) *TableCell

func (*TableCell) SetUnit

func (c *TableCell) SetUnit(unit string) *TableCell

func (*TableCell) SetValue

func (c *TableCell) SetValue(value string) *TableCell

func (*TableCell) UpdateStatus

func (c *TableCell) UpdateStatus(status Status) *TableCell

type TableRow

type TableRow struct {
	Id    string       `json:"id"`
	Cells []*TableCell `json:"cells"`
}

func (*TableRow) SetId

func (r *TableRow) SetId(id string) *TableRow

type Trace added in v1.0.0

type Trace struct {
	Spans []*TraceSpan
}

type TraceErrorsStat added in v1.0.0

type TraceErrorsStat struct {
	ServiceName   string  `json:"service_name"`
	SpanName      string  `json:"span_name"`
	Labels        Labels  `json:"labels"`
	SampleTraceId string  `json:"sample_trace_id"`
	SampleError   string  `json:"sample_error"`
	Count         float32 `json:"count"`
}

type TraceSource added in v0.27.0

type TraceSource string
const (
	TraceSourceOtel  TraceSource = "otel"
	TraceSourceAgent TraceSource = "agent"
)

type TraceSpan added in v0.27.0

type TraceSpan struct {
	Timestamp          time.Time
	Name               string
	TraceId            string
	SpanId             string
	ParentSpanId       string
	ServiceName        string
	Duration           time.Duration
	StatusCode         string
	StatusMessage      string
	ResourceAttributes map[string]string
	SpanAttributes     map[string]string
	Events             []TraceSpanEvent
}

func (*TraceSpan) Details added in v1.0.0

func (s *TraceSpan) Details() TraceSpanDetails

func (*TraceSpan) ErrorMessage added in v1.0.0

func (s *TraceSpan) ErrorMessage() string

func (*TraceSpan) Labels added in v1.0.0

func (s *TraceSpan) Labels() Labels

func (*TraceSpan) Status added in v1.0.0

func (s *TraceSpan) Status() TraceSpanStatus

type TraceSpanAttrStats added in v1.0.0

type TraceSpanAttrStats struct {
	Name   string                     `json:"name"`
	Values []*TraceSpanAttrStatsValue `json:"values"`
}

type TraceSpanAttrStatsValue added in v1.0.0

type TraceSpanAttrStatsValue struct {
	Name          string  `json:"name"`
	Selection     float32 `json:"selection"`
	Baseline      float32 `json:"baseline"`
	SampleTraceId string  `json:"sample_trace_id"`
}

type TraceSpanDetails added in v1.0.0

type TraceSpanDetails struct {
	Text string `json:"text"`
	Lang string `json:"lang"`
}

type TraceSpanEvent added in v0.27.0

type TraceSpanEvent struct {
	Timestamp  time.Time
	Name       string
	Attributes map[string]string
}

type TraceSpanStats added in v1.0.0

type TraceSpanStats struct {
	ServiceName       string    `json:"service_name"`
	SpanName          string    `json:"span_name"`
	Total             float32   `json:"total"`
	Failed            float32   `json:"failed"`
	DurationQuantiles []float32 `json:"duration_quantiles"`
}

type TraceSpanStatus added in v1.0.0

type TraceSpanStatus struct {
	Error   bool   `json:"error"`
	Message string `json:"message"`
}

type TraceSpanSummary added in v1.0.0

type TraceSpanSummary struct {
	Stats   []TraceSpanStats `json:"stats"`
	Overall TraceSpanStats   `json:"overall"`
}

type Tracing

type Tracing struct {
	ApplicationId ApplicationId `json:"application_id"`
}

type Volume

type Volume struct {
	Name       LabelLastValue
	Device     LabelLastValue
	MountPoint string

	EBS           *EBS
	CapacityBytes *timeseries.TimeSeries
	UsedBytes     *timeseries.TimeSeries
}

type Widget

type Widget struct {
	Chart         *Chart         `json:"chart,omitempty"`
	ChartGroup    *ChartGroup    `json:"chart_group,omitempty"`
	Table         *Table         `json:"table,omitempty"`
	DependencyMap *DependencyMap `json:"dependency_map,omitempty"`
	Heatmap       *Heatmap       `json:"heatmap,omitempty"`

	Logs      *Logs      `json:"logs,omitempty"`
	Profiling *Profiling `json:"profiling,omitempty"`
	Tracing   *Tracing   `json:"tracing,omitempty"`

	Width   string   `json:"width,omitempty"`
	DocLink *DocLink `json:"doc_link,omitempty"`
}

func (*Widget) AddAnnotation

func (w *Widget) AddAnnotation(annotations ...Annotation)

type World

type World struct {
	Ctx timeseries.Context

	CheckConfigs CheckConfigs

	Nodes        []*Node
	Applications map[ApplicationId]*Application

	IntegrationStatus IntegrationStatus
	// contains filtered or unexported fields
}

func NewWorld

func NewWorld(from, to timeseries.Time, step timeseries.Duration) *World

func (*World) GetApplication

func (w *World) GetApplication(id ApplicationId) *Application

func (*World) GetApplicationByNsAndName added in v0.25.1

func (w *World) GetApplicationByNsAndName(ns, name string) *Application

func (*World) GetNode

func (w *World) GetNode(name string) *Node

func (*World) GetOrCreateApplication

func (w *World) GetOrCreateApplication(id ApplicationId) *Application

Jump to

Keyboard shortcuts

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