stats

package
v0.0.0-...-ee25ada Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Namespace        = "SeaweedFS"
	IsReadOnly       = "IsReadOnly"
	NoWriteOrDelete  = "noWriteOrDelete"
	NoWriteCanDelete = "noWriteCanDelete"
	IsDiskSpaceLow   = "isDiskSpaceLow"
)

Readonly volume types

View Source
const (
	// volume server
	WriteToLocalDisk            = "writeToLocalDisk"
	WriteToReplicas             = "writeToReplicas"
	ErrorSizeMismatchOffsetSize = "errorSizeMismatchOffsetSize"
	ErrorSizeMismatch           = "errorSizeMismatch"
	ErrorCRC                    = "errorCRC"
	ErrorIndexOutOfRange        = "errorIndexOutOfRange"
	ErrorGetNotFound            = "errorGetNotFound"
	ErrorGetInternal            = "errorGetInternal"

	// master topology
	ErrorWriteToLocalDisk = "errorWriteToLocalDisk"
	ErrorUnmarshalPairs   = "errorUnmarshalPairs"
	ErrorWriteToReplicas  = "errorWriteToReplicas"

	// master client
	FailedToKeepConnected = "failedToKeepConnected"
	FailedToSend          = "failedToSend"
	FailedToReceive       = "failedToReceive"
	RedirectedToLeader    = "redirectedToLeader"
	OnPeerUpdate          = "onPeerUpdate"
	Failed                = "failed"

	// filer handler
	DirList                  = "dirList"
	ContentSaveToFiler       = "contentSaveToFiler"
	AutoChunk                = "autoChunk"
	ChunkProxy               = "chunkProxy"
	ChunkAssign              = "chunkAssign"
	ChunkUpload              = "chunkUpload"
	ChunkDoUploadRetry       = "chunkDoUploadRetry"
	ChunkUploadRetry         = "chunkUploadRetry"
	ChunkAssignRetry         = "chunkAssignRetry"
	ErrorReadNotFound        = "read.notfound"
	ErrorReadInternal        = "read.internal.error"
	ErrorWriteEntry          = "write.entry.failed"
	RepeatErrorUploadContent = "upload.content.repeat.failed"
	ErrorChunkAssign         = "chunkAssign.failed"
	ErrorReadChunk           = "read.chunk.failed"
	ErrorReadCache           = "read.cache.failed"
	ErrorReadStream          = "read.stream.failed"

	// s3 handler
	ErrorCompletedNoSuchUpload      = "errorCompletedNoSuchUpload"
	ErrorCompleteEntityTooSmall     = "errorCompleteEntityTooSmall"
	ErrorCompletedPartEmpty         = "errorCompletedPartEmpty"
	ErrorCompletedPartNumber        = "errorCompletedPartNumber"
	ErrorCompletedPartNotFound      = "errorCompletedPartNotFound"
	ErrorCompletedEtagInvalid       = "errorCompletedEtagInvalid"
	ErrorCompletedEtagMismatch      = "errorCompletedEtagMismatch"
	ErrorCompletedPartEntryMismatch = "errorCompletedPartEntryMismatch"
)

This file contains metric names for all errors The naming convention is ErrorSomeThing = "error.some.thing"

Variables

