Skip to content

Commit 85d59a0

Browse files
authored
feat: feature flag usage of the fastFromFlux function (#4593)
1 parent 4747846 commit 85d59a0

File tree

19 files changed

+2125
-3309
lines changed

19 files changed

+2125
-3309
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
"@docsearch/react": "^3.0.0-alpha.37",
166166
"@influxdata/clockface": "^4.0.1",
167167
"@influxdata/flux-lsp-browser": "0.8.8",
168-
"@influxdata/giraffe": "^2.25.0",
168+
"@influxdata/giraffe": "^2.26.0",
169169
"@influxdata/influxdb-templates": "0.9.0",
170170
"@influxdata/react-custom-scrollbars": "4.3.8",
171171
"abortcontroller-polyfill": "^1.3.0",
@@ -221,8 +221,8 @@
221221
"s2-geometry": "^1.2.10",
222222
"use-local-storage-state": "^9.0.2",
223223
"worker-plugin": "^5.0.1",
224-
"y-websocket": "^1.3.16",
225-
"yjs": "^13.5.13"
224+
"y-websocket": "^1.4.3",
225+
"yjs": "^13.5.36"
226226
},
227227
"resolutions": {
228228
"mocha/**/minimist": "^0.0.8",

src/alerting/utils/activity.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Utils
22
import {runQuery} from 'src/shared/apis/query'
3-
import {fromFlux} from '@influxdata/giraffe'
3+
import {fromFlux, fastFromFlux} from '@influxdata/giraffe'
44
import {event} from 'src/cloud/utils/reporting'
5+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
56

67
// Constants
78
import {MONITORING_BUCKET} from 'src/alerting/constants'
@@ -54,7 +55,9 @@ export const processResponse = ({
5455
return Promise.reject(new Error(resp.message))
5556
}
5657

57-
const {table} = fromFlux(resp.csv)
58+
const {table} = isFlagEnabled('fastFromFlux')
59+
? fastFromFlux(resp.csv)
60+
: fromFlux(resp.csv)
5861
const rows: Row[] = []
5962

6063
for (let i = 0; i < table.length; i++) {

src/alerting/utils/history.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {runQuery} from 'src/shared/apis/query'
66

77
jest.mock('@influxdata/giraffe', () => ({
88
fromFlux: jest.fn(),
9+
fastFromFlux: jest.fn(),
910
// todo: test will fails on binaryPrefixFormatter not a function in src/shared/copy/notifications.ts:22:24 this mock can be removed after this will be fixed
1011
binaryPrefixFormatter: jest.fn(),
1112
}))

src/alerting/utils/history.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// Libraries
2-
import {fromFlux} from '@influxdata/giraffe'
2+
import {fromFlux, fastFromFlux} from '@influxdata/giraffe'
33

44
// Utils
55
import {runQuery, RunQueryResult} from 'src/shared/apis/query'
66
import {parseSearchInput, searchExprToFlux} from 'src/eventViewer/utils/search'
77
import {findNodes} from 'src/shared/utils/ast'
88
import {event} from 'src/cloud/utils/reporting'
9+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
910

1011
// Constants
1112
import {
@@ -149,7 +150,9 @@ export const processResponse = ({
149150
return Promise.reject(new Error(resp.message))
150151
}
151152

152-
const {table} = fromFlux(resp.csv)
153+
const {table} = isFlagEnabled('fastFromFlux')
154+
? fastFromFlux(resp.csv)
155+
: fromFlux(resp.csv)
153156
const rows: Row[] = []
154157

155158
for (let i = 0; i < table.length; i++) {

src/alerting/utils/statusEvents.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import {mocked} from 'ts-jest/utils'
55

66
jest.mock('@influxdata/giraffe', () => ({
77
fromFlux: jest.fn(),
8+
fastFromFlux: jest.fn(),
9+
// todo: test will fails on binaryPrefixFormatter not a function in src/shared/copy/notifications.ts:22:24 this mock can be removed after this will be fixed
10+
binaryPrefixFormatter: jest.fn(),
811
}))
912
// todo: test will fails on binaryPrefixFormatter not a function in src/shared/copy/notifications.ts:22:24 this mock can be removed after this will be fixed
1013
jest.mock('src/cloud/utils/reporting')

src/alerting/utils/statusEvents.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Utils
22
import {runQuery} from 'src/shared/apis/query'
3-
import {fromFlux} from '@influxdata/giraffe'
3+
import {fromFlux, fastFromFlux} from '@influxdata/giraffe'
44
import {event} from 'src/cloud/utils/reporting'
5+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
56

67
// Constants
78
import {MONITORING_BUCKET} from 'src/alerting/constants'
@@ -50,7 +51,10 @@ export const processStatusesResponse = ({
5051
return Promise.reject(new Error(resp.message))
5152
}
5253

53-
const {table} = fromFlux(resp.csv)
54+
const {table} = isFlagEnabled(resp.csv)
55+
? fastFromFlux(resp.csv)
56+
: fromFlux(resp.csv)
57+
5458
const rows: Row[][] = [[]]
5559

5660
for (let i = 0; i < table.length; i++) {

src/cloud/components/onboarding/useGetUserStatus.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {fromFlux} from '@influxdata/giraffe'
1+
import {fromFlux, fastFromFlux} from '@influxdata/giraffe'
22
import {event} from 'src/cloud/utils/reporting'
33
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
44
import {Table} from '@influxdata/giraffe'
@@ -92,7 +92,8 @@ export const queryUsage = async (orgID: string, range?: string) => {
9292
csvToParse = usageStatsCsv
9393
}
9494

95-
const {table} = fromFlux(csvToParse)
95+
const parser = isFlagEnabled('fastFromFlux') ? fastFromFlux : fromFlux
96+
const {table} = parser(csvToParse)
9697
return table
9798
}
9899

src/flows/components/ReadOnly.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import React, {FC, useContext, useEffect} from 'react'
33
import {AppWrapper, DapperScrollbars, Page} from '@influxdata/clockface'
44
import {useParams} from 'react-router'
5-
import {fromFlux} from '@influxdata/giraffe'
5+
import {fromFlux, fastFromFlux} from '@influxdata/giraffe'
6+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
67

78
// Contexts
89
import {FlowProvider} from 'src/flows/context/shared'
@@ -47,7 +48,9 @@ const RunPipeResults: FC = () => {
4748
.then(res =>
4849
res.text().then(resp => {
4950
if (res.status == 200) {
50-
const csv = fromFlux(resp)
51+
const csv = isFlagEnabled('fastFromFlux')
52+
? fastFromFlux(resp)
53+
: fromFlux(resp)
5154
setResult(id, {parsed: csv, source: ''})
5255
setStatuses({[id]: RemoteDataState.Done})
5356
} else {

src/shared/components/FluxTablesTransform.tsx

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/shared/components/TimeSeries.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, {Component, RefObject, CSSProperties} from 'react'
33
import {isEqual} from 'lodash'
44
import {connect, ConnectedProps} from 'react-redux'
55
import {withRouter, RouteComponentProps} from 'react-router-dom'
6-
import {fromFlux, FromFluxResult} from '@influxdata/giraffe'
6+
import {fromFlux, fastFromFlux, FromFluxResult} from '@influxdata/giraffe'
77

88
// API
99
import {RunQueryResult, RunQuerySuccessResult} from 'src/shared/apis/query'
@@ -47,6 +47,7 @@ import {
4747
CancelBox,
4848
} from 'src/types'
4949
import {event} from 'src/cloud/utils/reporting'
50+
import {isFlagEnabled} from '../utils/featureFlag'
5051

5152
interface QueriesState {
5253
files: string[] | null
@@ -299,7 +300,8 @@ class TimeSeries extends Component<Props, State> {
299300
}
300301

301302
const files = (results as RunQuerySuccessResult[]).map(r => r.csv)
302-
const giraffeResult = fromFlux(files.join('\n\n'))
303+
const parser = isFlagEnabled('fastFromFlux') ? fastFromFlux : fromFlux
304+
const giraffeResult = parser(files.join('\n\n'))
303305

304306
this.pendingReload = false
305307
// this check prevents a memory leak https://github.com/influxdata/ui/issues/2137

0 commit comments

Comments
 (0)