app/vmstorage: export vm_composite_filter_success_conversions_total and vm_composite_filter_missing_conversions_total metrics

This commit is contained in:
Aliaksandr Valialkin 2021-02-17 19:13:38 +02:00
parent 0c5bb2a397
commit 83da939947
3 changed files with 19 additions and 1 deletions

View file

@ -332,6 +332,12 @@ func registerStorageMetrics(strg *storage.Storage) {
metrics.NewGauge(`vm_composite_index_min_timestamp`, func() float64 {
return float64(idbm().MinTimestampForCompositeIndex) / 1e3
})
metrics.NewGauge(`vm_composite_filter_success_conversions_total`, func() float64 {
return float64(idbm().CompositeFilterSuccessConversions)
})
metrics.NewGauge(`vm_composite_filter_missing_conversions_total`, func() float64 {
return float64(idbm().CompositeFilterMissingConversions)
})
metrics.NewGauge(`vm_assisted_merges_total{type="storage/small"}`, func() float64 {
return float64(tm().SmallAssistedMerges)

View file

@ -205,7 +205,9 @@ type IndexDBMetrics struct {
IndexBlocksWithMetricIDsProcessed uint64
IndexBlocksWithMetricIDsIncorrectOrder uint64
MinTimestampForCompositeIndex uint64
MinTimestampForCompositeIndex uint64
CompositeFilterSuccessConversions uint64
CompositeFilterMissingConversions uint64
mergeset.TableMetrics
}
@ -249,6 +251,8 @@ func (db *indexDB) UpdateMetrics(m *IndexDBMetrics) {
m.IndexBlocksWithMetricIDsIncorrectOrder = atomic.LoadUint64(&indexBlocksWithMetricIDsIncorrectOrder)
m.MinTimestampForCompositeIndex = uint64(db.minTimestampForCompositeIndex)
m.CompositeFilterSuccessConversions = atomic.LoadUint64(&compositeFilterSuccessConversions)
m.CompositeFilterMissingConversions = atomic.LoadUint64(&compositeFilterMissingConversions)
db.tb.UpdateMetrics(&m.TableMetrics)
db.doExtDB(func(extDB *indexDB) {

View file

@ -37,6 +37,7 @@ func convertToCompositeTagFilters(tfs *TagFilters) *TagFilters {
}
if len(name) == 0 {
// There is no metric name filter, so composite filters cannot be created.
atomic.AddUint64(&compositeFilterMissingConversions, 1)
return tfs
}
tfsNew := make([]tagFilter, 0, len(tfs.tfs))
@ -62,13 +63,20 @@ func convertToCompositeTagFilters(tfs *TagFilters) *TagFilters {
compositeFilters++
}
if compositeFilters == 0 {
atomic.AddUint64(&compositeFilterMissingConversions, 1)
return tfs
}
tfsCompiled := NewTagFilters(tfs.accountID, tfs.projectID)
tfsCompiled.tfs = tfsNew
atomic.AddUint64(&compositeFilterSuccessConversions, 1)
return tfsCompiled
}
var (
compositeFilterSuccessConversions uint64
compositeFilterMissingConversions uint64
)
// TagFilters represents filters used for filtering tags.
type TagFilters struct {
accountID uint32