View Source
var (
	Gather = prometheus.NewRegistry()

	MasterClientConnectCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: Namespace,
			Subsystem: "wdclient",
			Name:      "connect_updates",
			Help:      "Counter of master client leader updates.",
		}, []string{"type"})

	MasterRaftIsleader = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Namespace: Namespace,
			Subsystem: "master",
			Name:      "is_leader",
			Help:      "is leader",
		})

	MasterAdminLock = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: Namespace,
			Subsystem: "master",
			Name:      "admin_lock",
			Help:      "admin lock",
		}, []string{"client"})

	MasterReceivedHeartbeatCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: Namespace,
			Subsystem: "master",
			Name:      "received_heartbeats",
			Help:      "Counter of master received heartbeat.",
		}, []string{"type"})

	MasterReplicaPlacementMismatch = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: Namespace,
			Subsystem: "master",
			Name:      "replica_placement_mismatch",
			Help:      "replica placement mismatch",
		}, []string{"collection", "id"})

	MasterVolumeLayout = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: Namespace,
			Subsystem: "master",
			Name:      "volume_layout_total",
			Help:      "Number of volumes in volume layouts",
		}, []string{"collection", "replica", "type"})

	MasterLeaderChangeCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: Namespace,
			Subsystem: "master",
			Name:      "leader_changes",
			Help:      "Counter of master leader changes.",
		}, []string{"type"})

	FilerRequestCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: Namespace,
			Subsystem: "filer",
			Name:      "request_total",
			Help:      "Counter of filer requests.",
		}, []string{"type", "code"})

	FilerHandlerCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: Namespace,
			Subsystem: "filer",
			Name:      "handler_total",
			Help:      "Counter of filer handlers.",
		}, []string{"type"})

	FilerRequestHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: Namespace,
			Subsystem: "filer",
			Name:      "request_seconds",
			Help:      "Bucketed histogram of filer request processing time.",
			Buckets:   prometheus.ExponentialBuckets(0.0001, 2, 24),
		}, []string{"type"})

	FilerServerLastSendTsOfSubscribeGauge = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: Namespace,
			Subsystem: "filer",
			Name:      "last_send_timestamp_of_subscribe",
			Help:      "The last send timestamp of the filer subscription.",
		}, []string{"sourceFiler", "clientName", "path"})

	FilerStoreCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: Namespace,
			Subsystem: "filerStore",
			Name:      "request_total",
			Help:      "Counter of filer store requests.",
		}, []string{"store", "type"})

	FilerStoreHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: Namespace,
			Subsystem: "filerStore",
			Name:      "request_seconds",
			Help:      "Bucketed histogram of filer store request processing time.",
			Buckets:   prometheus.ExponentialBuckets(0.0001, 2, 24),
		}, []string{"store", "type"})

	FilerSyncOffsetGauge = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: Namespace,
			Subsystem: "filerSync",
			Name:      "sync_offset",
			Help:      "The offset of the filer synchronization service.",
		}, []string{"sourceFiler", "targetFiler", "clientName", "path"})

	VolumeServerRequestCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: Namespace,
			Subsystem: "volumeServer",
			Name:      "request_total",
			Help:      "Counter of volume server requests.",
		}, []string{"type", "code"})

	VolumeServerHandlerCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: Namespace,
			Subsystem: "volumeServer",
			Name:      "handler_total",
			Help:      "Counter of volume server handlers.",
		}, []string{"type"})

	VolumeServerVacuumingCompactCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: Namespace,
			Subsystem: "volumeServer",
			Name:      "vacuuming_compact_count",
			Help:      "Counter of volume vacuuming Compact counter",
		}, []string{"success"})

	VolumeServerVacuumingCommitCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: Namespace,
			Subsystem: "volumeServer",
			Name:      "vacuuming_commit_count",
			Help:      "Counter of volume vacuuming commit counter",
		}, []string{"success"})

	VolumeServerVacuumingHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: Namespace,
			Subsystem: "volumeServer",
			Name:      "vacuuming_seconds",
			Help:      "Bucketed histogram of volume server vacuuming processing time.",
			Buckets:   prometheus.ExponentialBuckets(0.0001, 2, 24),
		}, []string{"type"})

	VolumeServerRequestHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: Namespace,
			Subsystem: "volumeServer",
			Name:      "request_seconds",
			Help:      "Bucketed histogram of volume server request processing time.",
			Buckets:   prometheus.ExponentialBuckets(0.0001, 2, 24),
		}, []string{"type"})

	VolumeServerVolumeGauge = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: Namespace,
			Subsystem: "volumeServer",
			Name:      "volumes",
			Help:      "Number of volumes or shards.",
		}, []string{"collection", "type"})

	VolumeServerReadOnlyVolumeGauge = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: Namespace,
			Subsystem: "volumeServer",
			Name:      "read_only_volumes",
			Help:      "Number of read only volumes.",
		}, []string{"collection", "type"})

	VolumeServerMaxVolumeCounter = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Namespace: Namespace,
			Subsystem: "volumeServer",
			Name:      "max_volumes",
			Help:      "Maximum number of volumes.",
		})

	VolumeServerDiskSizeGauge = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: Namespace,
			Subsystem: "volumeServer",
			Name:      "total_disk_size",
			Help:      "Actual disk size used by volumes.",
		}, []string{"collection", "type"})

	VolumeServerResourceGauge = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: Namespace,
			Subsystem: "volumeServer",
			Name:      "resource",
			Help:      "Resource usage",
		}, []string{"name", "type"})

	S3RequestCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: Namespace,
			Subsystem: "s3",
			Name:      "request_total",
			Help:      "Counter of s3 requests.",
		}, []string{"type", "code", "bucket"})
	S3HandlerCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: Namespace,
			Subsystem: "s3",
			Name:      "handler_total",
			Help:      "Counter of s3 server handlers.",
		}, []string{"type"})
	S3RequestHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: Namespace,
			Subsystem: "s3",
			Name:      "request_seconds",
			Help:      "Bucketed histogram of s3 request processing time.",
			Buckets:   prometheus.ExponentialBuckets(0.0001, 2, 24),
		}, []string{"type", "bucket"})
	S3TimeToFirstByteHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: Namespace,
			Subsystem: "s3",
			Name:      "time_to_first_byte_millisecond",
			Help:      "Bucketed histogram of s3 time to first byte request processing time.",
			Buckets:   prometheus.ExponentialBuckets(0.001, 2, 27),
		}, []string{"type", "bucket"})
)

