diff --git a/fragment.go b/fragment.go index e9a7eec7d..b4dc828d1 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(MetricSnapshotDuration, elapsed.Seconds(), 1.0) + stats.Histogram(MetricSnapshotDurationSeconds, 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 8ae7a32dc..247bce041 100644 --- a/holder.go +++ b/holder.go @@ -801,10 +801,10 @@ func (s *holderSyncer) SyncHolder() error { } } } - s.Stats.Histogram(MetricSyncFieldDuration, float64(time.Since(tf)), 1.0) + s.Stats.Histogram(MetricSyncFieldDurationSeconds, float64(time.Since(tf)), 1.0) tf = time.Now() // reset tf } - s.Stats.Histogram(MetricSyncIndexDuration, float64(time.Since(ti)), 1.0) + s.Stats.Histogram(MetricSyncIndexDurationSeconds, float64(time.Since(ti)), 1.0) ti = time.Now() // reset ti } diff --git a/http/handler.go b/http/handler.go index 4b77422d9..51ce25991 100644 --- a/http/handler.go +++ b/http/handler.go @@ -300,7 +300,7 @@ func (h *Handler) collectStats(next http.Handler) http.Handler { stats := h.api.StatsWithTags(statsTags) if stats != nil { - stats.Timing(pilosa.MetricHttpRequest, dur, 0.1) + stats.Timing(pilosa.MetricHTTPRequest, dur, 0.1) } }) } diff --git a/metrics.go b/metrics.go index 93cb6b649..a8afa8e41 100644 --- a/metrics.go +++ b/metrics.go @@ -15,46 +15,46 @@ package pilosa const ( - 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_setrowattrs_total" - MetricSetColumnAttrs = "query_setcolumnattrs_total" - MetricMaximumRow = "maximum_row" - 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" - 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_total" - MetricMaxShard = "maximum_shard" - MetricAntiEntropy = "antientropy_total" - MetricAntiEntropyDuration = "antientropy_duration_seconds" - MetricGarbageCollection = "garbage_collection_total" - MetricGoroutines = "goroutines" - MetricOpenFiles = "open_files" - MetricHeapAlloc = "heap_alloc" - MetricHeapInuse = "heap_inuse" - MetricStackInuse = "stack_inuse" - MetricMallocs = "mallocs" - MetricFrees = "frees" + 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_setrowattrs_total" + MetricSetColumnAttrs = "query_setcolumnattrs_total" + MetricMaximumRow = "maximum_row" + 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" + MetricSnapshotDurationSeconds = "snapshot_duration_seconds" + MetricBlockRepair = "block_repair_total" + MetricSyncFieldDurationSeconds = "sync_field_duration_seconds" + MetricSyncIndexDurationSeconds = "sync_index_duration_seconds" + MetricColumnAttrStoreBlocks = "ColumnAttrStoreBlocks" + MetricColumnAttrDiff = "ColumnAttrDiff" + MetricRowAttrStoreBlocks = "RowAttrStoreBlocks" + MetricRowAttrDiff = "RowAttrDiff" + MetricHTTPRequest = "http_request_total" + MetricMaxShard = "maximum_shard" + MetricAntiEntropy = "antientropy_total" + MetricAntiEntropyDurationSeconds = "antientropy_duration_seconds" + MetricGarbageCollection = "garbage_collection_total" + MetricGoroutines = "goroutines" + MetricOpenFiles = "open_files" + MetricHeapAlloc = "heap_alloc" + MetricHeapInuse = "heap_inuse" + MetricStackInuse = "stack_inuse" + MetricMallocs = "mallocs" + MetricFrees = "frees" ) diff --git a/server.go b/server.go index 9c11d216f..957f45100 100644 --- a/server.go +++ b/server.go @@ -675,7 +675,7 @@ func (s *Server) monitorAntiEntropy() { // Record successful sync in log. s.logger.Printf("holder sync complete") dif := time.Since(t) - s.holder.Stats.Histogram(MetricAntiEntropyDuration, float64(dif), 1.0) + s.holder.Stats.Histogram(MetricAntiEntropyDurationSeconds, float64(dif), 1.0) // Drain tick channel since we just finished anti-entropy. If the AE // process took a long time, we don't want them to pile up on each diff --git a/stats/stats_test.go b/stats/stats_test.go index c116e8168..fe8eb65ac 100644 --- a/stats/stats_test.go +++ b/stats/stats_test.go @@ -109,7 +109,7 @@ func TestStatsCount_TopN(t *testing.T) { } if tags[0] != "index:d" { - t.Errorf("Expected db, Results %s", tags[0]) + t.Errorf("Expected index, Results %s", tags[0]) } called = true @@ -138,7 +138,7 @@ func TestStatsCount_Bitmap(t *testing.T) { } if tags[0] != "index:d" { - t.Errorf("Expected db, Results %s", tags[0]) + t.Errorf("Expected index, Results %s", tags[0]) } called = true @@ -173,7 +173,7 @@ func TestStatsCount_SetRowAttrsBulk(t *testing.T) { } if tags[0] != "index:d" { - t.Errorf("Expected db, Results %s", tags[0]) + t.Errorf("Expected index, Results %s", tags[0]) } called = true }, @@ -207,7 +207,7 @@ func TestStatsCount_SetColumnAttrs(t *testing.T) { } if tags[0] != "index:d" { - t.Errorf("Expected db, Results %s", tags[0]) + t.Errorf("Expected index, Results %s", tags[0]) } called = true },