Skip to content

Conversation

masseyke
Copy link
Member

@masseyke masseyke commented Oct 6, 2025

This adds a new rest action and corresponding transport action for fetching stats about a random sample.

@masseyke masseyke added >non-issue :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP v9.2.0 labels Oct 6, 2025
@masseyke masseyke requested a review from Copilot October 6, 2025 20:36
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 a new REST action and corresponding transport action for fetching statistics about random sampling data. The implementation enables users to retrieve statistics about sampling operations performed on indices through a new /_sample/stats endpoint.

Key changes:

  • Added a new GetSampleStatsAction with REST and transport handlers for retrieving sampling statistics
  • Updated the SamplingService.SampleStats class to improve field naming, add test constructors, and enhance human-readable time representations
  • Added comprehensive test coverage for the new action classes and serialization

Reviewed Changes

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

Show a summary per file
File Description
server/src/main/java/org/elasticsearch/action/admin/indices/sampling/GetSampleStatsAction.java Core action definition with request/response classes for sampling statistics
server/src/main/java/org/elasticsearch/action/admin/indices/sampling/RestGetSampleStatsAction.java REST handler implementing the /{index}/_sample/stats endpoint
server/src/main/java/org/elasticsearch/action/admin/indices/sampling/TransportGetSampleStatsAction.java Transport layer implementation for sampling statistics retrieval
server/src/main/java/org/elasticsearch/ingest/SamplingService.java Enhanced SampleStats class with improved field naming and test support
server/src/main/java/org/elasticsearch/action/ActionModule.java Registration of new action and REST handler
Various test files Comprehensive test coverage for serialization and functionality

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

@masseyke masseyke marked this pull request as ready for review October 6, 2025 20:40
@masseyke masseyke requested a review from seanzatzdev October 6, 2025 20:41
@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label Oct 6, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

Copy link
Contributor

@nielsbauman nielsbauman left a comment

Choose a reason for hiding this comment

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

I just quickly scanned the actions and left two small comments. I'll leave the rest of the review up to someone who actually knows something about the sampling work :)

@masseyke masseyke requested a review from nielsbauman October 6, 2025 22:50
* cloned copy of the stats, but with the reported samples lowered to maxSize, and the reported rejected documents increased by the
* same amount. This avoids the confusing situation of the stats reporting more samples than the user has configured.
*/
public SampleStats adjustForMaxSize(int maxSize) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This avoids the confusing situation of the stats reporting more samples than the user has configured

Nit, feel free to ignore; I'd just say we may want to add to the comment here on why this may occur (needing to reconcile the results from across different nodes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >non-issue Team:Data Management Meta label for data/management team v9.2.0 v9.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants