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
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions docs/changelog/88035.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 88035
summary: Sort ingest pipeline stats by use
area: Stats
type: enhancement
issues: []
12 changes: 11 additions & 1 deletion server/src/main/java/org/elasticsearch/ingest/IngestStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,18 @@ public class IngestStats implements Writeable, ToXContentFragment {
*/
public IngestStats(Stats totalStats, List<PipelineStat> pipelineStats, Map<String, List<ProcessorStat>> processorStats) {
this.totalStats = totalStats;
this.pipelineStats = pipelineStats;
this.pipelineStats = pipelineStats.stream().sorted((p1, p2) -> {
final IngestStats.Stats p2Stats = p2.stats;
final IngestStats.Stats p1Stats = p1.stats;
final int ingestTimeCompare = Long.compare(p2Stats.ingestTimeInMillis, p1Stats.ingestTimeInMillis);
if (ingestTimeCompare == 0) {
return Long.compare(p2Stats.ingestCount, p1Stats.ingestCount);
} else {
return ingestTimeCompare;
}
}).toList();
this.processorStats = processorStats;

}

/**
Expand Down