Skip to content

Commit 03bd45f

Browse files
committed
addressed comments
Signed-off-by: Smit Patel <psmit@uber.com>
1 parent b1fbb1a commit 03bd45f

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ prometheus.cluster.settings: false
151151

152152
#### Snapshot metrics
153153

154-
To enable exporting snapshot metrics use:
154+
By default, snapshot metrics are disabled. To enable exporting snapshot metrics use:
155155
```
156156
prometheus.snapshots: true
157157
```

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ tasks.named("check").configure { dependsOn(integTest) }
126126
testingConventions.enabled = false
127127

128128
// Directory for snapshot repository
129-
File repositoryDir = new File(project.buildDir, "shared-repository")
129+
File repositoryDir = new File(project.layout.buildDirectory.get().asFile, "shared-repository")
130130

131131
testClusters.all {
132132
numberOfNodes = 2

src/main/java/org/opensearch/action/NodePrometheusMetricsResponse.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.opensearch.action;
1919

20+
import org.opensearch.Version;
2021
import org.opensearch.action.admin.cluster.health.ClusterHealthResponse;
2122
import org.opensearch.action.admin.cluster.node.info.NodesInfoResponse;
2223
import org.opensearch.action.admin.cluster.node.stats.NodeStats;
@@ -29,6 +30,7 @@
2930
import org.opensearch.core.common.io.stream.StreamOutput;
3031
import org.opensearch.common.settings.ClusterSettings;
3132
import org.opensearch.common.settings.Settings;
33+
import org.opensearch.search.pipeline.SearchPipelineStats;
3234

3335
import java.io.IOException;
3436

@@ -57,7 +59,11 @@ public NodePrometheusMetricsResponse(StreamInput in) throws IOException {
5759
nodeStats = in.readArray(NodeStats::new, NodeStats[]::new);
5860
indicesStats = PackageAccessHelper.createIndicesStatsResponse(in);
5961
clusterStatsData = new ClusterStatsData(in);
60-
snapshotsResponse = new SnapshotsResponse(in);
62+
if (in.getVersion().onOrAfter(Version.V_2_17_1)) {
63+
snapshotsResponse = new SnapshotsResponse(in);
64+
} else {
65+
snapshotsResponse = null;
66+
}
6167
}
6268

6369
/**
@@ -145,6 +151,8 @@ public void writeTo(StreamOutput out) throws IOException {
145151
out.writeArray(nodeStats);
146152
out.writeOptionalWriteable(indicesStats);
147153
clusterStatsData.writeTo(out);
148-
snapshotsResponse.writeTo(out);
154+
if (out.getVersion().onOrAfter(Version.V_2_17_1)) {
155+
snapshotsResponse.writeTo(out);
156+
}
149157
}
150158
}

0 commit comments

Comments
 (0)