observability

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package observability provides metrics, profiling, and etc.

Index

Constants

This section is empty.

Variables

View Source
var MetricsCollector = Collector{
	// contains filtered or unexported fields
}

MetricsCollector is a global metrics collector.

View Source
var (
	// RootScope is the root scope for all metrics.
	RootScope = meter.NewHierarchicalScope("banyandb", "_")
)

Functions

func MetricsServerInterceptor added in v0.4.0

func MetricsServerInterceptor() (grpc.UnaryServerInterceptor, grpc.StreamServerInterceptor)

MetricsServerInterceptor returns a grpc.UnaryServerInterceptor and a grpc.StreamServerInterceptor.

func NewMeterProvider added in v0.4.0

func NewMeterProvider(_ meter.Scope) meter.Provider

NewMeterProvider returns a meter.Provider based on the given scope.

func NewMetricService

func NewMetricService() run.Service

NewMetricService returns a metric service.

func NewProfService

func NewProfService() run.Service

NewProfService returns a pprof service.

func UpdateAddress added in v0.4.0

func UpdateAddress(name, address string)

UpdateAddress updates the address of the given name.

func UpdatePath added in v0.4.0

func UpdatePath(path string)

UpdatePath updates a path to monitoring its disk usage.

Types

type Collector added in v0.4.0

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

Collector is a metrics collector.

func (*Collector) Register added in v0.4.0

func (c *Collector) Register(name string, getter MetricsGetter)

Register registers a metrics getter.

func (*Collector) Unregister added in v0.4.0

func (c *Collector) Unregister(name string)

Unregister unregisters a metrics getter.

type DiskUsage added in v0.4.0

type DiskUsage struct {
	Capacity uint64 `json:"capacity"`
	Used     uint64 `json:"used"`
}

DiskUsage represents the disk usage for a given path.

type ErrorResponse added in v0.4.0

type ErrorResponse struct {
	Message       string `json:"message"`
	OriginalError string `json:"original_error,omitempty"`
}

ErrorResponse represents the error response.

type MetricsGetter added in v0.4.0

type MetricsGetter func()

MetricsGetter is a function that collects metrics.

type SystemInfo added in v0.4.0

type SystemInfo struct {
	Addresses   map[string]string     `json:"addresses"`
	DiskUsages  map[string]*DiskUsage `json:"disk_usages"`
	NodeID      string                `json:"node_id"`
	Hostname    string                `json:"hostname"`
	Roles       []string              `json:"roles"`
	Uptime      uint64                `json:"uptime"`
	CPUUsage    float64               `json:"cpu_usage"`
	MemoryUsage float64               `json:"memory_usage"`
	sync.RWMutex
}

SystemInfo represents the system information of a node.

Jump to

Keyboard shortcuts

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