-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Add request duration to the Elasticsearch response logs #124208
Comments
Pinging @elastic/kibana-core (Team:Core) |
In #119062, you said
Is the implementation going to be performed in the client itself, or is this issue about a custom implementation in Kibana? |
@delvedor would evaluate the possibility of implementing this logic on the transport level. elastic/elastic-transport-js#35 Depending on his decision, we either rely on the transport implementation or implement it in Kibana. |
@delvedor doesn't think it's worth adding this feature on the transport level due to performance overhead. See elastic/elastic-transport-js#40 class KibanaTransport extends Transport {
async request (params, options = {}) {
options.context = { requestStartTimestamp: Date.now() }
return super.request(params, options)
}
}
// in obs events:
const took = Date.now()- event.meta.context.startTime; Although, it would be awesome if we find a way to calculate the duration only once in the Core. |
@mshustov, keep us posted, we will go with our custom wrapper method at this time, but as soon as you have something to use, we can look into refactoring.
Our intent for stopping slow queries is to stop them when task manager determines the task ran for too long (abort existing searches when task manager sends a cancel execution signal). So I believe an event approach may not suit this use case but not sure. cc @elastic/response-ops-execution |
elastic/elastic-transport-js#40 is imho the exact implementation we'd like to have. If we want to implement the same feature from within core, to have something like const { body, meta } = await client.ping({}, { meta: true });
const { duration } = meta; We can for sure implement the logic in our custom Also, if this field is added from within our transport, I wonder if it would also be added to the events which are, from my understanding, emitted from lower (but need to confirm that, cc @delvedor) client.diagnostic.on('response', (error, event) => {
// will event.meta.duration be populated here?
}); |
Parent was closed, closing this one too |
You can find the motivation description and proposed format in the parent issue #119062.
This issue is created to track implementation progress.
The text was updated successfully, but these errors were encountered: