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

[Profiling] Use CancellableTask internally #107139

Merged

Conversation

danielmitterdorfer
Copy link
Member

With this commit we eagerly cast the task provided to our central transport action to a CancellableTask so we can simplify cancellation checks while the action is being executed.

Relates #107037

With this commit we eagerly cast the task provided to our central
transport action to a CancellableTask so we can simplify cancellation
checks while the action is being executed.

Relates elastic#107037
@danielmitterdorfer danielmitterdorfer added >non-issue :UniversalProfiling/Application Elastic Universal Profiling REST APIs and infrastructure v8.14.0 labels Apr 5, 2024
@elasticsearchmachine elasticsearchmachine added the Team:obs-knowledge Meta label for Observability Knowledge team label Apr 5, 2024
@danielmitterdorfer
Copy link
Member Author

This PR is a follow-up based on a comment from David in #107037 (comment).

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/obs-knowledge-team (Team:obs-knowledge)

licenseChecker.requireSupportedLicense();
assert task instanceof CancellableTask;
Copy link
Member Author

Choose a reason for hiding this comment

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

using asserts here might look unusual but that is the established practice in the code base.

Copy link
Contributor

Choose a reason for hiding this comment

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

++ it indicates to the reader that task is always a CancellableTask - without it a reader might think that the cast could throw an exception which is to be handled elsewhere.

Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

LGTM

licenseChecker.requireSupportedLicense();
assert task instanceof CancellableTask;
Copy link
Contributor

Choose a reason for hiding this comment

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

++ it indicates to the reader that task is always a CancellableTask - without it a reader might think that the cast could throw an exception which is to be handled elsewhere.

@danielmitterdorfer
Copy link
Member Author

Thanks for quick review @DaveCTurner, much appreciated.

@danielmitterdorfer danielmitterdorfer merged commit 18be49b into elastic:main Apr 5, 2024
14 checks passed
@danielmitterdorfer danielmitterdorfer deleted the profiling-cancel branch April 5, 2024 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue Team:obs-knowledge Meta label for Observability Knowledge team :UniversalProfiling/Application Elastic Universal Profiling REST APIs and infrastructure v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants