- Notifications
You must be signed in to change notification settings - Fork 25.6k
New HTTP info (/_info/http) endpoint #96198
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
Conversation
add all the needed architecture to support basic stats
| Documentation preview: |
| Pinging @elastic/es-data-management (Team:Data Management) |
| Hi @HiDAl, I've created a changelog YAML for you. |
| Hi @HiDAl, I've updated the changelog YAML for you. |
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.
Looks pretty good to me. I left a few comments.
| | ||
| import static org.elasticsearch.xcontent.ToXContent.EMPTY_PARAMS; | ||
| | ||
| public abstract class AbstractStatsAction extends BaseRestHandler { |
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.
Are you anticipating more stats like this, and that's why there is an abstract class with just one class that extends it?
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.
yes, I'll update the tickets with extra information about this.
| | ||
| @Override | ||
| public ChunkedToXContent xContentChunks(NodesStatsResponse nodesStatsResponse) { | ||
| return nodesStatsResponse.getNodes().stream().map(NodeStats::getHttp).reduce(new HttpStats(List.of(), 0, 0), HttpStats::merge); |
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.
Also straightforward but maybe worth a unit test
| | ||
| `local_address`:: | ||
| (string) | ||
| Local address for the HTTP client. |
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.
We probably ought to use the word "connection" instead of "client" in this section, right? The reason I think this is that (for example) this is the local address for the connection (it's the one on the elasticsearch server), but it's the remote connection for the client. Or maybe we ought to change this to client_address and elasticsearch_address or something?
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 just copied the same existent doc of _nodes/_stats/http, but I will update both
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 checking out the whole section is called clients and provides information about them. For instance:
`opened_time_millis`:: (integer) Time at which the client opened the connection. so, changing to connection would imply deeper changes.
About changing the fields, I think it's not possible because this is using the old nodeStats API, which already has these names.
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.
It makes sense that we can't change the fields. But we shouldn't just reuse documentation that's wrong, right? local_address is not the Local address for the HTTP client. It's the address that's local to the machine gathering the information, right? For example in the description for request_size_bytes we say Cumulative size in bytes of all requests from this client. So in that case we're using client to mean the thing making the requests. When we say Local address for the HTTP client., are we also using the word client to mean "the thing receiving the connection from the other client"? I think at a minimum we ought to improve the descriptions for local_address and remote_address (and probably as a followup fix the documentation for the _nodes API, 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.
oooh now got it, I didn't fully understand what you said. Will update
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.
@masseyke both updated. Thanks!
| | ||
| import java.util.List; | ||
| | ||
| public class HttpStatsAction extends AbstractStatsAction { |
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 don't know if the convention is documented anywhere, but almost all rest handlers start with Rest and end with Action, like RestHttpStatsAction. Probably worth doing here -- it makes it easier to find the right rest handler.
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.
mmm right. will update!
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.
Looks good to me.
This PR adds a new endpoint under
_info/http. This endpoint summarises the HTTP stats of all the nodes into one big response, at cluster level. Compared with_nodes/_stats, it lacks thenodesdimension.Response example:
{ "cluster_name": "runTask", "http": { "current_open": 1, "total_opened": 53, "clients": [ { "id": 1556275969, "local_address": "127.0.0.1:9200", "remote_address": "127.0.0.1:50883", "last_uri": "/_http_stats", "opened_time_millis": 1684319173046, "closed_time_millis": 1684319173046, "last_request_time_millis": 1684319173046, "request_count": 1, "request_size_bytes": 0 }, { "id": 414091317, "local_address": "127.0.0.1:9200", "remote_address": "127.0.0.1:50884", "last_uri": "/_http_stats", "opened_time_millis": 1684319173855, "closed_time_millis": 1684319173855, "last_request_time_millis": 1684319173855, "request_count": 1, "request_size_bytes": 0 }, ... ] } }It also introduces a new
AbstractInfoActionclass which will be used to implement the next work about the extraction of statsCloses #95391