-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Extend Profiler to allow for non-timing info #18631
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
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4ed2b3c
copied from other branch, ready for pr
neuenfeldttj 0086e78
cleanup from merging
neuenfeldttj a57cbaf
another spotless apply and fixed breaking change
neuenfeldttj 6cce78a
another spotlessApply
neuenfeldttj 179a190
forgot to change back concurrent agg stuff
neuenfeldttj 0e35b77
forgot to spotless after prev fix
neuenfeldttj 85d4e04
added more unit tests for coverage
neuenfeldttj c3580ea
Merge branch 'main' into profile-metrics
neuenfeldttj 1619488
changed to supplier, removed timer ctors
neuenfeldttj a3819d4
made feedback changes
neuenfeldttj 60e9e77
forgot javadoc for new class
neuenfeldttj d22ebd6
forgot to revert name to toString
neuenfeldttj 4be314f
fix count check in concurrentquerypb
neuenfeldttj 8565746
unmodifiable map add
neuenfeldttj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
server/src/main/java/org/opensearch/search/profile/ProfileMetric.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.search.profile; | ||
|
|
||
| import org.opensearch.common.annotation.ExperimentalApi; | ||
|
|
||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * A metric for profiling. | ||
| */ | ||
| @ExperimentalApi | ||
reta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| public abstract class ProfileMetric { | ||
reta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| private final String name; | ||
|
|
||
| public ProfileMetric(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| /** | ||
| * | ||
| * @return name of the metric | ||
| */ | ||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| /** | ||
| * | ||
| * @return map representation of breakdown | ||
| */ | ||
| abstract public Map<String, Long> toBreakdownMap(); | ||
| } | ||
38 changes: 38 additions & 0 deletions
38
server/src/main/java/org/opensearch/search/profile/ProfileMetricUtil.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.search.profile; | ||
|
|
||
| import org.opensearch.search.profile.aggregation.AggregationTimingType; | ||
| import org.opensearch.search.profile.query.QueryTimingType; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Collection; | ||
| import java.util.function.Supplier; | ||
|
|
||
| /** | ||
| * Utility class to provide profile metrics to breakdowns. | ||
| */ | ||
| public class ProfileMetricUtil { | ||
|
|
||
| public static Collection<Supplier<ProfileMetric>> getDefaultQueryProfileMetrics() { | ||
| Collection<Supplier<ProfileMetric>> metrics = new ArrayList<>(); | ||
| for (QueryTimingType type : QueryTimingType.values()) { | ||
| metrics.add(() -> new Timer(type.toString())); | ||
| } | ||
| return metrics; | ||
| } | ||
|
|
||
| public static Collection<Supplier<ProfileMetric>> getAggregationProfileMetrics() { | ||
| Collection<Supplier<ProfileMetric>> metrics = new ArrayList<>(); | ||
| for (AggregationTimingType type : AggregationTimingType.values()) { | ||
| metrics.add(() -> new Timer(type.toString())); | ||
| } | ||
| return metrics; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.