Skip to content

Conversation

@HiDAl
Copy link

@HiDAl HiDAl commented Jun 6, 2023

Add a new target (script) to the /_info API. It consolidates all the script information from the cluster nodes and returns a summary at the cluster level (compared with _nodes/stats/script it lacks the <node> dimension).

GET _info/script { "cluster_name": "runTask", "script": { "compilations": 2, "cache_evictions": 0, "compilation_limit_triggered": 0, "compilations_history": { "5m": 2, "15m": 2, "24h": 2 }, "contexts": [] } } 

As per #95394 comment, the script_cache stats is deprecated, so it's not needed to be migrated.

Closes #95394

@HiDAl HiDAl added >enhancement :Data Management/Stats Statistics tracking and retrieval APIs Team:Data Management Meta label for data/management team v8.9.0 labels Jun 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2023

Documentation preview:

@elasticsearchmachine
Copy link
Collaborator

Hi @HiDAl, I've created a changelog YAML for you.

@HiDAl HiDAl force-pushed the scriptstats-endpoint branch from cc82cac to 1f0b38e Compare June 6, 2023 13:42
@HiDAl HiDAl force-pushed the scriptstats-endpoint branch from 80f8557 to e130e99 Compare June 7, 2023 08:11
@elasticsearchmachine
Copy link
Collaborator

Hi @HiDAl, I've updated the changelog YAML for you.

@HiDAl HiDAl marked this pull request as ready for review June 7, 2023 08:53
@HiDAl HiDAl requested a review from gmarouli June 7, 2023 08:53
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@HiDAl
Copy link
Author

HiDAl commented Jun 7, 2023

@elasticmachine run elasticsearch-ci/part-1

Copy link
Contributor

@gmarouli gmarouli left a comment

Choose a reason for hiding this comment

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

LGTM, some minor comments but almost 🚀

`compilations_history`::
(object)
Contains this recent history of script compilations.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the fits better but I could be wrong, so I am just putting it out there.

Suggested change
Contains this recent history of script compilations.
Contains the recent history of script compilations.
`cache_evictions_history`::
(object)
Contains this recent history of script cache evictions.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same:

Suggested change
Contains this recent history of script cache evictions.
Contains the recent history of script cache evictions.
}

public static ScriptContextStats merge(ScriptContextStats first, ScriptContextStats second) {
assert first.context.equals(second.context) : "To merge 2 ScriptContextStats both of them must to have the same context.";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assert first.context.equals(second.context) : "To merge 2 ScriptContextStats both of them must to have the same context.";
assert first.context.equals(second.context) : "To merge 2 ScriptContextStats both of them must have the same context.";
var mergedContextStats = List.<ScriptContextStats>of();

if (first.contextStats.isEmpty() == false || second.contextStats.isEmpty() == false) {
var mapToCollectMerges = new HashMap<String, ScriptContextStats>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: maybe rename it to mapToCollectMergedStats or something in that direction. No strong feelings, just an idea.

@HiDAl
Copy link
Author

HiDAl commented Jun 9, 2023

@elasticsearchmachine run elasticsearch-ci/part-1

@HiDAl HiDAl requested a review from gmarouli June 9, 2023 10:57
@HiDAl
Copy link
Author

HiDAl commented Jun 9, 2023

@elasticsearchmachine run elasticsearch-ci/part-1

@HiDAl
Copy link
Author

HiDAl commented Jun 9, 2023

@elasticsearchmachine run elasticsearch-ci/bwc

@HiDAl
Copy link
Author

HiDAl commented Jun 9, 2023

@elasticsearchmachine update branch

Copy link
Contributor

@gmarouli gmarouli left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@HiDAl HiDAl merged commit 5a623ee into elastic:main Jun 12, 2023
@HiDAl HiDAl deleted the scriptstats-endpoint branch June 12, 2023 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Data Management/Stats Statistics tracking and retrieval APIs >enhancement Team:Data Management Meta label for data/management team v8.9.0

3 participants