Skip to content

Commit 9d4b60d

Browse files
feat: increase measurement tag limit from 200 to 500 (#3684)
1 parent 02d92fe commit 9d4b60d

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/flows/pipes/QueryBuilder/context.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ import {BucketContext} from 'src/flows/context/bucket.scoped'
1616

1717
import {formatTimeRangeArguments} from 'src/timeMachine/apis/queryBuilder'
1818

19+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
20+
1921
import {
2022
RemoteDataState,
2123
BuilderTagsType,
2224
BuilderAggregateFunctionType,
2325
} from 'src/types'
2426

2527
const DEFAULT_TAG_LIMIT = 200
28+
const EXTENDED_TAG_LIMIT = 500
2629

2730
interface APIResultArray<T> {
2831
selected: T[]
@@ -236,6 +239,10 @@ export const QueryBuilderProvider: FC = ({children}) => {
236239
_source = `from(bucket: "${data.buckets[0].name}")`
237240
}
238241

242+
const limit = isFlagEnabled('increasedMeasurmentTagLimit')
243+
? EXTENDED_TAG_LIMIT
244+
: DEFAULT_TAG_LIMIT
245+
239246
// TODO: Use the `v1.tagKeys` function from the Flux standard library once
240247
// this issue is resolved: https://github.com/influxdata/flux/issues/1071
241248
query(
@@ -247,7 +254,7 @@ export const QueryBuilderProvider: FC = ({children}) => {
247254
|> distinct()${searchString}${previousTagString}
248255
|> filter(fn: (r) => r._value != "_time" and r._value != "_start" and r._value != "_stop" and r._value != "_value")
249256
|> sort()
250-
|> limit(n: ${DEFAULT_TAG_LIMIT})`,
257+
|> limit(n: ${limit})`,
251258
scope
252259
)
253260
.then(resp => {

src/timeMachine/apis/queryBuilder.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {getTimeRangeVars} from 'src/variables/utils/getTimeRangeVars'
99
import {formatExpression} from 'src/variables/utils/formatExpression'
1010
import {tagToFlux} from 'src/timeMachine/utils/queryBuilder'
1111
import {event} from 'src/cloud/utils/reporting'
12+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
1213

1314
// Types
1415
import {TimeRange, BuilderConfig} from 'src/types'
@@ -17,6 +18,7 @@ import {pastThirtyDaysTimeRange} from 'src/shared/constants/timeRanges'
1718

1819
const DEFAULT_TIME_RANGE: TimeRange = pastThirtyDaysTimeRange
1920
const DEFAULT_LIMIT = 200
21+
const EXTENDED_LIMIT = 500
2022

2123
export interface FindBucketsOptions {
2224
url: string
@@ -61,10 +63,14 @@ export function findKeys({
6163
? ''
6264
: `\n |> filter(fn: (r) => r._value =~ regexp.compile(v: "(?i:" + regexp.quoteMeta(v: "${searchTerm}") + ")"))`
6365

66+
const adjustedLimit = isFlagEnabled('increasedMeasurmentTagLimit')
67+
? EXTENDED_LIMIT
68+
: limit
69+
6470
// TODO: Use the `v1.tagKeys` function from the Flux standard library once
6571
// this issue is resolved: https://github.com/influxdata/flux/issues/1071
6672
const query = `import "regexp"
67-
73+
6874
from(bucket: "${bucket}")
6975
|> range(${timeRangeArguments})
7076
|> filter(fn: ${tagFilters})
@@ -73,7 +79,7 @@ export function findKeys({
7379
|> distinct()${searchFilter}${previousKeyFilter}
7480
|> filter(fn: (r) => r._value != "_time" and r._value != "_start" and r._value != "_stop" and r._value != "_value")
7581
|> sort()
76-
|> limit(n: ${limit})`
82+
|> limit(n: ${adjustedLimit})`
7783

7884
event('runQuery', {
7985
context: 'queryBuilder-findKeys',

0 commit comments

Comments
 (0)