Skip to content

Commit

Permalink
cleanup P8s metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
davies committed Mar 19, 2021
1 parent 2c833f3 commit 6127863
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
13 changes: 7 additions & 6 deletions cmd/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@ import (

var (
cpu = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "juicefs_cpu_usage",
Name: "cpu_usage",
Help: "Accumulated CPU usage in seconds.",
})
memory = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "juicefs_memory",
Name: "memory",
Help: "Used memory in bytes.",
})
uptime = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "juicefs_uptime",
Name: "uptime",
Help: "Total running time in seconds.",
})
usedSpace = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "juicefs_used_space",
Name: "used_space",
Help: "Total used space in bytes.",
})
usedInodes = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "juicefs_used_inodes",
Name: "used_inodes",
Help: "Total number of inodes.",
})
)
Expand Down Expand Up @@ -153,7 +153,8 @@ func mount(c *cli.Context) error {
"mp": mp,
}
// Wrap the default registry, all prometheus.MustRegister() calls should be afterwards
prometheus.DefaultRegisterer = prometheus.WrapRegistererWith(mntLabels, prometheus.DefaultRegisterer)
prometheus.DefaultRegisterer = prometheus.WrapRegistererWith(mntLabels,
prometheus.WrapRegistererWithPrefix("juicefs_", prometheus.DefaultRegisterer))

chunkConf := chunk.Config{
BlockSize: format.BlockSize * 1024,
Expand Down
12 changes: 6 additions & 6 deletions pkg/chunk/cached_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ var (
logger = utils.GetLogger("juicefs")

cacheHits = prometheus.NewCounter(prometheus.CounterOpts{
Name: "juicefs_blockcache_hits",
Name: "blockcache_hits",
Help: "read from cached block",
})
cacheMiss = prometheus.NewCounter(prometheus.CounterOpts{
Name: "juicefs_blockcache_miss",
Name: "blockcache_miss",
Help: "missed read from cached block",
})
cacheHitBytes = prometheus.NewCounter(prometheus.CounterOpts{
Name: "juicefs_blockcache_hit_bytes",
Name: "blockcache_hit_bytes",
Help: "read bytes from cached block",
})
cacheMissBytes = prometheus.NewCounter(prometheus.CounterOpts{
Name: "juicefs_blockcache_miss_bytes",
Name: "blockcache_miss_bytes",
Help: "missed bytes from cached block",
})
)
Expand Down Expand Up @@ -682,7 +682,7 @@ func NewCachedStore(storage object.ObjectStorage, config Config) ChunkStore {
_ = prometheus.Register(cacheMissBytes)
_ = prometheus.Register(prometheus.NewGaugeFunc(
prometheus.GaugeOpts{
Name: "juicefs_blockcache_blocks",
Name: "blockcache_blocks",
Help: "number of cached blocks",
},
func() float64 {
Expand All @@ -691,7 +691,7 @@ func NewCachedStore(storage object.ObjectStorage, config Config) ChunkStore {
}))
_ = prometheus.Register(prometheus.NewGaugeFunc(
prometheus.GaugeOpts{
Name: "juicefs_blockcache_bytes",
Name: "blockcache_bytes",
Help: "number of cached bytes",
},
func() float64 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/meta/redis_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import "github.com/prometheus/client_golang/prometheus"

var (
redisTxDist = prometheus.NewHistogram(prometheus.HistogramOpts{
Name: "juicefs_redis_tx_durations_histogram_seconds",
Name: "redis_tx_durations_histogram_seconds",
Help: "Redis transactions latency distributions.",
Buckets: prometheus.ExponentialBuckets(0.0001, 1.5, 30),
})
redisTxRestart = prometheus.NewCounter(prometheus.CounterOpts{
Name: "juicefs_redis_transaction_restart",
Name: "redis_transaction_restart",
Help: "The number of times a Redis transaction is restarted.",
})
)
Expand Down
6 changes: 3 additions & 3 deletions pkg/object/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ import (

var (
reqsHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Name: "juicefs_object_request_durations_histogram_seconds",
Name: "object_request_durations_histogram_seconds",
Help: "Object requests latency distributions.",
Buckets: prometheus.ExponentialBuckets(0.01, 1.5, 20),
}, []string{"method"})
reqErrors = prometheus.NewCounter(prometheus.CounterOpts{
Name: "juicefs_object_request_errors",
Name: "object_request_errors",
Help: "failed requests to object store",
})
dataBytes = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "juicefs_object_request_data_bytes",
Name: "object_request_data_bytes",
Help: "Object requests size in bytes.",
}, []string{"method"})
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/vfs/accesslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

var (
opsDurationsHistogram = prometheus.NewHistogram(prometheus.HistogramOpts{
Name: "juicefs_fuse_ops_durations_histogram_seconds",
Name: "fuse_ops_durations_histogram_seconds",
Help: "Operations latency distributions.",
Buckets: prometheus.ExponentialBuckets(0.0001, 1.5, 30),
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/vfs/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

var (
handlersGause = prometheus.NewGaugeFunc(prometheus.GaugeOpts{
Name: "juicefs_fuse_open_handlers",
Name: "fuse_open_handlers",
Help: "number of open files and directories.",
}, func() float64 {
hanleLock.Lock()
Expand Down
4 changes: 2 additions & 2 deletions pkg/vfs/vfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ var (

var (
readSizeHistogram = prometheus.NewHistogram(prometheus.HistogramOpts{
Name: "juicefs_fuse_read_size_bytes",
Name: "fuse_read_size_bytes",
Help: "size of read distributions.",
Buckets: prometheus.LinearBuckets(4096, 4096, 32),
})
writtenSizeHistogram = prometheus.NewHistogram(prometheus.HistogramOpts{
Name: "juicefs_fuse_written_size_bytes",
Name: "fuse_written_size_bytes",
Help: "size of write distributions.",
Buckets: prometheus.LinearBuckets(4096, 4096, 32),
})
Expand Down

0 comments on commit 6127863

Please sign in to comment.