Informer/disk: record issued metric weights as prometheus metric.
This commit is contained in:
parent
2aec92301d
commit
c454769887
|
@ -8,10 +8,12 @@ import (
|
|||
"sync"
|
||||
|
||||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/observations"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
|
||||
"go.opencensus.io/stats"
|
||||
"go.opencensus.io/trace"
|
||||
)
|
||||
|
||||
|
@ -152,5 +154,8 @@ func (disk *Informer) GetMetrics(ctx context.Context) []api.Metric {
|
|||
}
|
||||
|
||||
m.SetTTL(disk.config.MetricTTL)
|
||||
|
||||
stats.Record(ctx, observations.InformerDisk.M(m.Weight))
|
||||
|
||||
return []api.Metric{m}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ var (
|
|||
|
||||
BlocksAdded = stats.Int64("blocks/added", "Total number of blocks added", stats.UnitDimensionless)
|
||||
BlocksAddedError = stats.Int64("blocks/put_errors", "Total number of block/put errors", stats.UnitDimensionless)
|
||||
|
||||
InformerDisk = stats.Int64("informer/disk", "The metric value weight issued by disk informer", stats.UnitDimensionless)
|
||||
)
|
||||
|
||||
// views, which is just the aggregation of the metrics
|
||||
|
@ -114,6 +116,11 @@ var (
|
|||
Aggregation: view.Sum(),
|
||||
}
|
||||
|
||||
InformerDiskView = &view.View{
|
||||
Measure: InformerDisk,
|
||||
Aggregation: view.LastValue(),
|
||||
}
|
||||
|
||||
DefaultViews = []*view.View{
|
||||
PinsView,
|
||||
PinsQueuedView,
|
||||
|
@ -126,6 +133,7 @@ var (
|
|||
BlocksAddedSizeView,
|
||||
BlocksAddedView,
|
||||
BlocksAddedErrorView,
|
||||
InformerDiskView,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user