Increment logs queryCount state for all queries
parent
6f4891c091
commit
eadd53053b
|
@ -237,13 +237,20 @@ export const executeHistogramQueryAsync = () => async (
|
||||||
const searchTerm = getSearchTerm(state)
|
const searchTerm = getSearchTerm(state)
|
||||||
const filters = getFilters(state)
|
const filters = getFilters(state)
|
||||||
|
|
||||||
if (_.every([queryConfig, timeRange, namespace, proxyLink])) {
|
if (!_.every([queryConfig, timeRange, namespace, proxyLink])) {
|
||||||
const query = buildLogQuery(timeRange, queryConfig, filters, searchTerm)
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
dispatch(incrementQueryCount())
|
||||||
|
|
||||||
|
const query = buildLogQuery(timeRange, queryConfig, filters, searchTerm)
|
||||||
const response = await executeQueryAsync(proxyLink, namespace, query)
|
const response = await executeQueryAsync(proxyLink, namespace, query)
|
||||||
const data = parseHistogramQueryResponse(response)
|
const data = parseHistogramQueryResponse(response)
|
||||||
|
|
||||||
dispatch(setHistogramData(data))
|
dispatch(setHistogramData(data))
|
||||||
|
} finally {
|
||||||
|
dispatch(decrementQueryCount())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +272,13 @@ export const executeTableQueryAsync = () => async (
|
||||||
const searchTerm = getSearchTerm(state)
|
const searchTerm = getSearchTerm(state)
|
||||||
const filters = getFilters(state)
|
const filters = getFilters(state)
|
||||||
|
|
||||||
if (_.every([queryConfig, timeRange, namespace, proxyLink])) {
|
if (!_.every([queryConfig, timeRange, namespace, proxyLink])) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
dispatch(incrementQueryCount())
|
||||||
|
|
||||||
const query = buildLogQuery(timeRange, queryConfig, filters, searchTerm)
|
const query = buildLogQuery(timeRange, queryConfig, filters, searchTerm)
|
||||||
const response = await executeQueryAsync(
|
const response = await executeQueryAsync(
|
||||||
proxyLink,
|
proxyLink,
|
||||||
|
@ -276,6 +289,8 @@ export const executeTableQueryAsync = () => async (
|
||||||
const series = getDeep(response, 'results.0.series.0', defaultTableData)
|
const series = getDeep(response, 'results.0.series.0', defaultTableData)
|
||||||
|
|
||||||
dispatch(setTableData(series))
|
dispatch(setTableData(series))
|
||||||
|
} finally {
|
||||||
|
dispatch(decrementQueryCount())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,16 +303,13 @@ export const incrementQueryCount = () => ({
|
||||||
})
|
})
|
||||||
|
|
||||||
export const executeQueriesAsync = () => async dispatch => {
|
export const executeQueriesAsync = () => async dispatch => {
|
||||||
dispatch(incrementQueryCount())
|
|
||||||
try {
|
try {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
dispatch(executeHistogramQueryAsync()),
|
dispatch(executeHistogramQueryAsync()),
|
||||||
dispatch(executeTableQueryAsync()),
|
dispatch(executeTableQueryAsync()),
|
||||||
])
|
])
|
||||||
} catch (ex) {
|
} catch {
|
||||||
console.error('Could not make query requests')
|
console.error('Could not make query requests')
|
||||||
} finally {
|
|
||||||
dispatch(decrementQueryCount())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue