Skip to content

Commit ed02f8b

Browse files
committed
refactored FixedSizeExemplarReservoirABC
1 parent 68e8824 commit ed02f8b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exemplar/exemplar_reservoir.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,19 @@ def _reset(self) -> None:
164164
"""Reset the reservoir by resetting any stateful logic after a collection cycle."""
165165
pass
166166

167+
@abstractmethod
168+
def _find_bucket_index(
169+
self,
170+
value: Union[int, float],
171+
time_unix_nano: int,
172+
attributes: Attributes,
173+
ctx: Context,
174+
) -> int:
175+
"""
176+
Determines the bucket index for the given measurement.
177+
Should be implemented by subclasses based on specific strategies.
178+
"""
179+
pass
167180

168181
class SimpleFixedSizeExemplarReservoir(FixedSizeExemplarReservoirABC):
169182
"""This reservoir uses an uniformly-weighted sampling algorithm based on the number

0 commit comments

Comments
 (0)