-
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
[APM] Adds support for metrics for latency distribution histogram #136083
[APM] Adds support for metrics for latency distribution histogram #136083
Conversation
Pinging @elastic/apm-ui (Team:apm) |
@elasticmachine merge upstream |
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. Just a nit and a suggestion.
} | ||
}, | ||
}; | ||
console.log(JSON.stringify(params)); |
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 think you can delete this.
if (eventType === ProcessorEvent.metric) { | ||
return TRANSACTION_DURATION_HISTOGRAM; | ||
} | ||
if (eventType === ProcessorEvent.span) { | ||
return SPAN_DURATION; | ||
} | ||
return TRANSACTION_DURATION; |
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.
You could have used a switch here, couldn't you? Up to you to do this change though!
if (eventType === ProcessorEvent.metric) { | |
return TRANSACTION_DURATION_HISTOGRAM; | |
} | |
if (eventType === ProcessorEvent.span) { | |
return SPAN_DURATION; | |
} | |
return TRANSACTION_DURATION; | |
switch(eventType){ | |
case ProcessorEvent.metric: | |
return TRANSACTION_DURATION_HISTOGRAM; | |
case ProcessorEvent.span: | |
return SPAN_DURATION; | |
default: | |
return TRANSACTION_DURATION; | |
} |
return getOverallLatencyDistribution({ | ||
setup, | ||
eventType: ProcessorEvent.transaction, | ||
eventType: searchAggregatedTransactions |
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'm not sure if this is enough. I think you also need a filter for { exists: { field: 'transaction.duration.histogram' } }
. We have a helper function for that purpose.
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 call to getSearchAggregatedTransactions
on line 65 does call the helper getHasAggregatedTransactions
which filters for this field.
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 only checks for the existence. The actual search itself needs a filter on { exists: { field: 'transaction.duration.histogram' } }
otherwise it will run over all metric documents.
|
||
export function getDurationField(eventType: ProcessorEvent) { | ||
if (eventType === ProcessorEvent.metric) { | ||
return TRANSACTION_DURATION_HISTOGRAM; |
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 think ProcessorEvent
is the right abstraction here anymore. We should be more specific, e.g.:
transaction_events
span_events
transaction_metrics
service_destination_metrics
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 new util function was just some code cleanup since we had repeated switching logic to for the duration field between the latency distribution chart and the correlations distribution charts. If the abstractions were to change, we would want to tease apart the correlations from the regular latency distribution chart (1st tab vs 2nd & 3rd tabs) into distinct functions for their own use cases. We could consider this tech debt and out of scope for this bug fix.
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 issue is that eventType
in this case signals what data we want to show, not what documents we should use to display it. Transaction latency data can be based on both ProcessorEvent.transaction and ProcessorEvent.metric, and similarly, exit span latency data can be based on both ProcessorEvent.span and ProcessorEvent.metric. I don't think we should conflate those concepts.
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
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.
@ogupte IMHO this wasn't ready to merge, I think there's some issues that need to be addressed as you can see from my feedback. Do you mind reverting and re-submitting? I'd prefer that over a PR on top of this because that makes it harder to review the changes as a whole.
Closes #132394
xpack.apm.searchAggregatedTransactions: never
:xpack.apm.searchAggregatedTransactions: auto
: