Skip to content

Commit

Permalink
Deprecate Repository Stats API (#62297) (#62308)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tlrx authored Sep 14, 2020
1 parent 875af1c commit 9e38dd0
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 4 deletions.
13 changes: 13 additions & 0 deletions docs/reference/migration/migrate_7_10.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,16 @@ value of 300, which amounts to 5 minutes. This helps ensure that, if
explicitly configured, only reasonable values are set.

//end::notable-breaking-changes[]

.Repository Stats API is deprecated
[%collapsible]
====
*Details* +
The Repository Stats API has been introduced in 7.8.0 as an experimental API
and was never released. This API is superseded by the <<repositories-metering-apis,Repositories Metering APIs>>
added in 7.10.0 which should be used instead. The Repository Stats API is
deprecated starting 7.10.0 and will be removed in 8.0.0.
*Impact* +
Use the <<repositories-metering-apis,Repositories Metering APIs>>.
====
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ teardown:
---
"Tests repository stats":
- skip:
version: " - 7.99.99"
reason: searchable snapshots introduced in 7.8.0 (8.0.0 currently, but adapt after backport to 7.x)
version: " - 7.9.99"
reason: Deprecated in 7.10.0 and removed in 8.0.0, will not issue warnings before 7.10.0
features: "warnings"

- do:
snapshot.restore:
Expand All @@ -76,6 +77,8 @@ teardown:
wait_for_completion: true

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

import org.elasticsearch.action.ActionType;

/**
* @deprecated This action is superseded by the Repositories Metering action
*/
@Deprecated
public class RepositoryStatsAction extends ActionType<RepositoryStatsResponse> {

public static final RepositoryStatsAction INSTANCE = new RepositoryStatsAction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.io.IOException;

@Deprecated
public class RepositoryStatsNodeRequest extends BaseNodeRequest {

private final String repository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import java.io.IOException;

@Deprecated
public class RepositoryStatsNodeResponse extends BaseNodeResponse implements ToXContentObject {

private final RepositoryStats repositoryStats;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.io.IOException;

@Deprecated
public class RepositoryStatsRequest extends BaseNodesRequest<RepositoryStatsRequest> {

private final String repository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.io.IOException;
import java.util.List;

@Deprecated
public class RepositoryStatsResponse extends BaseNodesResponse<RepositoryStatsNodeResponse> implements ToXContentObject {

private final RepositoryStats globalStats;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
import java.util.List;
import java.util.Objects;

/**
* @deprecated This API is superseded by the Repositories Metering API
*/
@Deprecated
public class TransportRepositoryStatsAction extends TransportNodesAction<
RepositoryStatsRequest,
RepositoryStatsResponse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,35 @@

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

/**
* @deprecated This API is superseded by the Repositories Metering API
*/
@Deprecated
public class RestRepositoryStatsAction extends BaseRestHandler {

private static final String ENDPOINT = "/_snapshot/{repository}/_stats";

@Override
public String getName() {
return "repository_stats_action";
}

@Override
public List<RestHandler.Route> routes() {
return Collections.singletonList(new RestHandler.Route(GET, "/_snapshot/{repository}/_stats"));
return Collections.emptyList();
}

@Override
public List<DeprecatedRoute> deprecatedRoutes() {
return Collections.singletonList(
new DeprecatedRoute(
GET,
ENDPOINT,
'['
+ ENDPOINT
+ "] is deprecated, use the Repositories Metering API [/_nodes/{nodeId}/_repositories_metering] in the future."
)
);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"searchable_snapshots.repository_stats": {
"documentation": {
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-apis.html",
"description": "Retrieve usage statistics about a snapshot repository."
"description": "DEPRECATED: This API is replaced by the Repositories Metering API."
},
"stability": "experimental",
"url": {
Expand Down

0 comments on commit 9e38dd0

Please sign in to comment.