mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 00:55:55 +00:00
Fix some metrics names
This commit is contained in:
parent
5137f56f9c
commit
8c9db373d0
4 changed files with 35 additions and 21 deletions
|
|
@ -463,7 +463,7 @@ func (e *executor) executeCall(ctx context.Context, index string, c *pql.Call, s
|
|||
return nil, errors.Wrap(err, "validating args")
|
||||
}
|
||||
indexTag := "index:" + index
|
||||
metricName := "query_" + c.Name
|
||||
metricName := "query_" + strings.ToLower(c.Name) + "_total"
|
||||
|
||||
// Fixes #2009
|
||||
// See: https://github.com/pilosa/pilosa/issues/2009
|
||||
|
|
|
|||
18
metrics.go
18
metrics.go
|
|
@ -1,3 +1,17 @@
|
|||
// Copyright 2020 Pilosa Corp.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package pilosa
|
||||
|
||||
const (
|
||||
|
|
@ -12,8 +26,8 @@ const (
|
|||
MetricCacheThresholdReached = "cache_threshold_reached_total"
|
||||
MetricRow = "query_row_total"
|
||||
MetricRowBSI = "query_row_bsi_total"
|
||||
MetricSetRowAttrs = "query_set_row_attrs_total"
|
||||
MetricSetColumnAttrs = "query_set_column_attrs_total"
|
||||
MetricSetRowAttrs = "query_setrowattrs_total"
|
||||
MetricSetColumnAttrs = "query_setcolumnattrs_total"
|
||||
MetricMaximumRow = "maximum_row"
|
||||
MetricSetBit = "set_bit_total"
|
||||
MetricClearBit = "clear_bit_total"
|
||||
|
|
|
|||
|
|
@ -252,8 +252,8 @@ func (c *prometheusClient) Set(name string, value string, rate float64) {
|
|||
|
||||
// Timing tracks timing information for a metric.
|
||||
func (c *prometheusClient) Timing(name string, value time.Duration, rate float64) {
|
||||
durationMs := value / time.Second
|
||||
c.Histogram(name, float64(durationMs), rate)
|
||||
durationS := value / time.Second
|
||||
c.Histogram(name, float64(durationS), rate)
|
||||
}
|
||||
|
||||
// SetLogger sets the logger for client.
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ func TestStatsCount_TopN(t *testing.T) {
|
|||
called := false
|
||||
hldr.Holder.Stats = &MockStats{
|
||||
mockCountWithTags: func(name string, value int64, rate float64, tags []string) {
|
||||
if name != "TopN" {
|
||||
t.Errorf("Expected TopN, Results %s", name)
|
||||
if name != "query_topn_total" {
|
||||
t.Errorf("Expected query_topn_total, Results %s", name)
|
||||
}
|
||||
|
||||
if tags[0] != "index:d" {
|
||||
|
|
@ -130,8 +130,8 @@ func TestStatsCount_Bitmap(t *testing.T) {
|
|||
called := false
|
||||
hldr.Holder.Stats = &MockStats{
|
||||
mockCountWithTags: func(name string, value int64, rate float64, tags []string) {
|
||||
if name != "Row" {
|
||||
t.Errorf("Expected Row, Results %s", name)
|
||||
if name != "query_row_total" {
|
||||
t.Errorf("Expected query_row_total, Results %s", name)
|
||||
}
|
||||
|
||||
if tags[0] != "index:d" {
|
||||
|
|
@ -165,8 +165,8 @@ func TestStatsCount_SetColumnAttrs(t *testing.T) {
|
|||
|
||||
field.Stats = &MockStats{
|
||||
mockCount: func(name string, value int64, rate float64) {
|
||||
if name != "SetRowAttrs" {
|
||||
t.Errorf("Expected SetRowAttrs, Results %s", name)
|
||||
if name != "query_setrowattrs_total" {
|
||||
t.Errorf("Expected query_setrowattrs_total, Results %s", name)
|
||||
}
|
||||
called = true
|
||||
},
|
||||
|
|
@ -195,8 +195,8 @@ func TestStatsCount_SetProfileAttrs(t *testing.T) {
|
|||
|
||||
idx.Stats = &MockStats{
|
||||
mockCount: func(name string, value int64, rate float64) {
|
||||
if name != "SetProfileAttrs" {
|
||||
t.Errorf("Expected SetProfilepAttrs, Results %s", name)
|
||||
if name != "query_setcolumnattrs_total" {
|
||||
t.Errorf("Expected query_setcolumnattrs_total, Results %s", name)
|
||||
}
|
||||
|
||||
called = true
|
||||
|
|
@ -222,8 +222,8 @@ func TestStatsCount_APICalls(t *testing.T) {
|
|||
called := false
|
||||
hldr.Stats = &MockStats{
|
||||
mockCount: func(name string, value int64, rate float64) {
|
||||
if name != "createIndex" {
|
||||
t.Errorf("Expected createIndex, Results %s", name)
|
||||
if name != "create_index_total" {
|
||||
t.Errorf("Expected create_index_total, Results %s", name)
|
||||
}
|
||||
called = true
|
||||
},
|
||||
|
|
@ -239,8 +239,8 @@ func TestStatsCount_APICalls(t *testing.T) {
|
|||
called := false
|
||||
hldr.Stats = &MockStats{
|
||||
mockCountWithTags: func(name string, value int64, rate float64, index []string) {
|
||||
if name != "createField" {
|
||||
t.Errorf("Expected createField, Results %s", name)
|
||||
if name != "create_field_total" {
|
||||
t.Errorf("Expected create_field_total, Results %s", name)
|
||||
}
|
||||
if index[0] != "index:i" {
|
||||
t.Errorf("Expected index:i, Results %s", index)
|
||||
|
|
@ -260,8 +260,8 @@ func TestStatsCount_APICalls(t *testing.T) {
|
|||
called := false
|
||||
hldr.Stats = &MockStats{
|
||||
mockCountWithTags: func(name string, value int64, rate float64, index []string) {
|
||||
if name != "deleteField" {
|
||||
t.Errorf("Expected deleteField, Results %s", name)
|
||||
if name != "delete_field_total" {
|
||||
t.Errorf("Expected delete_field_total, Results %s", name)
|
||||
}
|
||||
if index[0] != "index:i" {
|
||||
t.Errorf("Expected index:i, Results %s", index)
|
||||
|
|
@ -281,8 +281,8 @@ func TestStatsCount_APICalls(t *testing.T) {
|
|||
called := false
|
||||
hldr.Stats = &MockStats{
|
||||
mockCount: func(name string, value int64, rate float64) {
|
||||
if name != "deleteIndex" {
|
||||
t.Errorf("Expected deleteIndex, Results %s", name)
|
||||
if name != "delete_index_total" {
|
||||
t.Errorf("Expected delete_index_total, Results %s", name)
|
||||
}
|
||||
|
||||
called = true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue