-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Create GET _cat/transforms API Issue #53643
Conversation
…rch server common package for reuse
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.
Thanks @zacharymorn for taking this on :).
|
||
|
||
import org.elasticsearch.common.Strings; | ||
package org.elasticsearch.common; |
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.
Since only xpack
things use this class, I think keeping it in xpack
makes sense for now.
Probably in org.elasticsearch.xpack.core.common
.
If things outside of xpack
need this code, it can probably be moved then.
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.
Makes sense. I've moved it back there.
} | ||
|
||
GetTransformAction.Request request = new GetTransformAction.Request(id); | ||
request.setAllowNoResources(restRequest.paramAsBoolean(ALLOW_NO_MATCH.getPreferredName(), 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.
I think we should also allow the page params to be set. Without setting size
or from
there are limitations around how many transforms can be returned with this API.
Both GetTransformAction.Request
and GetTransformStatsAction.Request
allow paging parameters to be set.
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.
Done.
@Override | ||
protected void documentation(StringBuilder sb) { | ||
sb.append("/_cat/transform\n"); | ||
sb.append("_cat/transform/{" + TransformField.TRANSFORM_ID + "}\n"); |
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.
sb.append("_cat/transform/{" + TransformField.TRANSFORM_ID + "}\n"); | |
sb.append("/_cat/transform/{" + TransformField.TRANSFORM_ID + "}\n"); |
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.
Done.
.setAliases("d") | ||
.build()) | ||
.addCell("transform_type", | ||
TableColumnAttributeBuilder.builder("batch or continues 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.
TableColumnAttributeBuilder.builder("batch or continues transform") | |
TableColumnAttributeBuilder.builder("batch or continuous 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.
Ops. Fixed.
.build()) | ||
.addCell("transform_type", | ||
TableColumnAttributeBuilder.builder("batch or continues transform") | ||
.setAliases("sc") |
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.
.setAliases("sc") | |
.setAliases("tt") |
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.
Fixed.
.addCell(config.getDestination().getIndex()) | ||
.addCell(config.getDescription()) | ||
.addCell(config.getSyncConfig() == null ? "batch" : "continuous") | ||
.addCell(config.getFrequency() == null ? "one-time" : config.getFrequency()) |
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 not strictly true.
If the transform runs into problems for some reason (intermittent cluster issues), it will retry from its last known position at this given frequency.
If the frequency is null
, the default value is: TimeValue.timeValueMillis(60000)
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.
Done. I assume in the case of user not providing frequency setting, and the batch transform runs to completion successfully, we should still output TimeValue.timeValueMillis(60000)
as frequency value right?
.addCell("frequency", | ||
TableColumnAttributeBuilder.builder("frequency of transform") | ||
.setAliases("f") | ||
.build()) |
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.
We should also add PivotConfig#getMaxPageSearchSize()
. This should be accessible in the transform config under TransformConfig#getPivotConfig
.
It's default value is 500
.
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.
Done.
.addCell(checkpointingInfo == null ? null : checkpointingInfo.getChangesLastDetectedAt()) | ||
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getSearchTotal()) | ||
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getSearchFailures()) | ||
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getSearchTime()) |
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.
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getSearchTime()) | |
.addCell(transformIndexerStats == null ? null : TimeValue.timeValueMillis(transformIndexerStats.getSearchTime())) |
It will be helpful to make these time related statistics TimeValue
objects. That way they can take advantage of the formatting options.
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.
Done.
|
||
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getIndexTotal()) | ||
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getIndexFailures()) | ||
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getIndexTime()) |
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.
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getIndexTime()) | |
.addCell(transformIndexerStats == null ? null : TimeValue.timeValueMillis(transformIndexerStats.getIndexTime())) |
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.
Done.
I see that for transformIndexerStats.getExpAvgCheckpointDurationMs()
below, it is returning a double
object, but TimeValue#timeValueMillis
only takes in long
. Should I update it as well at the cost of losing precision by converting double
to long
, or it's fine to leave it as is?
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 would leave the double as is. Just like you did :).
It might be interesting to have factional TimeValue
objects in the future. So we could get human friendly output like 10.8ms
:D.
.addCell("dest_index", | ||
TableColumnAttributeBuilder.builder("destination index") | ||
.setAliases("di", "destIndex") | ||
.build()) |
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 pipeline
that the transform references should also be included. DestConfig#getPipeline()
.
Its nullable
with no default value.
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.
Done.
Updated testing with 5 transforms: CAT all transforms
CAT with
|
jenkins test this please |
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.
Once CI passes, we will be good to merge.
Thanks so much for getting this done very quickly :)
@elasticmachine update branch |
jenkins test this please |
Adds new` _cat/transform` and `_cat/transform/{transform_id}` endpoints.
Sure no problem, my pleasure & I learnt a lot from this! |
Adds new
_cat/transform
and_cat/transform/{transform_id}
endpoints.Testing Done:
CAT single transform
CAT all transforms
Help Output
Columns selection
Display results in json / yaml formats
JSON
YAML
Closes #51412