diff --git a/pkg/query-service/app/clickhouseReader/reader.go b/pkg/query-service/app/clickhouseReader/reader.go index 18078c0931..6038ed602f 100644 --- a/pkg/query-service/app/clickhouseReader/reader.go +++ b/pkg/query-service/app/clickhouseReader/reader.go @@ -3595,7 +3595,11 @@ func (r *ClickHouseReader) QueryDashboardVars(ctx context.Context, query string) return &result, nil } -func (r *ClickHouseReader) GetMetricAggregateAttributes(ctx context.Context, req *v3.AggregateAttributeRequest) (*v3.AggregateAttributeResponse, error) { +func (r *ClickHouseReader) GetMetricAggregateAttributes( + ctx context.Context, + req *v3.AggregateAttributeRequest, + skipDotNames bool, +) (*v3.AggregateAttributeResponse, error) { var query string var err error @@ -3622,6 +3626,10 @@ func (r *ClickHouseReader) GetMetricAggregateAttributes(ctx context.Context, req if err := rows.Scan(&metricName, &typ, &isMonotonic, &temporality); err != nil { return nil, fmt.Errorf("error while scanning rows: %s", err.Error()) } + if skipDotNames && strings.Contains(metricName, ".") { + continue + } + // Non-monotonic cumulative sums are treated as gauges if typ == "Sum" && !isMonotonic && temporality == string(v3.Cumulative) { typ = "Gauge" diff --git a/pkg/query-service/app/http_handler.go b/pkg/query-service/app/http_handler.go index 7078566eca..546235437f 100644 --- a/pkg/query-service/app/http_handler.go +++ b/pkg/query-service/app/http_handler.go @@ -3783,7 +3783,7 @@ func (aH *APIHandler) autocompleteAggregateAttributes(w http.ResponseWriter, r * switch req.DataSource { case v3.DataSourceMetrics: - response, err = aH.reader.GetMetricAggregateAttributes(r.Context(), req) + response, err = aH.reader.GetMetricAggregateAttributes(r.Context(), req, true) case v3.DataSourceLogs: response, err = aH.reader.GetLogAggregateAttributes(r.Context(), req) case v3.DataSourceTraces: diff --git a/pkg/query-service/interfaces/interface.go b/pkg/query-service/interfaces/interface.go index 8e651e17ea..baad5f0a22 100644 --- a/pkg/query-service/interfaces/interface.go +++ b/pkg/query-service/interfaces/interface.go @@ -52,7 +52,7 @@ type Reader interface { SetTTL(ctx context.Context, ttlParams *model.TTLParams) (*model.SetTTLResponseItem, *model.ApiError) FetchTemporality(ctx context.Context, metricNames []string) (map[string]map[v3.Temporality]bool, error) - GetMetricAggregateAttributes(ctx context.Context, req *v3.AggregateAttributeRequest) (*v3.AggregateAttributeResponse, error) + GetMetricAggregateAttributes(ctx context.Context, req *v3.AggregateAttributeRequest, skipDotNames bool) (*v3.AggregateAttributeResponse, error) GetMetricAttributeKeys(ctx context.Context, req *v3.FilterAttributeKeyRequest) (*v3.FilterAttributeKeyResponse, error) GetMetricAttributeValues(ctx context.Context, req *v3.FilterAttributeValueRequest) (*v3.FilterAttributeValueResponse, error)