Skip to content

Commit 38e6bbc

Browse files
authored
[ML] Add initial extension point for serverless transform plugin (elastic#96252)
Add the initial extension points for the Transform plugin that will be overridden by the `TransformServerless` plugin. Initially there is is just the one such extension point `includeNodeInfo()` which indicates whether or not node information should be included in the audit messages.
1 parent 2e6834a commit 38e6bbc

File tree

4 files changed

+52
-3
lines changed

4 files changed

+52
-3
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
module org.elasticsearch.transform {
9+
requires org.apache.lucene.analysis.common;
10+
requires org.elasticsearch.geo;
11+
requires org.elasticsearch.logging;
12+
requires org.elasticsearch.cli;
13+
requires org.elasticsearch.xcore;
14+
requires org.elasticsearch.base;
15+
requires org.elasticsearch.grok;
16+
requires org.elasticsearch.server;
17+
requires org.elasticsearch.xcontent;
18+
requires org.apache.httpcomponents.httpcore;
19+
requires org.apache.httpcomponents.httpclient;
20+
requires org.apache.httpcomponents.httpasyncclient;
21+
requires org.apache.httpcomponents.httpcore.nio;
22+
requires org.apache.logging.log4j;
23+
requires org.apache.lucene.core;
24+
requires org.apache.lucene.join;
25+
26+
exports org.elasticsearch.xpack.transform;
27+
exports org.elasticsearch.xpack.transform.action;
28+
exports org.elasticsearch.xpack.transform.checkpoint;
29+
exports org.elasticsearch.xpack.transform.notifications;
30+
exports org.elasticsearch.xpack.transform.persistence;
31+
exports org.elasticsearch.xpack.transform.rest.action;
32+
exports org.elasticsearch.xpack.transform.transforms;
33+
exports org.elasticsearch.xpack.transform.transforms.common;
34+
exports org.elasticsearch.xpack.transform.transforms.latest;
35+
exports org.elasticsearch.xpack.transform.transforms.pivot;
36+
exports org.elasticsearch.xpack.transform.transforms.scheduling;
37+
exports org.elasticsearch.xpack.transform.utils;
38+
}

x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/Transform.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public Collection<Object> createComponents(
248248
client,
249249
xContentRegistry
250250
);
251-
TransformAuditor auditor = new TransformAuditor(client, clusterService.getNodeName(), clusterService);
251+
TransformAuditor auditor = new TransformAuditor(client, clusterService.getNodeName(), clusterService, includeNodeInfo());
252252
Clock clock = Clock.systemUTC();
253253
TransformCheckpointService checkpointService = new TransformCheckpointService(
254254
clock,
@@ -437,4 +437,8 @@ public String getFeatureName() {
437437
public String getFeatureDescription() {
438438
return "Manages configuration and state for transforms";
439439
}
440+
441+
public boolean includeNodeInfo() {
442+
return true;
443+
}
440444
}

x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/notifications/TransformAuditor.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ public class TransformAuditor extends AbstractAuditor<TransformAuditMessage> {
3232

3333
private volatile boolean isResetMode = false;
3434

35-
public TransformAuditor(Client client, String nodeName, ClusterService clusterService) {
35+
private final boolean includeNodeInfo;
36+
37+
public TransformAuditor(Client client, String nodeName, ClusterService clusterService, boolean includeNodeInfo) {
3638
super(
3739
new OriginSettingClient(client, TRANSFORM_ORIGIN),
3840
TransformInternalIndexConstants.AUDIT_INDEX,
@@ -59,6 +61,11 @@ public TransformAuditor(Client client, String nodeName, ClusterService clusterSe
5961
isResetMode = TransformMetadata.getTransformMetadata(event.state()).isResetMode();
6062
}
6163
});
64+
this.includeNodeInfo = includeNodeInfo;
65+
}
66+
67+
public boolean isIncludeNodeInfo() {
68+
return includeNodeInfo;
6269
}
6370

6471
@Override

x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/notifications/MockTransformAuditor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static MockTransformAuditor createMockAuditor() {
5757
private final List<AuditExpectation> expectations;
5858

5959
public MockTransformAuditor(ClusterService clusterService) {
60-
super(mock(Client.class), MOCK_NODE_NAME, clusterService);
60+
super(mock(Client.class), MOCK_NODE_NAME, clusterService, true);
6161
expectations = new CopyOnWriteArrayList<>();
6262
}
6363

0 commit comments

Comments
 (0)