metric

package
v0.0.0-...-cc6ace1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NamespaceEnvKey is the metric namespace key in environment
	NamespaceEnvKey = "METRIC_NAMESPACE"
	// SubsystemEnvKey is the metric subsystem key in environment
	SubsystemEnvKey = "METRIC_SUBSYSTEM"
)

Variables

View Source
var (
	// TotalInFlightGauge used to collect total in flight number
	TotalInFlightGauge = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Namespace: os.Getenv(NamespaceEnvKey),
			Subsystem: os.Getenv(SubsystemEnvKey),
			Name:      "http_inflight_requests",
			Help:      "The total number of requests",
		},
	)

	// TotalReqCnt used to collect total request counter
	TotalReqCnt = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: os.Getenv(NamespaceEnvKey),
			Subsystem: os.Getenv(SubsystemEnvKey),
			Name:      "http_request_total",
			Help:      "The total number of requests",
		},
		[]string{"method", "code", "operation"},
	)

	// TotalReqDurSummary used to collect total request duration summaries
	TotalReqDurSummary = prometheus.NewSummaryVec(
		prometheus.SummaryOpts{
			Namespace:  os.Getenv(NamespaceEnvKey),
			Subsystem:  os.Getenv(SubsystemEnvKey),
			Name:       "http_request_duration_seconds",
			Help:       "The time duration of the requests",
			Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
		},
		[]string{"method", "operation"})
)
View Source
var (
	// JobserviceInfo used for collect jobservice information
	JobserviceInfo = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: os.Getenv(NamespaceEnvKey),
			Subsystem: os.Getenv(SubsystemEnvKey),
			Name:      "info",
			Help:      "the information of jobservice",
		},
		[]string{"node", "pool", "workers"},
	)
	// JobserviceTotalTask used for collect data
	JobserviceTotalTask = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: os.Getenv(NamespaceEnvKey),
			Subsystem: os.Getenv(SubsystemEnvKey),
			Name:      "task_total",
			Help:      "The number of processed tasks",
		},
		[]string{"type", "status"},
	)
	// JobservieTaskProcessTimeSummary used for instrument task running time
	JobservieTaskProcessTimeSummary = prometheus.NewSummaryVec(
		prometheus.SummaryOpts{
			Namespace:  os.Getenv(NamespaceEnvKey),
			Subsystem:  os.Getenv(SubsystemEnvKey),
			Name:       "task_process_time_seconds",
			Help:       "The time duration of the task processing time",
			Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
		},
		[]string{"type", "status"})
)

Functions

func RegisterCollectors

func RegisterCollectors()

RegisterCollectors register all the common static collector

func RegisterJobServiceCollectors

func RegisterJobServiceCollectors()

RegisterJobServiceCollectors ...

func ServeProm

func ServeProm(path string, port int)

ServeProm return a server to serve prometheus metrics

Types

This section is empty.

Jump to

Keyboard shortcuts

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