Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query errorr #32

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
pass in query time
Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
  • Loading branch information
abbyhu2000 committed Aug 30, 2024
commit 726c11c3a17e3a29b9d3caa676a865b02b69c0d8
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { SearchData } from '../../../../../discover/public';

export function QueryResult(props: { queryResult: SearchData }) {
console.log('QueryResult', props.queryResult);

Check failure on line 14 in src/plugins/data/public/query/query_string/language_service/query_result.tsx

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Unexpected console statement
const [isPopoverOpen, setPopover] = useState(false);
const onButtonClick = () => {
setPopover(!isPopoverOpen);
Expand All @@ -23,7 +23,7 @@
return (
<EuiButtonEmpty iconSide="left" iconType={'checkInCircleEmpty'} size="xs" onClick={() => {}}>
<EuiText size="xs" color="subdued">
{'Complete'}
{'Complete in ' + props.queryResult.queryTime + ' ms'}
</EuiText>
</EuiButtonEmpty>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ export default function DiscoverCanvas({ setHeaderActionMenu, history, optionalR
{fetchState.status === ResultStatus.NO_RESULTS && (
<DiscoverNoResults timeFieldName={timeField} queryLanguage={''} />
)}
{fetchState.status === ResultStatus.ERROR && (
<DiscoverNoResults timeFieldName={timeField} queryLanguage={''} />
)}
{fetchState.status === ResultStatus.UNINITIALIZED && (
<DiscoverUninitialized onRefresh={() => refetch$.next()} />
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
chartData?: Chart;
title?: string;
errorMsg?: any;
queryTime?: number;
}

export type SearchRefetch = 'refetch' | undefined;
Expand Down Expand Up @@ -151,6 +152,8 @@

dataset = searchSource.getField('index');

let queryTime;

try {
// Only show loading indicator if we are fetching when the rows are empty
if (fetchStateRef.current.rows?.length === 0) {
Expand Down Expand Up @@ -182,6 +185,9 @@
.ok({ json: fetchResp });
const hits = fetchResp.hits.total as number;
const rows = fetchResp.hits.hits;
//setQueryTime(inspectorRequest.getTime());

Check failure on line 188 in src/plugins/discover/public/application/view_components/utils/use_search.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Expected exception block, space or tab after '//' in comment
//console.log('queryTime', queryTime);

Check failure on line 189 in src/plugins/discover/public/application/view_components/utils/use_search.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Expected exception block, space or tab after '//' in comment
queryTime = inspectorRequest.getTime();
let bucketInterval = {};
let chartData;
for (const row of rows) {
Expand Down Expand Up @@ -218,6 +224,7 @@
indexPattern?.title !== searchSource.getDataFrame()?.name
? searchSource.getDataFrame()?.name
: indexPattern?.title,
queryTime,
});
} catch (error) {
// If the request was aborted then no need to surface this error in the UI
Expand All @@ -230,11 +237,12 @@
indexPattern?.title !== searchSource.getDataFrame()?.name
? searchSource.getDataFrame()?.name
: indexPattern?.title,
queryTime,
});

console.log('error', error.body);

Check failure on line 243 in src/plugins/discover/public/application/view_components/utils/use_search.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Unexpected console statement

//data.search.showError((error.body || error) as Error);

Check failure on line 245 in src/plugins/discover/public/application/view_components/utils/use_search.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Expected exception block, space or tab after '//' in comment
} finally {
initalSearchComplete.current = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,8 @@ export class RequestResponder {
public error(response: Response): void {
this.finish(RequestStatus.ERROR, response);
}

public getTime() {
return this.request.time;
}
}
Loading