metrics

package
v2.1.56 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Size1MB   = 1024 * 1024
	Size4MB   = 4 * Size1MB
	Size8MB   = 8 * Size1MB
	Size16MB  = 16 * Size1MB
	Size32MB  = 32 * Size1MB
	Size64MB  = 64 * Size1MB
	Size128MB = 128 * Size1MB
	Size256MB = 256 * Size1MB
	Size512MB = 512 * Size1MB

	Size1GB   = 1024 * Size1MB
	Size4GB   = 4 * Size1GB
	Size8GB   = 8 * Size1GB
	Size16GB  = 16 * Size1GB
	Size32GB  = 32 * Size1GB
	Size64GB  = 64 * Size1GB
	Size128GB = 128 * Size1GB
	Size256GB = 256 * Size1GB
	Size512GB = 512 * Size1GB

	Size1TB = 1024 * Size1GB
)

Variables

View Source
var (
	// HostTrafficUploadType is upload traffic type for host traffic metrics.
	HostTrafficUploadType = "upload"

	// HostTrafficDownloadType is download traffic type for host traffic metrics.
	HostTrafficDownloadType = "download"
)
View Source
var (
	AnnouncePeerCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "announce_peer_total",
		Help:      "Counter of the number of the announcing peer.",
	})

	AnnouncePeerFailureCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "announce_peer_failure_total",
		Help:      "Counter of the number of failed of the announcing peer.",
	})

	StatPeerCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "stat_peer_total",
		Help:      "Counter of the number of the stat peer.",
	})

	StatPeerFailureCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "stat_peer_failure_total",
		Help:      "Counter of the number of failed of the stat peer.",
	})

	LeavePeerCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "leave_peer_total",
		Help:      "Counter of the number of the leaving peer.",
	})

	LeavePeerFailureCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "leave_peer_failure_total",
		Help:      "Counter of the number of failed of the leaving peer.",
	})

	ExchangePeerCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "exchange_peer_total",
		Help:      "Counter of the number of the exchanging peer.",
	})

	ExchangePeerFailureCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "exchange_peer_failure_total",
		Help:      "Counter of the number of failed of the exchanging peer.",
	})

	RegisterPeerCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "register_peer_total",
		Help:      "Counter of the number of the register peer.",
	}, []string{"priority", "task_type", "host_type"})

	RegisterPeerFailureCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "register_peer_failure_total",
		Help:      "Counter of the number of failed of the register peer.",
	}, []string{"priority", "task_type", "host_type"})

	DownloadPeerStartedCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "download_peer_started_total",
		Help:      "Counter of the number of the download peer started.",
	}, []string{"priority", "task_type", "host_type"})

	DownloadPeerStartedFailureCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "download_peer_started_failure_total",
		Help:      "Counter of the number of failed of the download peer started.",
	}, []string{"priority", "task_type", "host_type"})

	DownloadPeerBackToSourceStartedCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "download_peer_back_to_source_started_total",
		Help:      "Counter of the number of the download peer back-to-source started.",
	}, []string{"priority", "task_type", "host_type"})

	DownloadPeerBackToSourceStartedFailureCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "download_peer_back_to_source_started_failure_total",
		Help:      "Counter of the number of failed of the download peer back-to-source started.",
	}, []string{"priority", "task_type", "host_type"})

	DownloadPeerCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "download_peer_finished_total",
		Help:      "Counter of the number of the download peer.",
	}, []string{"priority", "task_type", "host_type"})

	DownloadPeerFailureCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "download_peer_finished_failure_total",
		Help:      "Counter of the number of failed of the download peer.",
	}, []string{"priority", "task_type", "host_type"})

	DownloadPeerBackToSourceFailureCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "download_peer_back_to_source_finished_failure_total",
		Help:      "Counter of the number of failed of the download peer back-to-source.",
	}, []string{"priority", "task_type", "host_type"})

	DownloadPieceCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "download_piece_finished_total",
		Help:      "Counter of the number of the download piece.",
	}, []string{"traffic_type", "task_type", "host_type"})

	DownloadPieceFailureCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "download_piece_finished_failure_total",
		Help:      "Counter of the number of failed of the download piece.",
	}, []string{"traffic_type", "task_type", "host_type"})

	DownloadPieceBackToSourceFailureCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "download_piece_back_to_source_finished_failure_total",
		Help:      "Counter of the number of failed of the download piece back-to-source.",
	}, []string{"traffic_type", "task_type", "host_type"})

	StatTaskCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "stat_task_total",
		Help:      "Counter of the number of the stat task.",
	})

	StatTaskFailureCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "stat_task_failure_total",
		Help:      "Counter of the number of failed of the stat task.",
	})

	LeaveTaskCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "leave_task_total",
		Help:      "Counter of the number of the leaving task.",
	})

	LeaveTaskFailureCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "leave_task_failure_total",
		Help:      "Counter of the number of failed of the leaving task.",
	})

	AnnounceHostCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "announce_host_total",
		Help:      "Counter of the number of the announce host.",
	}, []string{"os", "platform", "platform_family", "platform_version",
		"kernel_version", "git_version", "git_commit", "go_version", "build_platform"})

	AnnounceHostFailureCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "announce_host_failure_total",
		Help:      "Counter of the number of failed of the announce host.",
	}, []string{"os", "platform", "platform_family", "platform_version",
		"kernel_version", "git_version", "git_commit", "go_version", "build_platform"})

	LeaveHostCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "leave_host_total",
		Help:      "Counter of the number of the leaving host.",
	})

	LeaveHostFailureCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "leave_host_failure_total",
		Help:      "Counter of the number of failed of the leaving host.",
	})

	SyncProbesCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "sync_probes_total",
		Help:      "Counter of the number of the synchronizing probes.",
	})

	SyncProbesFailureCount = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "sync_probes_failure_total",
		Help:      "Counter of the number of failed of the synchronizing probes.",
	})

	Traffic = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "traffic",
		Help:      "Counter of the number of traffic.",
	}, []string{"type", "task_type", "host_type"})

	HostTraffic = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "host_traffic",
		Help:      "Counter of the number of per host traffic.",
	}, []string{"type", "task_type", "host_type", "host_id", "host_ip", "host_name"})

	DownloadPeerDuration = promauto.NewSummaryVec(prometheus.SummaryOpts{
		Namespace:  types.MetricsNamespace,
		Subsystem:  types.SchedulerMetricsName,
		Name:       "download_peer_duration_milliseconds",
		Help:       "Summary of the time each peer downloading.",
		Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.95: 0.005, 0.99: 0.001},
	}, []string{"task_size_level"})

	ConcurrentScheduleGauge = promauto.NewGauge(prometheus.GaugeOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "concurrent_schedule_total",
		Help:      "Gauge of the number of concurrent of the scheduling.",
	})

	ScheduleDuration = promauto.NewSummary(prometheus.SummaryOpts{
		Namespace:  types.MetricsNamespace,
		Subsystem:  types.SchedulerMetricsName,
		Name:       "schedule_duration_milliseconds",
		Help:       "Summary of the time each scheduling.",
		Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.95: 0.005, 0.99: 0.001},
	})

	VersionGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: types.MetricsNamespace,
		Subsystem: types.SchedulerMetricsName,
		Name:      "version",
		Help:      "Version info of the service.",
	}, []string{"major", "minor", "git_version", "git_commit", "platform", "build_time", "go_version", "go_tags", "go_gcflags"})
)

Variables declared for metrics.

Functions

func New

func New(cfg *config.MetricsConfig, svr *grpc.Server) *http.Server

Types

type TaskSizeLevel added in v2.1.16

type TaskSizeLevel int

TaskSizeLevel is the level of the task size.

const (
	// TaskSizeLevel0 represents unknown size.
	TaskSizeLevel0 TaskSizeLevel = iota

	// TaskSizeLevel1 represents size range is from 0 to 1M.
	TaskSizeLevel1

	// TaskSizeLevel2 represents size range is from 1M to 4M.
	TaskSizeLevel2

	// TaskSizeLevel3 represents size range is from 4M to 8M.
	TaskSizeLevel3

	// TaskSizeLevel4 represents size range is from 8M to 16M.
	TaskSizeLevel4

	// TaskSizeLevel5 represents size range is from 16M to 32M.
	TaskSizeLevel5

	// TaskSizeLevel6 represents size range is from 32M to 64M.
	TaskSizeLevel6

	// TaskSizeLevel7 represents size range is from 64M to 128M.
	TaskSizeLevel7

	// TaskSizeLevel8 represents size range is from 128M to 256M.
	TaskSizeLevel8

	// TaskSizeLevel9 represents size range is from 256M to 512M.
	TaskSizeLevel9

	// TaskSizeLevel10 represents size range is from 512M to 1G.
	TaskSizeLevel10

	// TaskSizeLevel11 represents size range is from 1G to 4G.
	TaskSizeLevel11

	// TaskSizeLevel12 represents size range is from 4G to 8G.
	TaskSizeLevel12

	// TaskSizeLevel13 represents size range is from 8G to 16G.
	TaskSizeLevel13

	// TaskSizeLevel14 represents size range is from 16G to 32G.
	TaskSizeLevel14

	// TaskSizeLevel15 represents size range is from 32G to 64G.
	TaskSizeLevel15

	// TaskSizeLevel16 represents size range is from 64G to 128G.
	TaskSizeLevel16

	// TaskSizeLevel17 represents size range is from 128G to 256G.
	TaskSizeLevel17

	// TaskSizeLevel18 represents size range is from 256G to 512G.
	TaskSizeLevel18

	// TaskSizeLevel19 represents size range is from 512G to 1T.
	TaskSizeLevel19

	// TaskSizeLevel20 represents size is greater than 1T.
	TaskSizeLevel20
)

func CalculateSizeLevel added in v2.1.16

func CalculateSizeLevel(size int64) TaskSizeLevel

CalculateSizeLevel calculates the size level according to the size.

func (TaskSizeLevel) String added in v2.1.16

func (t TaskSizeLevel) String() string

String returns the string representation of the TaskSizeLevel.

Jump to

Keyboard shortcuts

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