diff --git a/executor.go b/executor.go index cce98d5d3..f2cd94dff 100644 --- a/executor.go +++ b/executor.go @@ -3217,7 +3217,11 @@ func (e *executor) executeBulkSetRowAttrs(ctx context.Context, index string, cal if err := field.RowAttrStore().SetBulkAttrs(fieldMap); err != nil { return nil, err } - field.Stats.Count(MetricSetRowAttrs, 1, 1.0) + } + + if !opt.Remote { + tags := []string{"index:" + index, "bulk:true"} + e.Holder.Stats.CountWithCustomTags(MetricSetRowAttrs, int64(len(m)), 1.0, tags) } // Do not forward call if this is already being forwarded. diff --git a/http/handler.go b/http/handler.go index 1ffc4df4f..4b77422d9 100644 --- a/http/handler.go +++ b/http/handler.go @@ -277,12 +277,16 @@ func (h *Handler) collectStats(next http.Handler) http.Handler { } h.logger.Printf("%s %s %v %s", r.Method, r.URL.String(), dur, queryString) - statsTags = append(statsTags, "speed:true") + statsTags = append(statsTags, "slow:true") + } else { + statsTags = append(statsTags, "slow:false") } pathParts := strings.Split(r.URL.Path, "/") if externalPrefixFlag[pathParts[1]] { statsTags = append(statsTags, "where:external") + } else { + statsTags = append(statsTags, "where:internal") } statsTags = append(statsTags, "useragent:"+r.UserAgent()) diff --git a/prometheus/prometheus.go b/prometheus/prometheus.go index b093d3292..4567d0f11 100644 --- a/prometheus/prometheus.go +++ b/prometheus/prometheus.go @@ -302,7 +302,7 @@ func tagsToLabels(tags []string, logger logger.Logger) (labels prometheus.Labels tagParts := strings.SplitAfterN(tag, ":", 2) if len(tagParts) != 2 { // only process tags in "key:value" form - logger.Debugf("Invalid Prometheus label: %v\n", tag) + logger.Printf("Error: invalid Prometheus label: %v\n", tag) continue } labels[tagParts[0][0:len(tagParts[0])-1]] = tagParts[1] diff --git a/stats/stats_test.go b/stats/stats_test.go index 8ac3606c2..c116e8168 100644 --- a/stats/stats_test.go +++ b/stats/stats_test.go @@ -152,7 +152,7 @@ func TestStatsCount_Bitmap(t *testing.T) { } } -func TestStatsCount_SetColumnAttrs(t *testing.T) { +func TestStatsCount_SetRowAttrsBulk(t *testing.T) { c := test.MustRunCluster(t, 1) defer c.Close() hldr := test.Holder{Holder: c[0].Server.Holder()} @@ -166,11 +166,15 @@ func TestStatsCount_SetColumnAttrs(t *testing.T) { t.Fatal("field not found") } - field.Stats = &MockStats{ - mockCount: func(name string, value int64, rate float64) { + hldr.Holder.Stats = &MockStats{ + mockCountWithTags: func(name string, value int64, rate float64, tags []string) { if name != pilosa.MetricSetRowAttrs { t.Errorf("Expected %v, Results %s", pilosa.MetricSetRowAttrs, name) } + + if tags[0] != "index:d" { + t.Errorf("Expected db, Results %s", tags[0]) + } called = true }, } @@ -182,7 +186,7 @@ func TestStatsCount_SetColumnAttrs(t *testing.T) { } } -func TestStatsCount_SetProfileAttrs(t *testing.T) { +func TestStatsCount_SetColumnAttrs(t *testing.T) { c := test.MustRunCluster(t, 1) defer c.Close() hldr := test.Holder{Holder: c[0].Server.Holder()} @@ -196,12 +200,15 @@ func TestStatsCount_SetProfileAttrs(t *testing.T) { t.Fatal("idex not found") } - idx.Stats = &MockStats{ - mockCount: func(name string, value int64, rate float64) { + hldr.Holder.Stats = &MockStats{ + mockCountWithTags: func(name string, value int64, rate float64, tags []string) { if name != pilosa.MetricSetColumnAttrs { t.Errorf("Expected %v, Results %s", pilosa.MetricSetColumnAttrs, name) } + if tags[0] != "index:d" { + t.Errorf("Expected db, Results %s", tags[0]) + } called = true }, }