Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

auto complete should not ignore meta tags if they are also metric tags #1649

Merged
merged 1 commit into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions idx/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -1451,20 +1451,11 @@ func (m *UnpartitionedMemoryIdx) FindTagValuesWithQuery(orgId uint32, tag, prefi
m.RLock()
defer m.RUnlock()

tags, ok := m.tags[orgId]
if !ok {
return nil
}

// check whether the tag of which we're looking up values is a metric tag
// if so we can skip the meta tag enrichment
_, isMetricTag := tags[tag]

resMap := make(map[string]struct{})

var enricher *metaTagEnricher
var mtr *metaTagRecords
if MetaTagSupport && !isMetricTag {
if MetaTagSupport {
mtr, _, enricher = m.getMetaTagDataStructures(orgId, false)
if enricher != nil && enricher.countMetricsWithMetaTags() == 0 {
// if the enricher is empty we set it back to nil so it doesn't even get called
Expand Down
8 changes: 4 additions & 4 deletions idx/memory/memory_find_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ func testAutoCompleteTagValuesWithQueryWithMetaTagSupport(t *testing.T) {
prefix: "",
expr: []string{"host=~.+"},
limit: 100,
expRes: []string{"read", "write"},
expRes: []string{"none", "read", "write"},
}, {
tag: "direction",
prefix: "wr",
Expand All @@ -1131,13 +1131,13 @@ func testAutoCompleteTagValuesWithQueryWithMetaTagSupport(t *testing.T) {
prefix: "no",
expr: []string{"host=~.+"},
limit: 100,
expRes: []string{},
expRes: []string{"none"},
}, {
tag: "direction",
prefix: "",
expr: []string{"host=~.+"},
limit: 1,
expRes: []string{"read"},
limit: 2,
expRes: []string{"none", "read"},
}, {
tag: "all",
prefix: "",
Expand Down