Skip to content

Commit a25f06d

Browse files
authored
Deprecate Repository Stats API (#62297)
This commit deprecates the Repository Stats API added in 7.8.0 as an experimental API behind a feature flag. The goal is to deprecate this API in 7.10.0 and remove it in a follow up PR in 8.0.0. This API is now superseded by the Repositories Metering API.
1 parent 2bffe9c commit a25f06d

File tree

10 files changed

+51
-4
lines changed

10 files changed

+51
-4
lines changed

docs/reference/migration/migrate_8_0/snapshots.asciidoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,16 @@ restore snapshot API now rejects requests that include a `settings` value.
130130
Discontinue use of the `settings` parameter in restore
131131
snapshot request. Requests that include these parameters will return an error.
132132
====
133+
134+
.Repository Stats API is deprecated
135+
[%collapsible]
136+
====
137+
*Details* +
138+
The Repository Stats API has been introduced in 7.8.0 as an experimental API
139+
and was never released. This API is superseded by the <<repositories-metering-apis,Repositories Metering APIs>>
140+
added in 7.10.0 which should be used instead. The Repository Stats API is
141+
deprecated starting 7.10.0 and will be removed in 8.0.0.
142+
143+
*Impact* +
144+
Use the <<repositories-metering-apis,Repositories Metering APIs>>.
145+
====

x-pack/plugin/searchable-snapshots/qa/rest/src/test/resources/rest-api-spec/test/repository_stats.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ teardown:
6666
---
6767
"Tests repository stats":
6868
- skip:
69-
version: " - 7.99.99"
70-
reason: searchable snapshots introduced in 7.8.0 (8.0.0 currently, but adapt after backport to 7.x)
69+
version: " - 7.9.99"
70+
reason: Deprecated in 7.10.0 and removed in 8.0.0, will not issue warnings before 7.10.0
71+
features: "warnings"
7172

7273
- do:
7374
snapshot.restore:
@@ -76,6 +77,8 @@ teardown:
7677
wait_for_completion: true
7778

7879
- do:
80+
warnings:
81+
- "[/_snapshot/{repository}/_stats] is deprecated, use the Repositories Metering API [/_nodes/{nodeId}/_repositories_metering] in the future."
7982
searchable_snapshots.repository_stats:
8083
repository: repository-fs
8184

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/RepositoryStatsAction.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
import org.elasticsearch.action.ActionType;
1010

11+
/**
12+
* @deprecated This action is superseded by the Repositories Metering action
13+
*/
14+
@Deprecated
1115
public class RepositoryStatsAction extends ActionType<RepositoryStatsResponse> {
1216

1317
public static final RepositoryStatsAction INSTANCE = new RepositoryStatsAction();

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/RepositoryStatsNodeRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import java.io.IOException;
1414

15+
@Deprecated
1516
public class RepositoryStatsNodeRequest extends TransportRequest {
1617

1718
private final String repository;

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/RepositoryStatsNodeResponse.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import java.io.IOException;
1818

19+
@Deprecated
1920
public class RepositoryStatsNodeResponse extends BaseNodeResponse implements ToXContentObject {
2021

2122
private final RepositoryStats repositoryStats;

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/RepositoryStatsRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import java.io.IOException;
1414

15+
@Deprecated
1516
public class RepositoryStatsRequest extends BaseNodesRequest<RepositoryStatsRequest> {
1617

1718
private final String repository;

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/RepositoryStatsResponse.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.io.IOException;
1919
import java.util.List;
2020

21+
@Deprecated
2122
public class RepositoryStatsResponse extends BaseNodesResponse<RepositoryStatsNodeResponse> implements ToXContentObject {
2223

2324
private final RepositoryStats globalStats;

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/TransportRepositoryStatsAction.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
import java.util.List;
2626
import java.util.Objects;
2727

28+
/**
29+
* @deprecated This API is superseded by the Repositories Metering API
30+
*/
31+
@Deprecated
2832
public class TransportRepositoryStatsAction extends TransportNodesAction<
2933
RepositoryStatsRequest,
3034
RepositoryStatsResponse,

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/rest/RestRepositoryStatsAction.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,35 @@
1919

2020
import static org.elasticsearch.rest.RestRequest.Method.GET;
2121

22+
/**
23+
* @deprecated This API is superseded by the Repositories Metering API
24+
*/
25+
@Deprecated
2226
public class RestRepositoryStatsAction extends BaseRestHandler {
2327

28+
private static final String ENDPOINT = "/_snapshot/{repository}/_stats";
29+
2430
@Override
2531
public String getName() {
2632
return "repository_stats_action";
2733
}
2834

2935
@Override
3036
public List<RestHandler.Route> routes() {
31-
return Collections.singletonList(new RestHandler.Route(GET, "/_snapshot/{repository}/_stats"));
37+
return Collections.emptyList();
38+
}
39+
40+
@Override
41+
public List<DeprecatedRoute> deprecatedRoutes() {
42+
return List.of(
43+
new DeprecatedRoute(
44+
GET,
45+
ENDPOINT,
46+
'['
47+
+ ENDPOINT
48+
+ "] is deprecated, use the Repositories Metering API [/_nodes/{nodeId}/_repositories_metering] in the future."
49+
)
50+
);
3251
}
3352

3453
@Override

x-pack/plugin/src/test/resources/rest-api-spec/api/searchable_snapshots.repository_stats.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"searchable_snapshots.repository_stats": {
33
"documentation": {
44
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-apis.html",
5-
"description": "Retrieve usage statistics about a snapshot repository."
5+
"description": "DEPRECATED: This API is replaced by the Repositories Metering API."
66
},
77
"stability": "experimental",
88
"url": {

0 commit comments

Comments
 (0)