feat: metrics: Tag storage path types
This commit is contained in:
parent
a0422f6467
commit
57c31a79e7
@ -50,6 +50,9 @@ var (
|
|||||||
StorageID, _ = tag.NewKey("storage_id")
|
StorageID, _ = tag.NewKey("storage_id")
|
||||||
SectorState, _ = tag.NewKey("sector_state")
|
SectorState, _ = tag.NewKey("sector_state")
|
||||||
|
|
||||||
|
PathSeal, _ = tag.NewKey("path_seal")
|
||||||
|
PathStorage, _ = tag.NewKey("path_storage")
|
||||||
|
|
||||||
// rcmgr
|
// rcmgr
|
||||||
ServiceID, _ = tag.NewKey("svc")
|
ServiceID, _ = tag.NewKey("svc")
|
||||||
ProtocolID, _ = tag.NewKey("proto")
|
ProtocolID, _ = tag.NewKey("proto")
|
||||||
@ -389,52 +392,52 @@ var (
|
|||||||
StorageFSAvailableView = &view.View{
|
StorageFSAvailableView = &view.View{
|
||||||
Measure: StorageFSAvailable,
|
Measure: StorageFSAvailable,
|
||||||
Aggregation: view.LastValue(),
|
Aggregation: view.LastValue(),
|
||||||
TagKeys: []tag.Key{StorageID},
|
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
|
||||||
}
|
}
|
||||||
StorageAvailableView = &view.View{
|
StorageAvailableView = &view.View{
|
||||||
Measure: StorageAvailable,
|
Measure: StorageAvailable,
|
||||||
Aggregation: view.LastValue(),
|
Aggregation: view.LastValue(),
|
||||||
TagKeys: []tag.Key{StorageID},
|
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
|
||||||
}
|
}
|
||||||
StorageReservedView = &view.View{
|
StorageReservedView = &view.View{
|
||||||
Measure: StorageReserved,
|
Measure: StorageReserved,
|
||||||
Aggregation: view.LastValue(),
|
Aggregation: view.LastValue(),
|
||||||
TagKeys: []tag.Key{StorageID},
|
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
|
||||||
}
|
}
|
||||||
StorageLimitUsedView = &view.View{
|
StorageLimitUsedView = &view.View{
|
||||||
Measure: StorageLimitUsed,
|
Measure: StorageLimitUsed,
|
||||||
Aggregation: view.LastValue(),
|
Aggregation: view.LastValue(),
|
||||||
TagKeys: []tag.Key{StorageID},
|
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
|
||||||
}
|
}
|
||||||
StorageCapacityBytesView = &view.View{
|
StorageCapacityBytesView = &view.View{
|
||||||
Measure: StorageCapacityBytes,
|
Measure: StorageCapacityBytes,
|
||||||
Aggregation: view.LastValue(),
|
Aggregation: view.LastValue(),
|
||||||
TagKeys: []tag.Key{StorageID},
|
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
|
||||||
}
|
}
|
||||||
StorageFSAvailableBytesView = &view.View{
|
StorageFSAvailableBytesView = &view.View{
|
||||||
Measure: StorageFSAvailableBytes,
|
Measure: StorageFSAvailableBytes,
|
||||||
Aggregation: view.LastValue(),
|
Aggregation: view.LastValue(),
|
||||||
TagKeys: []tag.Key{StorageID},
|
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
|
||||||
}
|
}
|
||||||
StorageAvailableBytesView = &view.View{
|
StorageAvailableBytesView = &view.View{
|
||||||
Measure: StorageAvailableBytes,
|
Measure: StorageAvailableBytes,
|
||||||
Aggregation: view.LastValue(),
|
Aggregation: view.LastValue(),
|
||||||
TagKeys: []tag.Key{StorageID},
|
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
|
||||||
}
|
}
|
||||||
StorageReservedBytesView = &view.View{
|
StorageReservedBytesView = &view.View{
|
||||||
Measure: StorageReservedBytes,
|
Measure: StorageReservedBytes,
|
||||||
Aggregation: view.LastValue(),
|
Aggregation: view.LastValue(),
|
||||||
TagKeys: []tag.Key{StorageID},
|
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
|
||||||
}
|
}
|
||||||
StorageLimitUsedBytesView = &view.View{
|
StorageLimitUsedBytesView = &view.View{
|
||||||
Measure: StorageLimitUsedBytes,
|
Measure: StorageLimitUsedBytes,
|
||||||
Aggregation: view.LastValue(),
|
Aggregation: view.LastValue(),
|
||||||
TagKeys: []tag.Key{StorageID},
|
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
|
||||||
}
|
}
|
||||||
StorageLimitMaxBytesView = &view.View{
|
StorageLimitMaxBytesView = &view.View{
|
||||||
Measure: StorageLimitMaxBytes,
|
Measure: StorageLimitMaxBytes,
|
||||||
Aggregation: view.LastValue(),
|
Aggregation: view.LastValue(),
|
||||||
TagKeys: []tag.Key{StorageID},
|
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
|
||||||
}
|
}
|
||||||
|
|
||||||
SchedAssignerCycleDurationView = &view.View{
|
SchedAssignerCycleDurationView = &view.View{
|
||||||
|
@ -324,7 +324,11 @@ func (i *Index) StorageReportHealth(ctx context.Context, id storiface.ID, report
|
|||||||
ent.lastHeartbeat = time.Now()
|
ent.lastHeartbeat = time.Now()
|
||||||
|
|
||||||
if report.Stat.Capacity > 0 {
|
if report.Stat.Capacity > 0 {
|
||||||
ctx, _ = tag.New(ctx, tag.Upsert(metrics.StorageID, string(id)))
|
ctx, _ = tag.New(ctx,
|
||||||
|
tag.Upsert(metrics.StorageID, string(id)),
|
||||||
|
tag.Upsert(metrics.PathStorage, fmt.Sprint(ent.info.CanStore)),
|
||||||
|
tag.Upsert(metrics.PathSeal, fmt.Sprint(ent.info.CanSeal)),
|
||||||
|
)
|
||||||
|
|
||||||
stats.Record(ctx, metrics.StorageFSAvailable.M(float64(report.Stat.FSAvailable)/float64(report.Stat.Capacity)))
|
stats.Record(ctx, metrics.StorageFSAvailable.M(float64(report.Stat.FSAvailable)/float64(report.Stat.Capacity)))
|
||||||
stats.Record(ctx, metrics.StorageAvailable.M(float64(report.Stat.Available)/float64(report.Stat.Capacity)))
|
stats.Record(ctx, metrics.StorageAvailable.M(float64(report.Stat.Available)/float64(report.Stat.Capacity)))
|
||||||
|
Loading…
Reference in New Issue
Block a user