Functions

func AssignRequest

func AssignRequest()

func BytesIn

func BytesIn(val int64)

func BytesOut

func BytesOut(val int64)

func ConnectionClose

func ConnectionClose()

func ConnectionOpen

func ConnectionOpen()

func DeleteCollectionMetrics

func DeleteCollectionMetrics(collection string)

todo - can be changed to DeletePartialMatch when https://github.com/prometheus/client_golang/pull/1013 gets released

func DeleteRequest

func DeleteRequest()

func JoinHostPort

func JoinHostPort(host string, port int) string

func LoopPushingMetric

func LoopPushingMetric(name, instance, addr string, intervalSeconds int)

func MemStat

func MemStat() *volume_server_pb.MemStatus

func NewDiskStatus

func NewDiskStatus(path string) (disk *volume_server_pb.DiskStatus)

func ReadRequest

func ReadRequest()

func RequestClose

func RequestClose()

func RequestOpen

func RequestOpen()

func SourceName

func SourceName(port uint32) string

func StartMetricsServer

func StartMetricsServer(ip string, port int)

func WriteRequest

func WriteRequest()

Types

type Channels

type Channels struct {
	Connections    chan *TimedValue
	Requests       chan *TimedValue
	AssignRequests chan *TimedValue
	ReadRequests   chan *TimedValue
	WriteRequests  chan *TimedValue
	DeleteRequests chan *TimedValue
	BytesIn        chan *TimedValue
	BytesOut       chan *TimedValue
}
var (
	Chan *Channels
)

type DurationCounter

type DurationCounter struct {
	MinuteCounter *RoundRobinCounter
	HourCounter   *RoundRobinCounter
	DayCounter    *RoundRobinCounter
	WeekCounter   *RoundRobinCounter
}

func NewDurationCounter

func NewDurationCounter() *DurationCounter

func (*DurationCounter) Add

func (sc *DurationCounter) Add(tv *TimedValue)

Add is for cumulative counts

type RoundRobinCounter

type RoundRobinCounter struct {
	LastIndex int
	Values    []int64
	Counts    []int64
}

func NewRoundRobinCounter

func NewRoundRobinCounter(slots int) *RoundRobinCounter

func (*RoundRobinCounter) Add

func (rrc *RoundRobinCounter) Add(index int, val int64)

func (*RoundRobinCounter) Count

func (rrc *RoundRobinCounter) Count() (cnt int64)

func (*RoundRobinCounter) Max

func (rrc *RoundRobinCounter) Max() (max int64)

func (*RoundRobinCounter) Sum

func (rrc *RoundRobinCounter) Sum() (sum int64)

func (*RoundRobinCounter) ToList

func (rrc *RoundRobinCounter) ToList() (ret []int64)

type ServerStats

type ServerStats struct {
	Requests       *DurationCounter
	Connections    *DurationCounter
	AssignRequests *DurationCounter
	ReadRequests   *DurationCounter
	WriteRequests  *DurationCounter
	DeleteRequests *DurationCounter
	BytesIn        *DurationCounter
	BytesOut       *DurationCounter
}

func NewServerStats

func NewServerStats() *ServerStats

func (*ServerStats) Start

func (ss *ServerStats) Start()

type StatusRecorder

type StatusRecorder struct {
	http.ResponseWriter
	Status int
}

func NewStatusResponseWriter

func NewStatusResponseWriter(w http.ResponseWriter) *StatusRecorder

func (*StatusRecorder) Flush

func (r *StatusRecorder) Flush()

func (*StatusRecorder) WriteHeader

func (r *StatusRecorder) WriteHeader(status int)

type TimedValue

type TimedValue struct {
	// contains filtered or unexported fields
}

func NewTimedValue

func NewTimedValue(t time.Time, val int64) *TimedValue

Jump to

Keyboard shortcuts

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