metrics

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LblType       = "type"
	LblStatusType = "status"
	LblRuleIDType = "rule"
	LblOpIDType   = "op"
	LblIOType     = "io"

	LBlRuleRunning = "running"
	LblRuleStop    = "stop"
	LblSourceIO    = "source"
	LblSinkIO      = "sink"
	LblException   = "err"
	LblSuccess     = "success"
)
View Source
const OpenMetricsEOF = "# EOF\n"

Variables

View Source
var (
	IOCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: "kuiper",
		Subsystem: "io",
		Name:      "counter",
		Help:      "counter of IO",
	}, []string{LblType, LblIOType, LblStatusType, LblRuleIDType, LblOpIDType})

	IODurationHist = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: "kuiper",
		Subsystem: "io",
		Name:      "duration_hist",
		Help:      "Historgram Duration of IO",
		Buckets:   prometheus.ExponentialBuckets(10, 2, 20),
	}, []string{LblType, LblIOType, LblRuleIDType, LblOpIDType})
)
View Source
var (
	RuleStatusCountGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: "kuiper",
		Subsystem: "rule",
		Name:      "count",
		Help:      "gauge of rule status count",
	}, []string{LblStatusType})

	RuleStatusGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: "kuiper",
		Subsystem: "rule",
		Name:      "status",
		Help:      "gauge of rule status",
	}, []string{LblRuleIDType})

	RuleCPUUsageGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: "kuiper",
		Subsystem: "rule",
		Name:      "cpu_ms",
		Help:      "gauge of rule CPU usage",
	}, []string{LblRuleIDType})
)
View Source
var (
	SyncCacheHist = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: "kuiper",
		Subsystem: "sync_cache",
		Name:      "duration",
		Buckets:   prometheus.ExponentialBuckets(10, 2, 20),
		Help:      "hist of sync cache",
	}, []string{LblType, LblRuleIDType, LblOpIDType})

	SyncCacheCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: "kuiper",
		Subsystem: "sync_cache",
		Name:      "counter",
		Help:      "counter of sync cache",
	}, []string{LblType, LblRuleIDType, LblOpIDType})

	SyncCacheGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: "kuiper",
		Subsystem: "sync_cache",
		Name:      "gauge",
		Help:      "gauge of sync cache",
	}, []string{LblType, LblRuleIDType, LblOpIDType})
)

Functions

func GetMetricsZipFile added in v2.1.0

func GetMetricsZipFile(startTime time.Time, endTime time.Time) (string, error)

func GetStatusValue

func GetStatusValue(err error) string

func InitMetricsDumpJob added in v2.1.0

func InitMetricsDumpJob(ctx context.Context)

func IsMetricsDumpEnabled added in v2.1.0

func IsMetricsDumpEnabled() bool

func RegisterSyncCache

func RegisterSyncCache()

func RemoveRuleStatus

func RemoveRuleStatus(ruleID string)

func SetRuleCPUUsageGauge

func SetRuleCPUUsageGauge(ruleID string, value int)

func SetRuleStatus

func SetRuleStatus(ruleID string, value int)

func SetRuleStatusCountGauge

func SetRuleStatusCountGauge(isRunning bool, count int)

func StartMetricsManager added in v2.1.0

func StartMetricsManager() error

func StopMetricsManager added in v2.1.0

func StopMetricsManager()

Types

type MetricsDumpManager added in v2.1.0

type MetricsDumpManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*MetricsDumpManager) Init added in v2.1.0

func (m *MetricsDumpManager) Init(ctx context.Context) error

func (*MetricsDumpManager) IsEnabled added in v2.1.0

func (m *MetricsDumpManager) IsEnabled() bool

func (*MetricsDumpManager) Start added in v2.1.0

func (m *MetricsDumpManager) Start() error

func (*MetricsDumpManager) Stop added in v2.1.0

func (m *MetricsDumpManager) Stop()

Jump to

Keyboard shortcuts

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