Skip to content

add group_by to sample processor #2736

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .generated-info
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"spec_repo_commit": "b75095c",
"generated": "2025-07-31 10:46:07.850"
"spec_repo_commit": "b14c9da",
"generated": "2025-07-31 15:32:05.142"
}
10 changes: 10 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27480,6 +27480,16 @@ components:
description: The `sample` processor allows probabilistic sampling of logs at
a fixed rate.
properties:
group_by:
description: Optional list of fields to group events by. Each group will
be sampled independently
example:
- service
- host
items:
type: string
minItems: 1
type: array
id:
description: The unique identifier for this component. Used to reference
this component in other parts of the pipeline (for example, as the `input`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def __init__(self, **kwargs):
:param metrics: Configuration for generating individual metrics.
:type metrics: [ObservabilityPipelineGeneratedMetric]

:param group_by: Optional list of fields to group events by. Each group will be sampled independently
:type group_by: [str], optional

:param percentage: The percentage of logs to sample.
:type percentage: float, optional

Expand Down Expand Up @@ -91,9 +94,6 @@ def __init__(self, **kwargs):
:param target: Path where enrichment results should be stored in the log.
:type target: str

:param group_by: A list of fields used to group log events for merging.
:type group_by: [str]

:param merge_strategies: List of merge strategies defining how values from grouped events should be combined.
:type merge_strategies: [ObservabilityPipelineReduceProcessorMergeStrategy]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

class ObservabilityPipelineSampleProcessor(ModelNormal):
validations = {
"group_by": {
"min_items": 1,
},
"rate": {
"inclusive_minimum": 1,
},
Expand All @@ -33,6 +36,7 @@ def openapi_types(_):
)

return {
"group_by": ([str],),
"id": (str,),
"include": (str,),
"inputs": ([str],),
Expand All @@ -42,6 +46,7 @@ def openapi_types(_):
}

attribute_map = {
"group_by": "group_by",
"id": "id",
"include": "include",
"inputs": "inputs",
Expand All @@ -56,13 +61,17 @@ def __init__(
include: str,
inputs: List[str],
type: ObservabilityPipelineSampleProcessorType,
group_by: Union[List[str], UnsetType] = unset,
percentage: Union[float, UnsetType] = unset,
rate: Union[int, UnsetType] = unset,
**kwargs,
):
"""
The ``sample`` processor allows probabilistic sampling of logs at a fixed rate.

:param group_by: Optional list of fields to group events by. Each group will be sampled independently
:type group_by: [str], optional

:param id: The unique identifier for this component. Used to reference this component in other parts of the pipeline (for example, as the ``input`` to downstream components).
:type id: str

Expand All @@ -81,6 +90,8 @@ def __init__(
:param type: The processor type. The value should always be ``sample``.
:type type: ObservabilityPipelineSampleProcessorType
"""
if group_by is not unset:
kwargs["group_by"] = group_by
if percentage is not unset:
kwargs["percentage"] = percentage
if rate is not unset:
Expand Down
Loading