Merge pull request #9748 from filecoin-project/feat/metrics-tag-storage-use

feat: metrics: Tag storage path types
This commit is contained in:
Łukasz Magiera 2022-11-29 18:06:23 +01:00 committed by GitHub
commit 7b5e8d1e96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 11 deletions

View File

@ -50,6 +50,9 @@ var (
StorageID, _ = tag.NewKey("storage_id")
SectorState, _ = tag.NewKey("sector_state")
PathSeal, _ = tag.NewKey("path_seal")
PathStorage, _ = tag.NewKey("path_storage")
// rcmgr
ServiceID, _ = tag.NewKey("svc")
ProtocolID, _ = tag.NewKey("proto")
@ -389,52 +392,52 @@ var (
StorageFSAvailableView = &view.View{
Measure: StorageFSAvailable,
Aggregation: view.LastValue(),
TagKeys: []tag.Key{StorageID},
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
}
StorageAvailableView = &view.View{
Measure: StorageAvailable,
Aggregation: view.LastValue(),
TagKeys: []tag.Key{StorageID},
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
}
StorageReservedView = &view.View{
Measure: StorageReserved,
Aggregation: view.LastValue(),
TagKeys: []tag.Key{StorageID},
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
}
StorageLimitUsedView = &view.View{
Measure: StorageLimitUsed,
Aggregation: view.LastValue(),
TagKeys: []tag.Key{StorageID},
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
}
StorageCapacityBytesView = &view.View{
Measure: StorageCapacityBytes,
Aggregation: view.LastValue(),
TagKeys: []tag.Key{StorageID},
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
}
StorageFSAvailableBytesView = &view.View{
Measure: StorageFSAvailableBytes,
Aggregation: view.LastValue(),
TagKeys: []tag.Key{StorageID},
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
}
StorageAvailableBytesView = &view.View{
Measure: StorageAvailableBytes,
Aggregation: view.LastValue(),
TagKeys: []tag.Key{StorageID},
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
}
StorageReservedBytesView = &view.View{
Measure: StorageReservedBytes,
Aggregation: view.LastValue(),
TagKeys: []tag.Key{StorageID},
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
}
StorageLimitUsedBytesView = &view.View{
Measure: StorageLimitUsedBytes,
Aggregation: view.LastValue(),
TagKeys: []tag.Key{StorageID},
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
}
StorageLimitMaxBytesView = &view.View{
Measure: StorageLimitMaxBytes,
Aggregation: view.LastValue(),
TagKeys: []tag.Key{StorageID},
TagKeys: []tag.Key{StorageID, PathStorage, PathSeal},
}
SchedAssignerCycleDurationView = &view.View{

View File

@ -324,7 +324,11 @@ func (i *Index) StorageReportHealth(ctx context.Context, id storiface.ID, report
ent.lastHeartbeat = time.Now()
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.StorageAvailable.M(float64(report.Stat.Available)/float64(report.Stat.Capacity)))