Skip to content

Conversation

seanzatzdev
Copy link
Contributor

@seanzatzdev seanzatzdev commented Sep 29, 2025

This PR adds the action classes associated with setting, getting, and deleting Sampling Configurations.

Set Configuration
The set configuration API structure will be similar to the following:

PUT /<index-name>/_sample/config
{
  "rate": "5%", // required
  "max_samples": 20 // optional, buffer size, defaults to 10
  "max_size": 10mb, // optional, max size of documents, defaults to 1mb
  "time_to_live": 1d, // optional, time after which documents may be deleted, defaults to never
  "if": "ctx?.network?.name == 'Guest'" // optional, same syntax as pipeline conditional
}

Get Configuration
The GET //_sample/config API will get a specific configuration. For example:

GET /logs/_sample/config
[
  {
    "index": "logs",
    "configuration:
    {
      "rate": "5%",
      "if": "ctx?.network?.name == 'Guest'"
    }
  }
]

An API to get all currently-configured APIs will also be provided:

GET /_sample/config
[
  {
    "index": "logs",
    "configuration:
    {
      "rate": "5%",
      "if": "ctx?.network?.name == 'Guest'"
    }
  },
  {
    "index": "my-index",
    "configuration:
    {
      "rate": "25%"
    }
  }
]

Delete Configuration
A delete API, DELETE //_sample/config, will remove the sampling configuration for the given index or data stream and cleans up any associated in-memory storage.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces action classes for managing sampling configuration in Elasticsearch, specifically adding PutSamplingConfigurationAction and associated functionality for configuring sampling settings on indices.

  • Adds PutSamplingConfigurationAction class with request/response handling for sampling configuration
  • Implements comprehensive test coverage for the new action including serialization, mutation testing, and validation
  • Provides API for configuring sampling parameters like rate, max samples, size limits, TTL, and conditions

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
PutSamplingConfigurationAction.java Main action class implementing sampling configuration functionality with request handling, serialization, and task creation
PutSamplingConfigurationActionTests.java Comprehensive test suite covering serialization, mutation testing, and action validation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

# Conflicts:
#	server/src/test/java/org/elasticsearch/action/admin/indices/sampling/PutSamplingConfigurationActionTests.java
@seanzatzdev seanzatzdev requested a review from Copilot September 29, 2025 22:18
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

…mpling/PutSamplingConfigurationAction.java

Co-authored-by: Copilot <[email protected]>
@seanzatzdev seanzatzdev self-assigned this Sep 29, 2025
@seanzatzdev seanzatzdev requested a review from Copilot September 30, 2025 14:30
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@seanzatzdev seanzatzdev changed the title Add PutSamplingConfigurationAction & GetSamplingConfigurationAction Add Sampling Configuration Actions Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants