Skip to content

[ES|QL] Query history - #178302

Merged
stratoula merged 46 commits into
elastic:mainfrom
stratoula:esql-query-history
Mar 28, 2024
Merged

stratoula merged 46 commits into
elastic:mainfrom
stratoula:esql-query-history

Conversation

@stratoula

@stratoula stratoula commented Mar 8, 2024 •

Copy link
Copy Markdown
Contributor

Summary

Closes #173217

Implements the query history component in the ESQL editor. The query history component displays the 20 most recent queries and it doesn't duplicate. If the user reruns a query it will update an existing one and not create a new entry.

image image

Important notes

Right now, the query history component has been implemented at:

  • Unified search ES|QL editor
  • Lens inline editing component
  • Alerts
  • Maps

I have hid it from ML data visualizer because it was very difficult to implement it there. There is a quite complex logic fetching the fields statistics so it was a bit complicated to add it there. ML team can follow up as they know the logic already and would be easier for them to adjust.

Flajy test runner

https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5553

Checklist

Delete any items that are not applicable to this PR.

@stratoula stratoula changed the title Esql query history [ES|QL] Query history Mar 8, 2024
dataViewPickerComponentProps?: DataViewPickerProps;
textBasedLanguageModeErrors?: Error[];
textBasedLanguageModeWarning?: string;
hideTextBasedRunQueryLabel?: boolean;

@stratoula stratoula Mar 20, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Cleaning this up, I don't see this property being used anywhere in kibana and with this PR we are also not displaying the text in unified search.

@stratoula

Copy link
Copy Markdown
Contributor Author

/ci

@stratoula

Copy link
Copy Markdown
Contributor Author

/ci

@stratoula stratoula added release_note:feature Makes this part of the condensed release notes v8.14.0 backport:skip This PR does not require backporting Feature:ES|QL ES|QL related features in Kibana labels Mar 26, 2024
@stratoula
stratoula marked this pull request as ready for review March 26, 2024 15:14
@stratoula
stratoula requested review from a team as code owners March 26, 2024 15:14
@stratoula
stratoula requested a review from a team March 26, 2024 16:28

@davismcphee davismcphee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-only review. New Discover functional tests LGTM 👍

I'll leave a more thorough review of the ES|QL changes to our new teammate and resident @elastic/kibana-esql member, @drewdaemon 🙂

@doakalexi doakalexi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the query history when creating a rule from discover, but I do not see it when creating a rule from stack management. Is this expected, maybe I am not testing it correctly

@doakalexi

Copy link
Copy Markdown
Contributor

I see the query history when creating a rule from discover, but I do not see it when creating a rule from stack management. Is this expected, maybe I am not testing it correctly

I am sorry, it was testing problem on my end. I see it working correctly.

@doakalexi doakalexi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResponseOps changes LGTM! Sorry for the noise

@drewdaemon drewdaemon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this feature!

Comment thread packages/kbn-text-based-editor/src/editor_footer.tsx
Comment thread packages/kbn-text-based-editor/src/history_local_storage.ts
Comment thread packages/kbn-text-based-editor/src/query_history.test.tsx Outdated
warnings: serverWarning ? parseWarning(serverWarning) : [],
});
// contains only client side validation messages
const [clientParserMessages, setClientParserMessages] = useState<{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Context complicates things 👍

Comment thread packages/kbn-text-based-editor/src/text_based_languages_editor.tsx
Comment thread test/functional/services/esql.ts Outdated
public async getHistoryItems(): Promise<string[][]> {
const queryHistory = await this.testSubjects.find('TextBasedLangEditor-queryHistory');
const tableBody = await this.retry.try(async () => queryHistory.findByTagName('tbody'));
const $ = await tableBody.parseDomContent();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I didn't know about this feature! I'm sure it's much more performant to load everything in one go.

@drewdaemon drewdaemon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🥳

@stratoula

Copy link
Copy Markdown
Contributor Author

/ci

@kibana-ci

Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
lens 1375 1378 +3
securitySolution 5038 5041 +3
stackAlerts 140 143 +3
textBasedLanguages 55 58 +3
total +12

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dataVisualizer 652.5KB 652.5KB +20.0B
lens 1.4MB 1.4MB +78.0B
stackAlerts 82.3KB 82.4KB +60.0B
textBasedLanguages 140.7KB 151.6KB +10.9KB
unifiedSearch 225.5KB 225.6KB +11.0B
total +11.0KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
textBasedLanguages 5.5KB 5.6KB +108.0B
Unknown metric groups

API count

id before after diff
@kbn/text-based-editor 31 32 +1
textBasedLanguages 27 28 +1
total +2

ESLint disabled line counts

id before after diff
@kbn/text-based-editor 2 3 +1

Total ESLint disabled count

id before after diff
@kbn/text-based-editor 2 3 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@qn895

qn895 commented Mar 28, 2024

Copy link
Copy Markdown
Member

Tested and LGTM 🎉

@nickofthyme nickofthyme left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vis team changes LGTM! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:ES|QL ES|QL related features in Kibana release_note:feature Makes this part of the condensed release notes v8.14.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ES|QL] Query History

8 participants