Documentation
¶
Index ¶
- type CPUStatistics
- type CoreStatistics
- type DataPointsInfo
- type FetchDataPoints
- type FunctionMetrics
- type FunctionTraceDetails
- type GoRoutinesStatistic
- type GoroutineGroup
- type GoroutineLeakReport
- type Health
- type HealthFields
- type LoadStatistics
- type MemoryStatistics
- type Profiles
- type RawMemStatsRecords
- type Record
- type ReportsRequest
- type ServiceHealth
- type ServiceHealthThresholds
- type ServiceInfo
- type ServiceStats
- type SystemHealthInPercent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CPUStatistics ¶
type CPUStatistics struct {
TotalCores float64 `json:"total_cores"`
TotalLogicalCores float64 `json:"total_logical_cores"`
CoresUsedBySystem float64 `json:"cores_used_by_system"`
CoresUsedByService float64 `json:"cores_used_by_service"`
CoresUsedByServiceInPercent string `json:"cores_used_by_service_in_percent"`
CoresUsedBySystemInPercent string `json:"cores_used_by_system_in_percent"`
}
CPUStatistics represents the CPU statistics of the service.
type CoreStatistics ¶
CoreStatistics represents the core statistics of the service.
type DataPointsInfo ¶
type DataPointsInfo struct {
FieldName string `json:"field_name"`
Data []interface{} `json:"data_points"`
}
DataPointsInfo is the struct to store the data points information
type FetchDataPoints ¶
type FetchDataPoints struct {
FieldName []string `json:"field_name"`
StartTime string `json:"start_time"` // "2006-01-02T15:04:05Z07:00"
EndTime string `json:"end_time"` // "2006-01-02T15:04:05Z07:00"
}
FetchDataPoints is the struct to fetch the data points from the storage
type FunctionMetrics ¶ added in v0.0.2
type FunctionMetrics struct {
FunctionLastRanAt time.Time `json:"function_last_ran_at"`
CPUProfileFilePath string `json:"cpu_profile_file_path"`
MemProfileFilePath string `json:"mem_profile_file_path"`
ExecutionTime time.Duration `json:"execution_time"`
// MemoryUsage is the heap delta measured around the last *sampled* call.
// Profiling runs on one call in SamplingRate (100 by default), so most
// calls leave this untouched.
//
// MemoryUsageSampled says whether it was ever measured at all. Without it
// an unmeasured function is indistinguishable from one that allocated
// nothing, and the dashboard would print a confident 0 for both.
MemoryUsage uint64 `json:"memory_usage"`
MemoryUsageSampled bool `json:"memory_usage_sampled"`
// CallCount is how many times this function has been traced. The counter
// already existed to drive sampling; it is reported because "how slow" is
// hard to read without "how often".
CallCount uint64 `json:"call_count"`
/*
* ApproximateP50 and ApproximateP95 summarise call latency.
*
* Approximate is not a hedge: they come from a fixed-bucket histogram, so
* each is the upper bound of the bucket the quantile falls in, not an
* interpolated value. Read 4ms as "at most 4ms". Bucket resolution is
* enough to find the slow function and not enough to quote as an SLO.
*
* Zero with PercentilesReliable false means too few calls to summarise --
* p95 of three calls is just the slowest of three.
*/
ApproximateP50 time.Duration `json:"approximate_p50_ns"`
ApproximateP95 time.Duration `json:"approximate_p95_ns"`
PercentilesReliable bool `json:"percentiles_reliable"`
// GoroutineCount is the change in the process-wide goroutine count observed
// across the last call: runtime.NumGoroutine() after minus before.
//
// It is NOT this function's goroutines. Any other goroutine starting or
// finishing during the call moves it, so on a busy process it is a hint
// rather than a measurement. Negative values are real and are kept: a call
// that lets goroutines finish is as interesting as one that starts them.
GoroutineCount int `json:"goroutine_count"`
}
FunctionMetrics represents the function metrics.
Every field describes the MOST RECENT call, not a total across calls: each traced call overwrites the previous values. There is no call counter and no histogram, so percentiles and totals cannot be derived from this.
type FunctionTraceDetails ¶ added in v0.0.2
type FunctionTraceDetails struct {
FunctionName string `json:"function_name"`
CoreProfile Profiles `json:"core_profile"`
FunctionCodeTrace string `json:"function_code_trace"`
}
FunctionTraceDetails represents the function trace details.
type GoRoutinesStatistic ¶
type GoRoutinesStatistic struct {
NumberOfGoroutines int `json:"number_of_goroutines"`
StackView []string `json:"stack_view"`
// LeakReport is nil when leak detection has not produced a verdict yet.
LeakReport *GoroutineLeakReport `json:"leak_report,omitempty"`
}
GoRoutinesStatistic represents the Go routines statistics.
type GoroutineGroup ¶ added in v1.3.0
type GoroutineGroup struct {
// Signature identifies the shared call stack. It is a short hash, stable
// for as long as the call stack is byte-identical.
Signature string `json:"signature"`
// State is the runtime wait reason, e.g. "chan receive" or "select".
State string `json:"state"`
// Count is how many goroutines currently share this call stack.
Count int `json:"count"`
// BlockedMinutes is the longest time any goroutine in the group has been
// blocked, as reported by the runtime. Zero means under a minute, or a
// state the runtime does not timestamp.
BlockedMinutes int `json:"blocked_minutes"`
// Growth is the change in Count across the retained snapshot window.
Growth int `json:"growth"`
// Stale marks a group blocked at or beyond the configured threshold.
Stale bool `json:"stale"`
// Growing marks a group whose Count rose in every retained snapshot.
Growing bool `json:"growing"`
// CallStack is the shared stack, excluding the per-goroutine header line.
CallStack string `json:"call_stack"`
}
GoroutineGroup describes a set of goroutines sharing an identical call stack.
type GoroutineLeakReport ¶ added in v1.3.0
type GoroutineLeakReport struct {
TotalGoroutines int `json:"total_goroutines"`
// StaleGoroutines counts goroutines blocked at or beyond the threshold.
StaleGoroutines int `json:"stale_goroutines"`
// GrowingGroups counts distinct call stacks growing monotonically.
GrowingGroups int `json:"growing_groups"`
// LeakSuspected is true when anything stale or growing was found.
LeakSuspected bool `json:"leak_suspected"`
Message string `json:"message"`
// StaleThresholdMinutes is the threshold this pass was evaluated against.
StaleThresholdMinutes int `json:"stale_threshold_minutes"`
// SnapshotsRetained is how many periodic snapshots growth was computed
// over. Growth is only reported once the window is full.
SnapshotsRetained int `json:"snapshots_retained"`
SnapshotsRequired int `json:"snapshots_required"`
// SuspiciousGroups holds the offending groups, worst first.
SuspiciousGroups []GoroutineGroup `json:"suspicious_groups,omitempty"`
// Groups holds every distinct call stack, worst first, whether or not it
// is suspicious. The dashboard needs all of them to break goroutines down
// by state and to rank them by blocked time; a report that carried only
// the offenders could not answer "what are the other 4000 doing".
//
// Capped, so a service with thousands of distinct stacks does not turn one
// poll into a multi-megabyte response. GroupsTotal is the uncapped count,
// so the UI can say how many it is not showing rather than implying the
// list is complete.
Groups []GoroutineGroup `json:"groups,omitempty"`
GroupsTotal int `json:"groups_total"`
}
GoroutineLeakReport is the verdict of a single leak-detection pass.
type Health ¶
type Health struct {
Percent float64 `json:"percent"`
Healthy bool `json:"healthy"`
Message string `json:"message"`
IconMsg string `json:"icon_msg"`
}
Health represents the health of the service.
type HealthFields ¶ added in v0.0.2
type LoadStatistics ¶
type LoadStatistics struct {
ServiceCPULoad string `json:"service_cpu_load"`
SystemCPULoad string `json:"system_cpu_load"`
TotalCPULoad string `json:"total_cpu_load"`
ServiceMemLoad string `json:"service_memory_load"`
SystemMemLoad string `json:"system_memory_load"`
TotalMemLoad string `json:"total_memory_load"`
OverallLoadOfService string `json:"overall_load_of_service"` // Final load of the service
ServiceDiskLoad string `json:"service_disk_load"`
SystemDiskLoad string `json:"system_disk_load"`
TotalDiskLoad string `json:"total_disk_load"`
// Raw values for storage
ServiceCPULoadRaw float64 `json:"-"`
SystemCPULoadRaw float64 `json:"-"`
ServiceMemLoadRaw float64 `json:"-"`
SystemMemLoadRaw float64 `json:"-"`
OverallLoadOfServiceRaw float64 `json:"-"`
SystemDiskLoadRaw float64 `json:"-"`
TotalDiskLoadRaw float64 `json:"-"`
}
LoadStatistics represents the load statistics of the service.
type MemoryStatistics ¶
type MemoryStatistics struct {
TotalSystemMemory string `json:"total_system_memory"`
MemoryUsedBySystem string `json:"memory_used_by_system"`
MemoryUsedByService string `json:"memory_used_by_service"`
AvailableMemory string `json:"available_memory"`
GCPauseDuration string `json:"gc_pause_duration"`
StackMemoryUsage string `json:"stack_memory_usage"`
TotalSwapMemory string `json:"total_swap_memory"`
FreeSwapMemory string `json:"free_swap_memory"`
MemStatsRecords []Record `json:"mem_stats_records"` // List of memory statistic records.
RawMemStatsRecords []RawMemStatsRecords `json:"raw_mem_stats_records"` // RawMemStatsRecords holds a list of raw memory statistic records.
// Unformatted values, in bytes unless noted. The string fields above are
// pre-formatted for display and carry a unit suffix ("6.82 MB", "15.2 GB"),
// which makes them unsafe to compare or plot: parsing a number out of one
// discards the unit, so a value in MB and a value in GB end up on the same
// axis. Anything doing arithmetic or drawing a chart must use these instead.
TotalSystemMemoryRaw float64 `json:"total_system_memory_bytes"`
MemoryUsedBySystemRaw float64 `json:"memory_used_by_system_bytes"`
MemoryUsedByServiceRaw float64 `json:"memory_used_by_service_bytes"`
AvailableMemoryRaw float64 `json:"available_memory_bytes"`
StackMemoryUsageRaw float64 `json:"stack_memory_usage_bytes"`
GCPauseDurationRaw float64 `json:"gc_pause_duration_ms"`
}
MemoryStatistics represents the memory statistics of the service.
type RawMemStatsRecords ¶
type RawMemStatsRecords struct {
RecordName string `json:"record_name"`
RecordValue float64 `json:"record_value"`
}
RawMemStatsRecords holds a list of raw memory statistic records.
type Record ¶
type Record struct {
Name string `json:"record_name"`
Description string `json:"record_description"`
Value interface{} `json:"record_value"`
Unit string `json:"record_unit,omitempty"` // Added Unit to support different units like bytes, MB, GB, etc.
}
Record represents a single memory statistic record.
type ReportsRequest ¶
type ReportsRequest struct {
Topic string `json:"topic"`
StartTime string `json:"start_time"` // "2006-01-02T15:04:05Z07:00"
EndTime string `json:"end_time"` // "2006-01-02T15:04:05Z07:00"
TimeFrame string `json:"time_frame"`
}
ReportsRequest is the struct to store the reports request
type ServiceHealth ¶
type ServiceHealth struct {
SystemHealth Health `json:"system_health"`
ServiceHealth Health `json:"service_health"`
}
ServiceHealth represents the health of the service.
type ServiceHealthThresholds ¶
type ServiceHealthThresholds struct {
MaxCPUUsage float64 `json:"max_cpu_usage"` // Default is 80%
MaxMemoryUsage float64 `json:"max_memory_usage"` // Default is 80%
MaxGoRoutines int `json:"max_go_routines"` // Default is 1000
}
ServiceHealthThresholds is the struct to store the service health thresholds
type ServiceInfo ¶
type ServiceInfo struct {
ServiceName string `json:"service_name"`
ServiceStartTime time.Time `json:"service_start_time"`
GoVersion string `json:"go_version"`
ProcessId int32 `json:"process_id"`
// Storage footprint. Retention and where the data lives are properties of
// the instrument rather than of any one metric, so the dashboard shows them
// in its chrome. Both are omitted when unset rather than reported as zero,
// since "0s retention" and "not configured" are different states.
RetentionPeriod string `json:"retention_period,omitempty"`
StorageType string `json:"storage_type,omitempty"`
StorageOnDisk string `json:"storage_on_disk,omitempty"`
// DataPointsSyncFrequency is how often metrics are written to storage.
// The dashboard quotes it when explaining why a chart has too little
// history; without it the front end hardcoded "5m" and told a service
// configured with anything else a false number.
DataPointsSyncFrequency string `json:"data_points_sync_frequency,omitempty"`
// MonigoVersion is the version of this library compiled into the binary,
// read from build info. Omitted when it is not knowable -- a local checkout
// or a replace directive -- so the dashboard can hide the badge rather than
// show "(devel)".
MonigoVersion string `json:"monigo_version,omitempty"`
}
ServiceInfo is the struct to store the service information
type ServiceStats ¶
type ServiceStats struct {
CoreStatistics CoreStatistics `json:"core_statistics"` // Core Statistics
LoadStatistics LoadStatistics `json:"load_statistics"` // Load Statistics
CPUStatistics CPUStatistics `json:"cpu_statistics"` // CPU Statistics
MemoryStatistics MemoryStatistics `json:"memory_statistics"` // Memory Statistics
// Additional Metrics
HeapAllocByService string `json:"heap_alloc_by_service"`
HeapAllocBySystem string `json:"heap_alloc_by_system"`
TotalAllocByService string `json:"total_alloc_by_service"`
TotalMemoryByOS string `json:"total_memory_by_os"`
// Raw values for storage
HeapAllocByServiceRaw uint64 `json:"-"`
HeapAllocBySystemRaw uint64 `json:"-"`
TotalAllocByServiceRaw uint64 `json:"-"`
TotalMemoryByOSRaw uint64 `json:"-"`
DiskIO struct {
ReadBytes uint64 `json:"read_bytes"`
WriteBytes uint64 `json:"write_bytes"`
} `json:"disk_io"` // Disk Use percentage
NetworkIO struct {
BytesSent float64 `json:"bytes_sent"`
BytesReceived float64 `json:"bytes_received"`
} `json:"network_io"`
// Health
Health ServiceHealth `json:"health"`
// GoroutineLeakReport is the verdict of the most recent leak-detection
// pass. Nil when no pass has run.
GoroutineLeakReport *GoroutineLeakReport `json:"goroutine_leak_report,omitempty"`
}
ServiceStats represents the final statistics of the service.
type SystemHealthInPercent ¶
type SystemHealthInPercent struct {
SystemHealth HealthFields `json:"system_health_percentage"`
ServiceHealth HealthFields `json:"service_health_percentage"`
}
SystemHealthInPercent is the struct to store the system health in percentage