-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add repositories metering API #60371
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
Merged
Merged
Changes from 34 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
3e77c52
Add repositories stats tracking API
fcofdez fc7ca20
Merge remote-tracking branch 'origin/master' into metering
fcofdez 528da9a
Add docs
fcofdez fcc15c8
Merge remote-tracking branch 'origin/master' into metering
fcofdez f71fabb
Fix build scripts
fcofdez 767edd6
Address first round of review comments
fcofdez 20a1dfe
Merge remote-tracking branch 'origin/master' into metering-api-new
fcofdez 02c5d93
Simplify TransportActions and return repositories stats during archive
fcofdez a3ce634
Merge remote-tracking branch 'origin/master' into metering-api-new
fcofdez 158ad06
Merge remote-tracking branch 'origin/master' into metering-api-new
fcofdez b4bb846
Keep track of cluster version on RepositoryStatsSnapshot.
fcofdez 81b2bf7
Merge remote-tracking branch 'origin/master' into metering-api-new
fcofdez d0a5995
Fix test
fcofdez 278eaa7
Merge remote-tracking branch 'origin/master' into metering-api-new
fcofdez d8aea38
Rename repositories-stats to repositories-metering
fcofdez 7e4ab0c
Fix styleCheck
fcofdez 47c18fa
Merge remote-tracking branch 'origin/master' into metering-api-new
fcofdez d7020cb
Rename operation names on repositories metering
fcofdez ddc2cc1
Fix tests
fcofdez 1f93514
Improve docs
fcofdez fdce53f
Merge remote-tracking branch 'origin/master' into metering-api-new
fcofdez ee0c47b
Merge remote-tracking branch 'origin/master' into metering-api-new
fcofdez 2374fd1
Merge remote-tracking branch 'origin/master' into metering-api-new
fcofdez 449069a
Address review comments
fcofdez 413472a
Merge remote-tracking branch 'origin/master' into metering-api-new
fcofdez bc94df1
Address review comments
fcofdez e53322b
Use raw base_path for Repository metering API
fcofdez 1b79828
minor corrections
fcofdez 79cb0f1
Merge remote-tracking branch 'origin/master' into metering-api-new
fcofdez f9fa369
Minor correction
fcofdez c3a1f3a
Fix testRequestStats. Mention uploads tracked on GCS InsertObject.
fcofdez d142589
Merge remote-tracking branch 'origin/master' into metering-api-new
fcofdez bbc23c1
Merge remote-tracking branch 'origin/master' into metering-api-new
fcofdez a7b2ef8
Minor corrections
fcofdez b97f5f3
Merge remote-tracking branch 'origin/master' into metering-api-new
fcofdez 6df2755
Merge branch 'master' into metering-api-new
elasticmachine 3e2752b
Merge branch 'master' into metering-api-new
elasticmachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...nce/repositories-metering-api/apis/clear-repositories-metering-archive.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| [role="xpack"] | ||
| [testenv="basic"] | ||
| [[clear-repositories-metering-archive-api]] | ||
| === Clear repositories metering archive | ||
| ++++ | ||
| <titleabbrev>Clear repositories metering archive</titleabbrev> | ||
| ++++ | ||
|
|
||
| Removes the archived repositories metering information present in the cluster. | ||
|
|
||
| [[clear-repositories-metering-archive-api-request]] | ||
| ==== {api-request-title} | ||
|
|
||
| `DELETE /_nodes/<node_id>/_repositories_metering/<max_version_to_clear>` | ||
|
|
||
| [[clear-repositories-metering-archive-api-desc]] | ||
| ==== {api-description-title} | ||
|
|
||
| You can use this API to clear the archived repositories metering information in the cluster. | ||
|
|
||
| [[clear-repositories-metering-archive-api-path-params]] | ||
| ==== {api-path-parms-title} | ||
|
|
||
| include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=node-id] | ||
|
|
||
| `<max_version_to_clear>`:: | ||
| (long) Specifies the maximum <<get-repositories-metering-api-response-body, archive_version>> to be cleared from the archive. | ||
|
|
||
| All the nodes selective options are explained <<cluster-nodes,here>>. | ||
| [role="child_attributes"] | ||
| [[clear-repositories-metering-archive-api-response-body]] | ||
| ==== {api-response-body-title} | ||
| Returns the deleted archived repositories metering information. | ||
|
|
||
| include::{es-repo-dir}/repositories-metering-api/apis/repositories-meterings-body.asciidoc[tag=repositories-metering-body] |
35 changes: 35 additions & 0 deletions
35
docs/reference/repositories-metering-api/apis/get-repositories-metering.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| [role="xpack"] | ||
| [testenv="basic"] | ||
| [[get-repositories-metering-api]] | ||
| === Get repositories metering information | ||
| ++++ | ||
| <titleabbrev>Get repositories metering information</titleabbrev> | ||
| ++++ | ||
|
|
||
| Returns cluster repositories metering information. | ||
|
|
||
| [[get-repositories-metering-api-request]] | ||
| ==== {api-request-title} | ||
|
|
||
| `GET /_nodes/<node_id>/_repositories_metering` | ||
|
|
||
| [[get-repositories-metering-api-desc]] | ||
| ==== {api-description-title} | ||
|
|
||
| You can use the cluster repositories metering API to retrieve repositories metering information in a cluster. | ||
|
|
||
| This API exposes monotonically non-decreasing counters and it's expected that clients would durably store | ||
| the information needed to compute aggregations over a period of time. Additionally, the information | ||
| exposed by this API is volatile, meaning that it won't be present after node restarts. | ||
|
|
||
| [[get-repositories-metering-api-path-params]] | ||
| ==== {api-path-parms-title} | ||
|
|
||
| include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=node-id] | ||
|
|
||
| All the nodes selective options are explained <<cluster-nodes,here>>. | ||
|
|
||
| [role="child_attributes"] | ||
| [[get-repositories-metering-api-response-body]] | ||
| ==== {api-response-body-title} | ||
| include::{es-repo-dir}/repositories-metering-api/apis/repositories-meterings-body.asciidoc[tag=repositories-metering-body] |
178 changes: 178 additions & 0 deletions
178
docs/reference/repositories-metering-api/apis/repositories-meterings-body.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| tag::repositories-metering-body[] | ||
| `_nodes`:: | ||
| (object) | ||
| Contains statistics about the number of nodes selected by the request. | ||
| + | ||
| .Properties of `_nodes` | ||
| [%collapsible%open] | ||
| ==== | ||
| `total`:: | ||
| (integer) | ||
| Total number of nodes selected by the request. | ||
|
|
||
| `successful`:: | ||
| (integer) | ||
| Number of nodes that responded successfully to the request. | ||
|
|
||
| `failed`:: | ||
| (integer) | ||
| Number of nodes that rejected the request or failed to respond. If this value | ||
| is not `0`, a reason for the rejection or failure is included in the response. | ||
| ==== | ||
|
|
||
| `cluster_name`:: | ||
| (string) | ||
| Name of the cluster. Based on the <<cluster.name>> setting. | ||
|
|
||
| `nodes`:: | ||
| (object) | ||
| Contains repositories metering information for the nodes selected by the request. | ||
| + | ||
| .Properties of `nodes` | ||
| [%collapsible%open] | ||
| ==== | ||
| `<node_id>`:: | ||
| (array) | ||
| An array of repository metering information for the node. | ||
| + | ||
| .Properties of objects in `node_id` | ||
| [%collapsible%open] | ||
| ===== | ||
| `repository_name`:: | ||
| (string) | ||
| Repository name. | ||
|
|
||
| `repository_type`:: | ||
| (string) | ||
| Repository type. | ||
|
|
||
| `repository_location`:: | ||
| (object) | ||
| Represents an unique location within the repository. | ||
| + | ||
| .Properties of `repository_location` for repository type `Azure` | ||
| [%collapsible%open] | ||
| ====== | ||
| `base_path`:: | ||
| (string) | ||
| The path within the container where the repository stores data. | ||
|
|
||
| `container`:: | ||
| (string) | ||
| Container name. | ||
| ====== | ||
| + | ||
| .Properties of `repository_location` for repository type `GCP` | ||
| [%collapsible%open] | ||
| ====== | ||
| `base_path`:: | ||
| (string) | ||
| The path within the bucket where the repository stores data. | ||
|
|
||
| `bucket`:: | ||
| (string) | ||
| Bucket name. | ||
| ====== | ||
| + | ||
| .Properties of `repository_location` for repository type `S3` | ||
| [%collapsible%open] | ||
| ====== | ||
| `base_path`:: | ||
| (string) | ||
| The path within the bucket where the repository stores data. | ||
|
|
||
| `bucket`:: | ||
| (string) | ||
| Bucket name. | ||
| ====== | ||
| `repository_ephemeral_id`:: | ||
| (string) | ||
| An identifier that changes every time the repository is updated. | ||
|
|
||
| `repository_started_at`:: | ||
| (long) | ||
| Time the repository was created or updated. Recorded in milliseconds | ||
| since the https://en.wikipedia.org/wiki/Unix_time[Unix Epoch]. | ||
|
|
||
| `repository_stopped_at`:: | ||
| (Optional, long) | ||
| Time the repository was deleted or updated. Recorded in milliseconds | ||
| since the https://en.wikipedia.org/wiki/Unix_time[Unix Epoch]. | ||
|
|
||
| `archived`:: | ||
| (boolean) | ||
| A flag that tells whether or not this object has been archived. | ||
| When a repository is closed or updated the repository metering information | ||
| is archived and kept for a certain period of time. This allows retrieving | ||
| the repository metering information of previous repository instantiations. | ||
|
|
||
| `archive_version`:: | ||
| (Optional, long) | ||
| The cluster state version when this object was archived, this field | ||
| can be used as a logical timestamp to delete all the archived metrics up | ||
| to an observed version. This field is only present for archived | ||
| repository metering information objects. The main purpose of this | ||
| field is to avoid possible race conditions during repository metering | ||
| information deletions, i.e. deleting archived repositories metering | ||
| information that we haven't observed yet. | ||
|
|
||
| `request_counts`:: | ||
| (object) | ||
| An object with the number of request performed against the repository | ||
| grouped by request type. | ||
| + | ||
| .Properties of `request_counts` for repository type `Azure` | ||
| [%collapsible%open] | ||
| ====== | ||
| `GetBlobProperties`:: | ||
| (long) Number of https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-properties[Get Blob Properties] requests. | ||
| `GetBlob`:: | ||
| (long) Number of https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob[Get Blob] requests. | ||
| `ListBlobs`:: | ||
| (long) Number of https://docs.microsoft.com/en-us/rest/api/storageservices/list-blobs[List Blobs] requests. | ||
| `PutBlob`:: | ||
| (long) Number of https://docs.microsoft.com/en-us/rest/api/storageservices/put-blob[Put Blob] requests. | ||
| `PutBlock`:: | ||
fcofdez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| (long) Number of https://docs.microsoft.com/en-us/rest/api/storageservices/put-block[Put Block]. | ||
| `PutBlockList`:: | ||
| (long) Number of https://docs.microsoft.com/en-us/rest/api/storageservices/put-block-list[Put Block List] requests. | ||
|
|
||
| Azure storage https://azure.microsoft.com/en-us/pricing/details/storage/blobs/[pricing]. | ||
| ====== | ||
| + | ||
| .Properties of `request_counts` for repository type `GCP` | ||
| [%collapsible%open] | ||
| ====== | ||
| `GetObject`:: | ||
| (long) Number of https://cloud.google.com/storage/docs/json_api/v1/objects/get[get object] requests. | ||
| `ListObjects`:: | ||
| (long) Number of https://cloud.google.com/storage/docs/json_api/v1/objects/list[list objects] requests. | ||
| `InsertObject`:: | ||
| (long) Number of https://cloud.google.com/storage/docs/json_api/v1/objects/insert[insert object] requests, | ||
| including https://cloud.google.com/storage/docs/uploading-objects[simple], https://cloud.google.com/storage/docs/json_api/v1/how-tos/multipart-upload[multipart] and | ||
| https://cloud.google.com/storage/docs/resumable-uploads[resumable] uploads. Resumable uploads can perform multiple http requests to | ||
| insert a single object but they are considered as a single request since they are https://cloud.google.com/storage/docs/resumable-uploads#introduction[billed] as an individual operation. | ||
|
|
||
| Google Cloud storage https://cloud.google.com/storage/pricing[pricing]. | ||
| ====== | ||
| + | ||
| .Properties of `request_counts` for repository type `S3` | ||
| [%collapsible%open] | ||
| ====== | ||
| `GetObject`:: | ||
| (long) Number of https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html[GetObject] requests. | ||
| `ListObjects`:: | ||
| (long) Number of https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjects.html[ListObjects] requests. | ||
| `PutObject`:: | ||
| (long) Number of https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html[PutObject] requests. | ||
| `PutMultipartObject`:: | ||
| (long) Number of https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html[Multipart] requests, | ||
| including https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html[CreateMultipartUpload], | ||
| https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html[UploadPart] and https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html[CompleteMultipartUpload] | ||
| requests. | ||
|
|
||
| Amazon Web Services Simple Storage Service https://aws.amazon.com/s3/pricing/[pricing]. | ||
| ====== | ||
| ===== | ||
| ==== | ||
| end::repositories-metering-body[] | ||
16 changes: 16 additions & 0 deletions
16
docs/reference/repositories-metering-api/repositories-metering-apis.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [role="xpack"] | ||
| [testenv="basic"] | ||
| [[repositories-metering-apis]] | ||
| == Repositories metering APIs | ||
|
|
||
| experimental[] | ||
|
|
||
| You can use the following APIs to retrieve repositories metering information. | ||
|
|
||
| This is an API used by Elastic's commercial offerings. | ||
|
|
||
| * <<get-repositories-metering-api,Get repositories metering information>> | ||
| * <<clear-repositories-metering-archive-api,Clear repositories metering archive>> | ||
|
|
||
| include::apis/get-repositories-metering.asciidoc[] | ||
| include::apis/clear-repositories-metering-archive.asciidoc[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.