-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Resurrect hot_threads routes #73855
Resurrect hot_threads routes #73855
Conversation
warnings_regex: | ||
- ".*hot_?threads.* is a deprecated endpoint.*" | ||
- match: | ||
$body: /:::/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This match
is not my most favorite code ever. I wanted to verify that the response actually resembles a hot_threads
response, but the regex match has to be on the first line and there's not all that much for us to match on there:
::: {runTask-0}{rNO3-C-BStGLmQ_xUdIecA}{PiMCJKfOSnuRkp0Uk1E7ig}{127.0.0.1}{127.0.0.1:9300}{cdfhilmrstw}{ml.machine_memory=68719476736, xpack.installed=true, testattr=test, ml.max_open_jobs=512, ml.max_jvm_size=536870912}
Hot threads at 2021-06-07T15:44:46.079Z, interval=500ms, busiestThreads=3, ignoreIdleThreads=true:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, there is a :::
so I'm matching on that. A reasonable alternative would be to cut the match entirely and just run with "any non-error response is good enough".
One point of discussion:
Given that the response is not JSON -- should |
It's legitimate, although surprising, according to RFC7231 section 5.3.2:
|
"url":{ | ||
"paths":[ | ||
{ | ||
"path":"/_cluster/nodes/hotthreads", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it more correct to re-introduce this path (and the like) as deprecated in the spec for 7.x and add the allowed warning (for any tests that call this API) ?
This would allow you to avoid introducing the spec only for compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that idea! Just to make sure I'm following -- that'd be a PR pointed at 7.x (no version that hits master) that adds these as deprecated endpoints to the rest-api-spec
, and then in this PR we wouldn't need a new test or any specs, because this would all execute automatically by way of the yamlRestCompatTest
tests.
Is there any downside to adding these as deprecated in 7.x? I'm thinking, for example, that perhaps the autogenerated client code might actually start using them (if so, that'd be strictly worse, and we probably wouldn't want to go this way).
@pgomulka what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like that idea too!
if a test client will use it, maybe we can ignore the warning in 7.x for this? Like we do for types removal in 7.x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that'd be a PR pointed at 7.x (no version that hits master) that adds these as deprecated endpoints to the rest-api-spec,
yes, that is what i meant. I think it works well in this case (and any other one off cases) since it probably should have been that way from the start and should have minimal pollution in 7.x.
However, I don't think this should be a rule of thumb for all missing paths. For example, for the _xpack/
prefix i can see the argument for not polluting 7.x since there are so many, somewhat inconsistent (depending on when it was added), and has a lot of associated tests that would need to allow warnings.
Pinging @elastic/clients-team (Team:Clients) |
After a discussion with @joegallo about route deprecations and how clients handle them: a client selects the route that matches the parameters specified by the application (e.g. non |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
import static org.elasticsearch.rest.RestRequest.Method.GET; | ||
|
||
public class RestNodesHotThreadsAction extends BaseRestHandler { | ||
|
||
private static final String formatDeprecatedMessageWithoutNodeID = "[%s] is a deprecated endpoint. " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a thought. we could just use one message for all. We have a used endpoint as a key, API_GET_/_nodes/{nodeid}/hot_threads
not as readable as here, but might save some effort
but it looks good now too!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I basically did a revert + edit of the commit that removed the apis, so it was cheap to do it as is (and keeps the code mostly in line with the way it is on 7.x).
"url":{ | ||
"paths":[ | ||
{ | ||
"path":"/_cluster/nodes/hotthreads", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like that idea too!
if a test client will use it, maybe we can ignore the warning in 7.x for this? Like we do for types removal in 7.x
re |
We can rely on the one from 7.x, which already includes the deprecated routes. But since it includes both the deprecated routes and the non-deprecated routes, we need to switch the warnings_regex to an allowed_warnings_regex.
Some enterprising developer liked this conversation so much they went back in time and made 7.x already have those routes in there as deprecated. So I've dropped my copy from this PR and switched the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Related to #51816 / #68905. Also related to #52640 / #55109.
Adds back the various removed
hot_threads
routes when using rest compatibility for a request.