From b1adcd91fc8f47ee02ddd11beb5d6e33feb51690 Mon Sep 17 00:00:00 2001 From: Alan Bernstein Date: Fri, 3 Apr 2020 01:04:11 -0500 Subject: [PATCH] Use consistent metric name convention --- fragment.go | 2 +- holder.go | 4 +-- metrics.go | 75 ++++++++++++++++++++++++++--------------------------- 3 files changed, 40 insertions(+), 41 deletions(-) diff --git a/fragment.go b/fragment.go index 57d4dd820..588ea77ae 100644 --- a/fragment.go +++ b/fragment.go @@ -2249,7 +2249,7 @@ func (f *fragment) Snapshot() error { func track(start time.Time, message string, stats stats.StatsClient, logger logger.Logger) { elapsed := time.Since(start) logger.Debugf("%s took %s", message, elapsed) - stats.Histogram(MetricSnapshot, elapsed.Seconds(), 1.0) + stats.Histogram(MetricSnapshotDuration, elapsed.Seconds(), 1.0) } // snapshot does the actual snapshot operation. it does not check or care diff --git a/holder.go b/holder.go index 6ba6d5967..8ae7a32dc 100644 --- a/holder.go +++ b/holder.go @@ -801,10 +801,10 @@ func (s *holderSyncer) SyncHolder() error { } } } - s.Stats.Histogram(MetricSyncField, float64(time.Since(tf)), 1.0) + s.Stats.Histogram(MetricSyncFieldDuration, float64(time.Since(tf)), 1.0) tf = time.Now() // reset tf } - s.Stats.Histogram(MetricSyncIndex, float64(time.Since(ti)), 1.0) + s.Stats.Histogram(MetricSyncIndexDuration, float64(time.Since(ti)), 1.0) ti = time.Now() // reset ti } diff --git a/metrics.go b/metrics.go index 40005bdb0..fcbf31cc5 100644 --- a/metrics.go +++ b/metrics.go @@ -1,48 +1,47 @@ package pilosa const ( - MetricCreateIndex = "createIndex" - MetricDeleteIndex = "deleteIndex" - MetricCreateField = "createField" - MetricDeleteField = "deleteField" - MetricDeleteAvailableShard = "deleteAvailableShard" - MetricRecalculateCache = "cache.recalculate" - MetricInvalidateCache = "cache.invalidate" - MetricRankCacheLength = "RankCache" - MetricCacheThresholdReached = "cache.threshold" - MetricRow = "range" - MetricRowBSI = "range:bsigroup" - MetricSetRowAttrs = "SetRowAttrs" - MetricSetProfileAttrs = "SetProfileAttrs" + MetricCreateIndex = "create_index_total" + MetricDeleteIndex = "delete_index_total" + MetricCreateField = "create_field_total" + MetricDeleteField = "delete_field_total" + MetricDeleteAvailableShard = "delete_available_shard_total" + MetricRecalculateCache = "recalculate_cache_total" + MetricInvalidateCache = "invalidate_cache_total" + MetricRankCacheLength = "rank_cache_length" + MetricCacheThresholdReached = "cache_threshold_reached_total" + MetricRow = "query_row_total" + MetricRowBSI = "query_row_bsi_total" + MetricSetRowAttrs = "query_set_row_attrs_total" + MetricSetProfileAttrs = "query_set_profile_attrs_total" MetricMaximumRow = "maximum_row" - MetricSetBit = "setBit" - MetricRows = "rows" - MetricClearBit = "clearBit" - MetricSetRow = "setRow" - MetricClearRow = "clearRow" - MetricImportingN = "ImportingN" - MetricImportedN = "ImportedN" - MetricClearingN = "ClearingN" - MetricClearedN = "ClearedN" - MetricSnapshot = "snapshot" - MetricBlockRepairPrimary = "BlockRepairPrimary" - MetricBlockRepair = "BlockRepair" - MetricSyncField = "syncField" - MetricSyncIndex = "syncIndex" + MetricSetBit = "set_bit_total" + MetricClearBit = "clear_bit_total" + MetricSetRow = "set_row_total" + MetricClearRow = "clear_row_total" + MetricImportingN = "importing_total" + MetricImportedN = "imported_total" + MetricClearingN = "clearing_total" + MetricClearedN = "cleared_total" + MetricSnapshotDuration = "snapshot_duration_seconds" + MetricBlockRepairPrimary = "block_repair_primary_total" + MetricBlockRepair = "block_repair_total" + MetricSyncFieldDuration = "sync_field_duration_seconds" + MetricSyncIndexDuration = "sync_index_duration_seconds" MetricColumnAttrStoreBlocks = "ColumnAttrStoreBlocks" MetricColumnAttrDiff = "ColumnAttrDiff" MetricRowAttrStoreBlocks = "RowAttrStoreBlocks" MetricRowAttrDiff = "RowAttrDiff" - MetricHttpRequest = "http.request" - MetricMaxShard = "maxShard" - MetricAntiEntropy = "AntiEntropy" - MetricAntiEntropyDuration = "AntiEntropyDuration" - MetricGarbageCollection = "garbage_collection" + MetricHttpRequest = "http_request_total" + MetricMaxShard = "maximum_shard" + MetricAntiEntropy = "antientropy_total" + MetricAntiEntropyDuration = "antientropy_duration_seconds" + MetricGarbageCollection = "garbage_collection_total" MetricGoroutines = "goroutines" - MetricOpenFiles = "OpenFiles" - MetricHeapAlloc = "HeapAlloc" - MetricHeapInuse = "HeapInuse" - MetricStackInuse = "StackInuse" - MetricMallocs = "Mallocs" - MetricFrees = "Frees" + MetricOpenFiles = "open_files" + MetricHeapAlloc = "heap_alloc" + MetricHeapInuse = "heap_inuse" + MetricStackInuse = "stack_inuse" + MetricMallocs = "mallocs" + MetricFrees = "frees" )