-
Notifications
You must be signed in to change notification settings - Fork 115
Add sampling config specifications #5573
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 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c82e30e
Add sampling config specifications
seanzatzdev 2a3f2b7
Update sampleconfig naming
seanzatzdev 5642973
regenerate output
seanzatzdev 8f1d482
address pr comments
seanzatzdev 834e5b2
Merge branch 'main' into sampling_config
seanzatzdev 3ba7939
Merge branch 'main' into sampling_config
seanzatzdev 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
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,64 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { ByteSize } from '@_types/common' | ||
| import { double, integer, long } from '@_types/Numeric' | ||
| import { DateTime, Duration } from '@_types/Time' | ||
|
|
||
| /** | ||
| * Sampling configuration as returned by the API. | ||
| */ | ||
| export class SamplingConfiguration { | ||
| /** | ||
| * The fraction of documents to sample. | ||
| */ | ||
| rate: double | ||
| /** | ||
| * The maximum number of documents to sample. | ||
| */ | ||
| max_samples: integer | ||
| /** | ||
| * The maximum total size of sampled documents. | ||
| */ | ||
| max_size?: ByteSize | ||
| /** | ||
| * The maximum total size of sampled documents in bytes. | ||
| */ | ||
| max_size_in_bytes: long | ||
| /** | ||
| * The duration for which the sampled documents should be retained. | ||
| */ | ||
| time_to_live?: Duration | ||
| /** | ||
| * The duration for which the sampled documents should be retained, in milliseconds. | ||
| */ | ||
| time_to_live_in_millis: long | ||
| /** | ||
| * An optional condition script that sampled documents must satisfy. | ||
| */ | ||
| if?: string | ||
| /** | ||
| * The time when the sampling configuration was created. | ||
| */ | ||
| creation_time?: DateTime | ||
| /** | ||
| * The time when the sampling configuration was created, in milliseconds since epoch. | ||
| */ | ||
| creation_time_in_millis: long | ||
| } | ||
60 changes: 60 additions & 0 deletions
60
specification/indices/delete_sample_configuration/IndicesDeleteSampleConfigurationRequest.ts
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,60 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { RequestBase } from '@_types/Base' | ||
| import { IndexName } from '@_types/common' | ||
| import { Duration } from '@_types/Time' | ||
|
|
||
| /** | ||
| * Delete sampling configuration. | ||
| * Delete the sampling configuration for the specified index. | ||
| * @rest_spec_name indices.delete_sample_configuration | ||
| * @availability stack visibility=feature_flag feature_flag=random_sampling since=9.3.0 stability=experimental | ||
| * @doc_id random_sample | ||
| * @doc_tag random_sample | ||
| */ | ||
| export interface Request extends RequestBase { | ||
| urls: [ | ||
| { | ||
| path: '/{index}/_sample/config' | ||
| methods: ['DELETE'] | ||
| } | ||
| ] | ||
| path_parts: { | ||
| /** | ||
| * The name of the index. | ||
| */ | ||
| index: IndexName | ||
| } | ||
| query_parameters: { | ||
| /** | ||
| * Period to wait for a connection to the master node. If no response is | ||
| * received before the timeout expires, the request fails and returns an | ||
| * error. | ||
| * @server_default 30s | ||
| */ | ||
| master_timeout?: Duration | ||
| /** | ||
| * Period to wait for a response. | ||
| * If no response is received before the timeout expires, the request fails and returns an error. | ||
| * @server_default 30s | ||
| */ | ||
| timeout?: Duration | ||
| } | ||
| } |
25 changes: 25 additions & 0 deletions
25
...ification/indices/delete_sample_configuration/IndicesDeleteSampleConfigurationResponse.ts
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,25 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { AcknowledgedResponseBase } from '@_types/Base' | ||
|
|
||
| export class Response { | ||
| /** @codegen_name result */ | ||
| body: AcknowledgedResponseBase | ||
| } |
8 changes: 8 additions & 0 deletions
8
...sample_configuration/examples/200_response/IndicesDeleteSampleConfigurationResponse1.yaml
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,8 @@ | ||
| # summary: '' | ||
| description: A successful response for deleting a sampling configuration. | ||
| # type: response | ||
| # response_code: 200 | ||
| value: |- | ||
| { | ||
| "acknowledged": true | ||
| } |
1 change: 1 addition & 0 deletions
1
...elete_sample_configuration/examples/request/IndicesDeleteSampleConfigurationRequest1.yaml
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 @@ | ||
| method_request: DELETE /my-index/_sample/config |
47 changes: 47 additions & 0 deletions
47
...ification/indices/get_all_sample_configuration/IndicesGetAllSampleConfigurationRequest.ts
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,47 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { RequestBase } from '@_types/Base' | ||
| import { Duration } from '@_types/Time' | ||
|
|
||
| /** | ||
| * Get all sampling configurations. | ||
| * Get the sampling configurations for all indices. | ||
| * @rest_spec_name indices.get_all_sample_configuration | ||
| * @availability stack visibility=feature_flag feature_flag=random_sampling since=9.3.0 stability=experimental | ||
| * @doc_id random_sample | ||
| * @doc_tag random_sample | ||
| */ | ||
| export interface Request extends RequestBase { | ||
| urls: [ | ||
| { | ||
| path: '/_sample/config' | ||
| methods: ['GET'] | ||
| } | ||
| ] | ||
| query_parameters: { | ||
| /** | ||
| * Period to wait for a connection to the master node. If no response is | ||
| * received before the timeout expires, the request fails and returns an | ||
| * error. | ||
| * @server_default 30s | ||
| */ | ||
| master_timeout?: Duration | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
...fication/indices/get_all_sample_configuration/IndicesGetAllSampleConfigurationResponse.ts
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,26 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { IndexSamplingConfiguration } from './_types/IndexSamplingConfiguration' | ||
|
|
||
| export class Response { | ||
| body: { | ||
| configurations: IndexSamplingConfiguration[] | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
specification/indices/get_all_sample_configuration/_types/IndexSamplingConfiguration.ts
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,26 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { IndexName } from '@_types/common' | ||
| import { SamplingConfiguration } from '@indices/_types/SampleConfigurationOutput' | ||
|
|
||
| export class IndexSamplingConfiguration { | ||
| index: IndexName | ||
| configuration: SamplingConfiguration | ||
| } |
20 changes: 20 additions & 0 deletions
20
...sample_configuration/examples/200_response/IndicesGetAllSampleConfigurationResponse1.yaml
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,20 @@ | ||
| # summary: '' | ||
| description: A successful response for retrieving all sampling configurations. | ||
| # type: response | ||
| # response_code: 200 | ||
| value: |- | ||
| { | ||
| "configurations": [ | ||
| { | ||
| "index": "my-index", | ||
| "configuration": { | ||
| "rate": 0.05, | ||
| "max_samples": 1000, | ||
| "max_size_in_bytes": 10485760, | ||
| "time_to_live_in_millis": 86400000, | ||
| "if": "ctx?.network?.name == 'Guest'", | ||
| "creation_time_in_millis": 1761677431066 | ||
| } | ||
| } | ||
| ] | ||
| } |
1 change: 1 addition & 0 deletions
1
...t_all_sample_configuration/examples/request/IndicesGetAllSampleConfigurationRequest1.yaml
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 @@ | ||
| method_request: GET /_sample/config |
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.