metrics

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	LabelDeletedReason = "deleted_reason"
	LabelVolume        = "volume"
	LabelEventbus      = "eventbus"
	LabelEventlog      = "eventlog"
	LabelSegmentState  = "segment_state"
	LabelIsLeader      = "is_leader"
	LabelProtocol      = "protocol"
	LabelBatchSize     = "batch_size"
	LabelResponseCode  = "response_code"

	LabelTriggerWorker = "trigger_worker"
	LabelTrigger       = "trigger"
	LabelResult        = "result"
	LabelBlock         = "block"

	LabelTimer = "timer"
)
View Source
const (
	LabelOperationResult                   = "op_result"
	LabelSuccess                           = "success"
	LabelFailed                            = "failed"
	LabelSegmentDeletedBecauseExpired      = "segment_expired"
	LabelSegmentDeletedBecauseCreateFailed = "segment_create_failed"
	LabelSegmentDeletedBecauseDeleted      = "segment_deleted"
	LabelValueProtocolHTTP                 = "http"
	LabelValueProtocolGRPC                 = "grpc"
)
View Source
const (
	LabelScheduledEventDelayTime        = "scheduled_event_delay_time"
	LabelTimerPushScheduledEventTime    = "push_scheduled_event_time"
	LabelTimerDeliverScheduledEventTime = "deliver_scheduled_event_time"
)

Variables

