-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[Transform] provide exponential_avg* stats for batch transforms #52041
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
[Transform] provide exponential_avg* stats for batch transforms #52041
Conversation
|
Pinging @elastic/ml-core (:ml/Transform) |
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.
That was quick! LGTM
The client defaults these settings to 0.0 if not set.
Line 77 in fd3dc4d
| this.expAvgCheckpointDurationMs = expAvgCheckpointDurationMs == null ? 0.0 : expAvgCheckpointDurationMs; |
Are you happy with that?
This reverts commit 7d761362519f9e649e801cd7e8a04e56e021509b.
33e0acf to
f9029b0
Compare
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 completely reworked this change. Now it reports the exp averages even for checkpoint 1, that means for batch, too.
Unfortunately the PR got a bit messy, I therefore annotated the relevant bits. Can you review it?
| } | ||
| // If the last checkpoint is now greater than 1, that means that we have just processed the first | ||
| // continuous checkpoint and should start recording the exponential averages | ||
| if (lastCheckpoint != null && lastCheckpoint.getCheckpoint() > 1) { |
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 basically the main change
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.
😁 ha it took a lot of reviewing to get here and it's a one liner
| this(numPages, numInputDocuments, numOutputDocuments, numInvocations, indexTime, searchTime, indexTotal, searchTotal, | ||
| indexFailures, searchFailures, 0.0, 0.0, 0.0); | ||
| } | ||
|
|
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.
^ removed this constructor
| randomBoolean() ? null : randomAlphaOfLength(100), | ||
| randomBoolean() ? null : NodeAttributeTests.randomNodeAttributes(), | ||
| new TransformIndexerStats(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), | ||
| new TransformIndexerStats(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0.0, 0.0, 0.0), |
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.
do not get confused, testBwcWith73: this test BWC with 7.3 where we had no exponential averages, so its ok to construct the stats with 0.0
| }; | ||
| TransformIndexerStats.EXPONENTIAL_AVG_CHECKPOINT_DURATION_MS.getPreferredName(), | ||
| TransformIndexerStats.EXPONENTIAL_AVG_DOCUMENTS_INDEXED.getPreferredName(), | ||
| TransformIndexerStats.EXPONENTIAL_AVG_DOCUMENTS_PROCESSED.getPreferredName(), }; |
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.
^ a bug uncovered by this change: no telemetry for the exponential averages
| 10, // searchFailures | ||
| 11.0, // exponential_avg_checkpoint_duration_ms | ||
| 12.0, // exponential_avg_documents_indexed | ||
| 13.0 // exponential_avg_documents_processed |
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.
^ foolish test, due to the alternative constructor, the test was incomplete
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
| assertThat(transformStats.get("documents_processed"), equalTo(1000)); | ||
| assertThat(transformStats.get("documents_indexed"), equalTo(27)); | ||
| assertThat( | ||
| "exponential_avg_checkpoint_duration_ms is not 0.0", |
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: the message should change '.. is not > 0.0'
| } | ||
| // If the last checkpoint is now greater than 1, that means that we have just processed the first | ||
| // continuous checkpoint and should start recording the exponential averages | ||
| if (lastCheckpoint != null && lastCheckpoint.getCheckpoint() > 1) { |
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.
😁 ha it took a lot of reviewing to get here and it's a one liner
| settings.put("xpack.transform.enabled", false); | ||
| var usageAction = new TransformUsageTransportAction(mock(TransportService.class), null, null, | ||
| mock(ActionFilters.class), null, settings.build(), licenseState, mock(Client.class)); | ||
| var usageAction = new TransformUsageTransportAction( |
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 var is great I'm looking forward to using it. Expecting a backport problem I looked for this class in the 7.x branch and couldn't find it, instead there is TransformFeatureSetTests which looks very similar. Up to you but you might want to sync the 2 branches to make future backports easier.
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 file/class does not exist in 7.x, its based on a re-factoring that was only done on master: #43563
I stumbled upon this several times (e.g. when renaming the feature to transform) and its indeed a troublemaker for backports. The code for 7.x is different, every time I change something here, I need to re-work the PR for 7.x. Fortunately this file doesn't change that often.
|
@hendrikmuhs sorry for the slow review I missed the notification at first |
…tic#52041) provide exponential_avg* stats for batch transforms, avoids confusion why those values are all 0 otherwise
provide exponential_avg* stats for batch transforms, avoids confusion why those values are all 0 otherwise
Dear reviewer, please ignore the 1st commit and start with: 7d76136
Closes #52037