-
-
Notifications
You must be signed in to change notification settings - Fork 6
feat(reduce): track batch trigger reason on batch_time metric. #561
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
Changes from all commits
0757e36
b514ec2
a69fef4
d42797c
dbd44e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,14 @@ def is_ready(self) -> bool: | |
| """ | ||
| ... | ||
|
|
||
| @property | ||
| def readiness_reason(self) -> str: | ||
| """Returns why is_ready returned True. | ||
|
|
||
| Only meaningful when is_ready is True. Used for observability. | ||
| """ | ||
| ... | ||
|
Comment on lines
+45
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Accessing the new Suggested FixTo avoid a breaking change, use Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
|
|
||
| def append(self, message: BaseValue[TPayload]) -> None: | ||
| """Accept a TPayload mutating the internal state of the batch builder.""" | ||
| ... | ||
|
|
@@ -115,9 +123,12 @@ def __flush(self, force: bool) -> None: | |
| ) | ||
| ) | ||
| self.__next_step.submit(buffer_msg) | ||
|
|
||
| flush_reason = self.__buffer.readiness_reason if self.__buffer.is_ready else "force" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: A race condition in Suggested FixDetermine and store the flush reason before the Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
| self.__metrics.timing( | ||
| "arroyo.strategies.reduce.batch_time", | ||
| time.time() - self.__init_time, | ||
| tags={"flush_reason": flush_reason}, | ||
| ) | ||
|
|
||
| # Reset to the empty state. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the buffer knows why it's "ready", yet the metric is recorded so it must get propagated via an interface change. I went with an @Property method, but changing the return type of
is_readyis another option.The third option is an entirely new Protocol to propagate this.
It's not clear if this is entirely internal or a breaking API change. Greping in Sentry, I didn't find any implementors (hard to check since protocols are structural interfaces). Please let me know if we can proceed with this approach and how I should version it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fpacifici