View Source
var (
	ControllerLeaderGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "leader_flag",
		Help:      "if is this controller leader",
	}, []string{LabelIsLeader})

	EventbusGauge = prometheus.NewGauge(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "eventbus_number_total",
	})

	EventbusUpdatedGauge = prometheus.NewGauge(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "eventbus_number_updated_total",
	})

	EventbusDeletedGauge = prometheus.NewGauge(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "eventbus_number_deleted_total",
	})

	// EventlogGaugeVec TODO wenfeng clean values?
	EventlogGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "eventlog_number_total_per_eventbus",
	}, []string{LabelEventbus})

	SegmentGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "segment_number_total_per_eventlog",
	}, []string{LabelEventbus, LabelEventlog, LabelSegmentState})

	SegmentSizeGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "segment_size_total_per_eventlog",
	}, []string{LabelEventbus, LabelEventlog, LabelSegmentState})

	SegmentCapacityGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "segment_capacity_total_per_eventlog",
	}, []string{LabelEventbus, LabelEventlog, LabelSegmentState})

	SegmentEventNumberGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "segment_event_number_total_per_eventlog",
	}, []string{LabelEventbus, LabelEventlog, LabelSegmentState})

	SegmentCreatedByCacheMissing = prometheus.NewGauge(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "segment_created_by_cache_missing_total",
	})

	SegmentCreatedByScaleTask = prometheus.NewGauge(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "segment_created_by_scale_task_total",
	})

	SegmentDeletedCounterVec = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "segment_deleted_number_runtime",
	}, []string{LabelDeletedReason})

	SubscriptionGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "subscription_number",
		Help:      "The number of subscription",
	}, []string{LabelEventbus})

	SubscriptionTransformerGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "subscription_transformer_number",
		Help:      "The number of subscription transformer",
	}, []string{LabelEventbus})

	CtrlTriggerGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfController,
		Name:      "trigger_number",
		Help:      "The number of trigger",
	}, []string{LabelTriggerWorker})
)
View Source
var (
	GatewayEventReceivedCountVec = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfGateway,
		Name:      "event_received_total",
	}, []string{LabelEventbus, LabelProtocol, LabelBatchSize, LabelResponseCode})

	GatewayEventWriteLatencyHistogramVec = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespace,
		Subsystem: moduleOfGateway,
		Name:      "send_event_request_latency_histogram",
		Buckets: []float64{0.4, 0.7, 1, 2, 3, 5, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90,
			100, 200, 300, 400, 500, 1000},
		NativeHistogramBucketFactor:     0,
		NativeHistogramZeroThreshold:    0,
		NativeHistogramMaxBucketNumber:  0,
		NativeHistogramMinResetDuration: 0,
		NativeHistogramMaxZeroThreshold: 0,
	}, []string{LabelEventbus, LabelProtocol, LabelBatchSize})

	GatewayEventWriteLatencySummaryVec = prometheus.NewSummaryVec(prometheus.SummaryOpts{
		Namespace: namespace,
		Subsystem: moduleOfGateway,
		Name:      "send_event_request_latency_summary",
		Objectives: map[float64]float64{
			0.25:   0.1,
			0.50:   0.1,
			0.75:   0.1,
			0.80:   0.05,
			0.85:   0.05,
			0.9:    0.05,
			0.95:   0.01,
			0.96:   0.01,
			0.97:   0.01,
			0.98:   0.01,
			0.99:   0.001,
			0.999:  0.0001,
			0.9999: 0.00001},
	}, []string{LabelEventbus, LabelProtocol, LabelBatchSize})
)
View Source
var (
	WriteTPSCounterVec = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfSegmentServer,
		Name:      "write_event_count",
		Help:      "Total events for writing",
	}, []string{LabelVolume, LabelBlock, LabelOperationResult})

	ReadTPSCounterVec = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfSegmentServer,
		Name:      "read_event_count",
		Help:      "Total events for reading",
	}, []string{LabelVolume, LabelBlock})

	WriteThroughputCounterVec = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfSegmentServer,
		Name:      "write_byte_count",
		Help:      "Total bytes for writing",
	}, []string{LabelVolume, LabelBlock, LabelOperationResult})

	ReadThroughputCounterVec = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfSegmentServer,
		Name:      "read_byte_count",
		Help:      "Total bytes for reading",
	}, []string{LabelVolume, LabelBlock})

	WALEntryWriteCounter = prometheus.NewCounter(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfSegmentServer,
		Name:      "wal_entry_write_count",
		Help:      "Total entries for wal writing",
	})

	WALEntryWriteSizeCounter = prometheus.NewCounter(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfSegmentServer,
		Name:      "wal_entry_write_size",
		Help:      "Total event size (in bytes) for wal writing",
	})

	WALRecordWriteCounter = prometheus.NewCounter(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfSegmentServer,
		Name:      "wal_record_write_count",
		Help:      "Total records for wal writing",
	})

	WALRecordWriteSizeCounter = prometheus.NewCounter(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfSegmentServer,
		Name:      "wal_record_write_size",
		Help:      "Total record size (in bytes) for wal writing",
	})
)
View Source
var (
	TimingWheelTickGauge = prometheus.NewGauge(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfTimer,
		Name:      "timingwheel_tick",
		Help:      "The tick of timingwheel.",
	})

	TimingWheelSizeGauge = prometheus.NewGauge(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfTimer,
		Name:      "timingwheel_size",
		Help:      "The size of timingwheel.",
	})

	TimingWheelLayersGauge = prometheus.NewGauge(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfTimer,
		Name:      "timingwheel_layers",
		Help:      "The layers of timingwheel.",
	})

	TimerPushEventTPSCounterVec = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfTimer,
		Name:      "push_scheduled_event_count",
		Help:      "Total scheduled events for push",
	}, []string{LabelTimer})

	TimerDeliverEventTPSCounterVec = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfTimer,
		Name:      "deliver_scheduled_event_count",
		Help:      "Total scheduled events for deliver",
	}, []string{LabelTimer})

	TimerScheduledEventDelayTime = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "scheduled_event_delay_time",
		Help:      "The time of scheduled event delay deliver",
	}, []string{LabelScheduledEventDelayTime})

	TimerPushEventTime = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "push_scheduled_event_time",
		Help:      "The time of timer push scheduled event",
	}, []string{LabelTimerPushScheduledEventTime})

	TimerDeliverEventTime = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "deliver_scheduled_event_time",
		Help:      "The time of timer deliver scheduled event",
	}, []string{LabelTimerDeliverScheduledEventTime})
)
View Source
var (
	TriggerGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "trigger_number",
		Help:      "The number of trigger",
	}, []string{LabelTriggerWorker})

	TriggerPullEventCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "pull_event_number",
		Help:      "The event number of trigger pull",
	}, []string{LabelTrigger, LabelEventbus, LabelEventlog})

	TriggerFilterCostSecond = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "filter_cost_second",
		Help:      "The cost second of trigger",
	}, []string{LabelTrigger})

	TriggerTransformCostSecond = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "transformer_cost_second",
		Help:      "The cost second of transformer",
	}, []string{LabelTrigger})

	TriggerFilterMatchEventCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "filter_match_event_number",
		Help:      "The event number of trigger filter match",
	}, []string{LabelTrigger})

	TriggerFilterMatchRetryEventCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "filter_match_retry_event_number",
		Help:      "The event number of retry match",
	}, []string{LabelTrigger})

	TriggerRetryEventCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "retry_event_number",
		Help:      "The event number of retry",
	}, []string{LabelTrigger})

	TriggerRetryEventAppendSecond = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "retry_event_append_second",
		Help:      "The cost second of retry event append",
	}, []string{LabelTrigger})

	TriggerDeadLetterEventCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "dead_letter_event_number",
		Help:      "The event number of dead letter",
	}, []string{LabelTrigger})

	TriggerDeadLetterEventAppendSecond = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "dead_letter_event_append_second",
		Help:      "The cost second of dead letter event append",
	}, []string{LabelTrigger})

	TriggerPushEventCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "push_event_number",
		Help:      "The event number of trigger push",
	}, []string{LabelTrigger, LabelResult})

	TriggerPushEventTime = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: namespace,
		Subsystem: moduleOfTriggerWorker,
		Name:      "push_event_rt",
		Help:      "The rt of trigger push event",
	}, []string{LabelTrigger})
)

Functions

func GetControllerMetrics

func GetControllerMetrics() []prometheus.Collector

func GetGatewayMetrics

func GetGatewayMetrics() []prometheus.Collector

func GetSegmentServerMetrics

func GetSegmentServerMetrics() []prometheus.Collector

func GetTimerMetrics

func GetTimerMetrics() []prometheus.Collector

func GetTriggerMetrics

func GetTriggerMetrics() []prometheus.Collector

func Init

func Init(ctx context.Context, cfg Config, getCollectors func() []prometheus.Collector)

Types

type Config

type Config struct {
	Enable bool `yaml:"enable"`
	Port   int  `yaml:"port"`
}

func (Config) GetPort

func (c Config) GetPort() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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