-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Add relevant attributes to shard search latency APM metrics #134798
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 relevant attributes to shard search latency APM metrics #134798
Conversation
We already record latency of the query and fetch phase as APM metrics. We'd like to be able to slice such latencies based on some recurring categories of the request: - does it have agg or hit only? - is it sorted by field or by score? - does it have a time range filter? - does it target user data or internal indices? This commit introduces introspection for a shard search request and stores the extracted attributes together with the shard phase latency metrics. This builds on top of elastic#134232 to use the same infra and store the same attributes for shard level latency metrics.
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
Hi @javanna, I've created a changelog YAML for you. |
shardSearchRequest.shardId().getIndexName() | ||
); | ||
boolean isSystem = ((EsExecutors.EsThread) Thread.currentThread()).isSystem(); | ||
attributes.put(SYSTEM_THREAD_ATTRIBUTE_NAME, isSystem); |
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.
The isSystem attribute I moved here from the ShardSearchPhaseAPMMetrics class.
// don't track unbounded ranges, they translate to either match_none if the field does not exist | ||
// or match_all if the field is mapped | ||
case TIMESTAMP -> { | ||
if (range.to() != null || range.from() != null) { |
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 is something I discovered as part of working on this chance: rewrite for range queries is a bit funky (I plan on fixing that as a follow-up). A range query may rewrite to one without bounds, if all data is within the range. In that case, it is equivalent to a match_all hence I don't report it as a range. I decided to rather report only "true" range queries at the shard level.
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 LGTM, also very nice to have got rid of yet another ThreadLocal
:-)
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 (once CI is happy :) ), thanks Luca
We recently added relevant attributes to the existing shard search latency metrics (elastic#134798). This commit introduces an additional attribute that analyzes the parsed time range filter against the @timestamp field and reports back whether it is within the last 15 minutes, last hour, last 12 hours, last day, last three days, last seven days, or last 14 days.
#135524) We recently added relevant attributes to the existing shard search latency metrics (#134798). This commit introduces an additional attribute that analyzes the parsed time range filter against the @timestamp field and reports back whether it is within the last 15 minutes, last hour, last 12 hours, last day, last three days, last seven days, or last 14 days.
We already record latency of the query and fetch phase as APM metrics. We'd like to be able to slice such latencies based on some recurring categories of the request:
This commit introduces introspection for a shard search request and stores the extracted attributes together with the shard phase latency metrics.
This builds on top of #134232 to use the same infra and store the same attributes for shard level latency metrics.
Here are some of the differences of the attributes extracted at the shard level compared to those extracted at the coord level, for the same query: