-
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
[ML] Fractions API fix and jest unit tests for APM Latency Correlations. #103907
[ML] Fractions API fix and jest unit tests for APM Latency Correlations. #103907
Conversation
acb70ac
to
2642aab
Compare
Pinging @elastic/ml-ui (:ml) |
Pinging @elastic/apm-ui (Team:apm) |
}, | ||
}, | ||
size: 1000, | ||
track_total_hits: 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.
Looking at this again, I think we can remove this track_total_hits
completely because we now use the totalDocCount
from fetchTransactionDurationFractions
for the histograms instead. This is something I should have removed in the last PR.
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.
Good catch, removed it in f42dda2.
| undefined; | ||
|
||
// fetchTransactionDurationPercentiles | ||
if (req?.body?.aggs?.transaction_duration_percentiles !== undefined) { |
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.
nit: can we do an assertion for req?.body?.aggs?
before these if statements so we don't have to duplicate these checks again?
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.
Refactored in 16ef560.
Thanks for adding the unit tests. Changes LGTM 🎉 , just left a few minor comments. |
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.
Thanks for adding these. We usually don't add ()
in descriptions when describing functions so you can take those out if you like.
import { getQueryWithParams } from './get_query_with_params'; | ||
|
||
describe('correlations', () => { | ||
describe('getQueryWithParams()', () => { |
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.
describe('getQueryWithParams()', () => { | |
describe('getQueryWithParams', () => { |
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.
Thanks, updated in 02a1fd2.
); | ||
}); | ||
|
||
it('performs a client search with params when no ID is provided', async () => { |
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 usually break these up if there's a when
in there:
it('performs a client search with params when no ID is provided', async () => { | |
describe('when no ID is provided', () => { | |
it('performs a client search with params', async () => { |
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.
Updated in 44d5cc5.
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @walterra |
Adds jest unit tests for APM Latency Correlations code. Writing the tests surfaced some minor glitches fixed as part of this PR: - Fixes a typo in the name for the fetchTransactionDurationPercentiles() function. - Avoids adding a @timestamp filter if neither start/end are set as parameters for getQueryWithParams(). - Adds a check to only push to ranges arrays if it's length is already greater than 0. - Makes the check against from more strict otherwise it wouldn't be added as an attribute if 0. - Fixes progress calculation for field/value pair fetching. - Removes leading 0 from fractions since an ES update got merged. - Removes deprecated use of track_total_hits.
Adds jest unit tests for APM Latency Correlations code. Writing the tests surfaced some minor glitches fixed as part of this PR: - Fixes a typo in the name for the fetchTransactionDurationPercentiles() function. - Avoids adding a @timestamp filter if neither start/end are set as parameters for getQueryWithParams(). - Adds a check to only push to ranges arrays if it's length is already greater than 0. - Makes the check against from more strict otherwise it wouldn't be added as an attribute if 0. - Fixes progress calculation for field/value pair fetching. - Removes leading 0 from fractions since an ES update got merged. - Removes deprecated use of track_total_hits.
Adds jest unit tests for APM Latency Correlations code. Writing the tests surfaced some minor glitches fixed as part of this PR: - Fixes a typo in the name for the fetchTransactionDurationPercentiles() function. - Avoids adding a @timestamp filter if neither start/end are set as parameters for getQueryWithParams(). - Adds a check to only push to ranges arrays if it's length is already greater than 0. - Makes the check against from more strict otherwise it wouldn't be added as an attribute if 0. - Fixes progress calculation for field/value pair fetching. - Removes leading 0 from fractions since an ES update got merged. - Removes deprecated use of track_total_hits. Co-authored-by: Walter Rafelsberger <[email protected]>
Adds jest unit tests for APM Latency Correlations code. Writing the tests surfaced some minor glitches fixed as part of this PR: - Fixes a typo in the name for the fetchTransactionDurationPercentiles() function. - Avoids adding a @timestamp filter if neither start/end are set as parameters for getQueryWithParams(). - Adds a check to only push to ranges arrays if it's length is already greater than 0. - Makes the check against from more strict otherwise it wouldn't be added as an attribute if 0. - Fixes progress calculation for field/value pair fetching. - Removes leading 0 from fractions since an ES update got merged. - Removes deprecated use of track_total_hits. Co-authored-by: Walter Rafelsberger <[email protected]>
Summary
Follow up to #99905.
Adds jest unit tests for APM Latency Correlations code.
Writing the tests surfaced some minor glitches fixed as part of this PR:
fetchTransactionDurationPercentiles()
function.@timestamp
filter if neitherstart/end
are set as parameters forgetQueryWithParams()
.from
more strict otherwise it wouldn't be added as an attribute if 0.fractions
and bucket doc count have the same lengths inbucket_count_ks_test
elasticsearch#74624 got merged.track_total_hits
.Checklist