metrics

package
v0.0.0-...-6076d7e Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEF_METRICS_NAMESPACE = "com"
	DEF_METRICS_SUBSYSTEM = "api"
)

Variables

This section is empty.

Functions

func AddDBDurationVec

func AddDBDurationVec(sql string, duration time.Duration)

func AddHTTPRequestsDuration

func AddHTTPRequestsDuration(duration time.Duration)

func DecHTTPActiveRequestsCount

func DecHTTPActiveRequestsCount()

func DecWPAddTaskWaitCountVec

func DecWPAddTaskWaitCountVec(wpType string)

func DecWPTaskQueueBufferLenVec

func DecWPTaskQueueBufferLenVec(wpType string)

func DecWPWorkerProcessCountVec

func DecWPWorkerProcessCountVec(wpType string)

func IncCalcCountVec

func IncCalcCountVec(label string)

Метрики вычислений

func IncCalcDurationVec

func IncCalcDurationVec(label string, duration time.Duration)

func IncDBCountVec

func IncDBCountVec(sql string)

Метрики DB

func IncHTTPActiveRequestsCount

func IncHTTPActiveRequestsCount()

func IncHTTPClientCallCountVec

func IncHTTPClientCallCountVec(resource string, method string)

Метрики HTTP client call

func IncHTTPClientCallDurationVec

func IncHTTPClientCallDurationVec(resource string, method string, duration time.Duration)

func IncHTTPErrorRequestsCountVec

func IncHTTPErrorRequestsCountVec(resource string, method string)

func IncHTTPRequestsCountVec

func IncHTTPRequestsCountVec(resource string, method string)

Метрики HTTP

func IncHTTPRequestsDurationVec

func IncHTTPRequestsDurationVec(resource string, method string, state string, duration time.Duration)

func IncMarshalingDurationVec

func IncMarshalingDurationVec(label string, duration time.Duration)

Метрики JSON

func IncUnMarshalingDurationVec

func IncUnMarshalingDurationVec(label string, duration time.Duration)

func IncWPAddTaskWaitCountVec

func IncWPAddTaskWaitCountVec(wpType string)

func IncWPTaskProcessDurationVec

func IncWPTaskProcessDurationVec(wpType string, name string, duration time.Duration)

func IncWPTaskQueueBufferLenVec

func IncWPTaskQueueBufferLenVec(wpType string)

Метрики WorkerPoolVec

func IncWPWorkerProcessCountVec

func IncWPWorkerProcessCountVec(wpType string)

func InitGlobalMetrics

func InitGlobalMetrics(cfg *Config)

func PrintGlobalMetricsToLog

func PrintGlobalMetricsToLog()

func SetWPTaskQueueBufferLenVec

func SetWPTaskQueueBufferLenVec(wpType string, len float64)

Types

type Config

type Config struct {
	MetricsNamespace string `yaml:"metrics_namespace"`
	MetricsSubsystem string `yaml:"metrics_subsystem"`

	// Метрики DB
	CollectDBCountVec    bool `yaml:"collect_db_count_vec"`
	CollectDBDurationVec bool `yaml:"collect_db_duration_vec"`

	// Метрики HTTP request
	CollectHTTPRequestsCountVec      bool `yaml:"collect_http_requests_count_vec"`
	CollectHTTPErrorRequestsCountVec bool `yaml:"collect_http_error_requests_count_vec"`
	CollectHTTPRequestsDurationVec   bool `yaml:"collect_http_requests_duration_vec"`
	CollectHTTPActiveRequestsCount   bool `yaml:"collect_http_active_requests_count"`
	CollectHTTPRequestsDuration      bool `yaml:"collect_http_requests_duration"`

	// Метрики HTTP client call
	CollectHTTPClientCallCountVec    bool `yaml:"collect_http_client_call_count_vec"`
	CollectHTTPClientCallDurationVec bool `yaml:"collect_http_client_call_duration_vec"`

	// Метрики вычислений
	CollectCalcCountVec    bool `yaml:"collect_calc_count_vec"`
	CollectCalcDurationVec bool `yaml:"collect_calc_duration_vec"`

	// Метрики JSON
	CollectMarshalingDurationVec   bool `yaml:"collect_marshaling_duration_vec"`
	CollectUnMarshalingDurationVec bool `yaml:"collect_un_marshaling_duration_vec"`

	// Метрики WorkerPool
	CollectWPTaskQueueBufferLenVec  bool `yaml:"collect_wp_task_queue_buffer_len_vec"`
	CollectWPAddTaskWaitCountVec    bool `yaml:"collect_wp_add_task_wait_count_vec"`
	CollectWPWorkerProcessCountVec  bool `yaml:"collect_wp_worker_process_count_vec"`
	CollectWPTaskProcessDurationVec bool `yaml:"collect_wp_task_process_duration_ms_by_name"`
}

Config конфигурационные настройки

type Metrics

type Metrics struct {
	Cfg      *Config
	Registry *prometheus.Registry

	// Метрики DB
	DBCountVec    *prometheus.CounterVec
	DBDurationVec *prometheus.HistogramVec

	// Метрики HTTP request
	HTTPRequestsCountVec      *prometheus.CounterVec
	HTTPErrorRequestsCountVec *prometheus.CounterVec
	HTTPRequestsDurationVec   *prometheus.HistogramVec
	HTTPActiveRequestsCount   prometheus.Gauge
	HTTPRequestsDuration      prometheus.Histogram

	// Метрики HTTP client call
	HTTPClientCallCountVec    *prometheus.CounterVec
	HTTPClientCallDurationVec *prometheus.HistogramVec

	// Метрики вычислений
	CalcCountVec    *prometheus.CounterVec
	CalcDurationVec *prometheus.HistogramVec

	// Метрики JSON
	MarshalingDurationVec   *prometheus.HistogramVec
	UnMarshalingDurationVec *prometheus.HistogramVec

	// Метрики WorkerPoolVec
	WPTaskQueueBufferLenVec  *prometheus.GaugeVec
	WPAddTaskWaitCountVec    *prometheus.GaugeVec
	WPWorkerProcessCountVec  *prometheus.GaugeVec
	WPTaskProcessDurationVec *prometheus.HistogramVec
}

func GlobalMetrics

func GlobalMetrics() *Metrics

func New

func New(cfg *Config) (*Metrics, error)

func (*Metrics) PrintMetricsToLog

func (mt *Metrics) PrintMetricsToLog()

Jump to

Keyboard shortcuts

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