Skip to content

Sort ingest pipeline stats by time spent executing #88035

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

Merged

Conversation

dakrone
Copy link
Member

@dakrone dakrone commented Jun 24, 2022

This commit changes the /_nodes/stats API to return the pipelines in descending order by the time
spent executing. If a pipeline ties another pipeline, they are sorted by ingest count.

This ensures that the most used and most expensive pipelines show up first in the JSON response (to
help tracking down which pipelines may be most prevalent).

For example:

{
  "nodes" : {
    "yiv09_ETRKSv4q8kz0d59A" : {
      ...
      "ingest" : {
        "total" : {...},
        "pipelines" : {
          "set-name" : {
            "count" : 4, // <-- tie-breaker
            "time_in_millis" : 12, // <-- sorted first by this
            ...
          },
          "set-face" : {
            "count" : 2,
            "time_in_millis" : 8,  // <-- less than 12
            ...
          }

This commit changes the /_nodes/stats API to return the pipelines in descending order by the count
of how often they are used. If a pipeline ties another pipeline, they are sorted by ingest time.

This ensures that the most used and most expensive pipelines show up first in the JSON response (to
help tracking down which pipelines may be most prevalent).

For example:

```json
{
  "nodes" : {
    "yiv09_ETRKSv4q8kz0d59A" : {
      ...
      "ingest" : {
        "total" : {...},
        "pipelines" : {
          "set-name" : {
            "count" : 4, // <-- sorted first by this
            "time_in_millis" : 3, // <-- then by this
            ...
          },
          "set-face" : {
            "count" : 2, // <-- less than 4
            "time_in_millis" : 8,
            ...
          }
```
@dakrone dakrone added >enhancement :Data Management/Stats Statistics tracking and retrieval APIs v8.4.0 labels Jun 24, 2022
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Jun 24, 2022
@elasticmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

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

@dakrone
Copy link
Member Author

dakrone commented Jun 24, 2022

@elasticmachine run elasticsearch-ci/bwc

final IngestStats.Stats p1Stats = p1.stats;
final int ingestCountCompare = Long.compare(p2Stats.ingestCount, p1Stats.ingestCount);
if (ingestCountCompare == 0) {
return Long.compare(p2Stats.ingestTimeInMillis, p1Stats.ingestTimeInMillis);
Copy link
Member

Choose a reason for hiding this comment

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

I wonder whether ingestTimeInMillis should be the primary sort property?
Because I think now pipelines that are used often but are relatively fast show up before pipelines that are used less often but are slower. I think the latter is a more important signal?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I was on the fence about which one to be the primary and which one to be the fallback. I could go either way.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe @jakelandis would have an opinion here too, since he's looked more into ingest performance than I have

Copy link
Member

Choose a reason for hiding this comment

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

I prefer ingestTimeInMillis to be the primary sort property in this case, because I think pipelines with higher time spent are more interesting to look at first irregardless of how often these pipelines were used.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, that works for me too, I'll swap the order here.

@dakrone dakrone changed the title Sort ingest pipeline stats by use Sort ingest pipeline stats by time spent executing Jun 28, 2022
Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

LGTM

@dakrone
Copy link
Member Author

dakrone commented Jun 29, 2022

@elasticmachine update branch

@dakrone dakrone added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Jun 29, 2022
@elasticsearchmachine elasticsearchmachine merged commit 244c248 into elastic:master Jun 29, 2022
@dakrone dakrone deleted the ingest-stats-improvements branch June 29, 2022 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Data Management/Stats Statistics tracking and retrieval APIs >enhancement Team:Data Management Meta label for data/management team v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants