Documentation
¶
Overview ¶
Package system provides detailed memory metrics collection functionality.
Package system provides system-level metrics collection for monitoring runtime characteristics of Go applications.
Package system provides system metrics collection capabilities for monitoring memory usage, garbage collection, threads, and goroutines in Go applications.
Package system provides system metrics collection capabilities for monitoring memory usage, garbage collection, threads, and goroutines. It offers comprehensive tooling for observing the runtime behavior of Go applications in production environments.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BasicMetricsCollector ¶
func BasicMetricsCollector(logger *zap.SugaredLogger) error
BasicMetricsCollector initializes and configures basic system metrics collection. It sets up memory and system gauges and starts the continuous collection of metrics to monitor runtime performance and resource usage of the application.
Parameters:
- logger: A logger instance for logging metrics-related messages.
Returns:
- An error if metrics collection could not be initialized.
Types ¶
type BasicGauges ¶
type BasicGauges interface {
// Collect registers callbacks for the metrics with the provided meter.
// This sets up the continuous collection of metrics data from the system.
Collect(meter metric.Meter)
}
BasicGauges defines an interface for metrics collectors that gather system-level metrics using OpenTelemetry observable gauges. It abstracts the common functionality needed for different types of system metrics collectors.
func NewMemGauges ¶
func NewMemGauges(meter metric.Meter) (BasicGauges, error)
NewMemGauges creates a new memory metrics collector that monitors various aspects of the Go runtime memory usage and garbage collection. It initializes all the necessary observable gauges for tracking memory allocation, utilization, garbage collection statistics, and other related metrics.
Parameters:
- meter: The OpenTelemetry meter used to create gauge instruments.
Returns:
- A BasicGauges implementation for memory metrics collection.
- An error if any gauge creation fails.
func NewSysGauge ¶
func NewSysGauge(meter metric.Meter) (BasicGauges, error)
NewSysGauge creates a new system metrics collector that monitors OS threads, CGO calls, and active goroutines. These metrics provide insights into the concurrency patterns and resource utilization of the Go application.
Parameters:
- meter: The OpenTelemetry meter used to create gauge instruments.
Returns:
- A BasicGauges implementation for system metrics collection.
- An error if any gauge creation fails.