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

[Lens] Replace scripted metric with scripted terms aggregation #70459

Closed
wylieconlon opened this issue Jul 1, 2020 · 4 comments · Fixed by #78687
Closed

[Lens] Replace scripted metric with scripted terms aggregation #70459

wylieconlon opened this issue Jul 1, 2020 · 4 comments · Fixed by #78687
Assignees
Labels
Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure technical debt Improvement of the software architecture and operational architecture

Comments

@wylieconlon
Copy link
Contributor

In the Lens telemetry we are using a slow-running scripted metric query: https:/elastic/kibana/blob/master/x-pack/plugins/lens/server/usage/visualization_counts.ts#L10

This query can be replaced by a terms aggregation with script, where the script is used to calculate just the term. I believe the entire script we want is:

String visType = doc['lens.visualizationType'].value;
String niceType = visType == 'lnsXY' ? doc['lens.state.visualization.preferredSeriesType'].value : visType;
state.types.put(niceType, state.types.containsKey(niceType) ? state.types.get(niceType) + 1 : 1);
@wylieconlon wylieconlon added technical debt Improvement of the software architecture and operational architecture Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens :KibanaApp/fix-it-week labels Jul 1, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@timroes
Copy link
Contributor

timroes commented Jul 1, 2020

I'd currently hold of on optimizations about that, since given #61663 (comment) it might mean that we in the future anyway need to change the way we collect that telemetry data and can only do it Kibana side in memory.

@wylieconlon
Copy link
Contributor Author

@timroes I don't see why we would hold off on this optimization: it feels like exactly the kind of small tech debt item that we should do during a fix it week, and it seems to have no impact on the larger discussion that you're having.

@wylieconlon
Copy link
Contributor Author

Removing this use of the scripted metric in Kibana would assist the Elasticsearch team in some of their cleanup efforts, they've identified that this is one of the few places in the stack that uses this aggregation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure technical debt Improvement of the software architecture and operational architecture
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants