-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
chore: App metrics no hub no promise manager #17581
Conversation
c787e54
to
c2fdb05
Compare
@@ -178,10 +166,11 @@ export class AppMetrics { | |||
}), | |||
})) | |||
|
|||
await this.hub.kafkaProducer.queueMessage({ | |||
await this.kafkaProducer.queueMessage({ |
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.
Nice, no hub 🥳
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.
lgtm, happy to see less hub
// For quick access to queueSize instead of using Object.keys(queuedData).length every time | ||
queueSize: number |
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.
nit: This adds an extra attribute that we have to keep track on with every method that manipulates the queue. Should be fine for now, but it could be bug-prone as it introduces a problem we didn't have: Forgetting to update the queueSize.
If this was Python I would suggest using a property that does the equivalent Object.keys(queuedData).length
call, e.g.:
@property
def queue_size(self):
return len(self.queuedData)
But with js I'm not sure if there's anything better.
The issue grows only if we add new methods that manipulate the queue, so when we do that we can tackle this too.
Problem
I want to use app metrics for webhooks, which don't have hub.
Changes
The guard for not flushing in tests is because of our tests not being properly set-up isolated, ideally we'd move the app metrics completely outside of the hub, but that's for the future.
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
How did you test this code?