-
Notifications
You must be signed in to change notification settings - Fork 668
[ESDB-116-4] Add Catchup Subscription Metrics #4279
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
base: master
Are you sure you want to change the base?
Conversation
b77956f to
b8b9277
Compare
YoEight
left a comment
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
| public void ProcessEvent(string? streamName, long commitPosition, long eventPosition) { | ||
| foreach (var (_, stats) in _subscriptionStats) { | ||
| if (stats.StreamName == streamName) { | ||
| _subscriptionStats.TryUpdate(stats.SubscriptionId, stats with { | ||
| SubscriptionPosition = eventPosition | ||
| }, stats); | ||
| } else if (stats.StreamName is null) { | ||
| _subscriptionStats.TryUpdate(stats.SubscriptionId, stats with { | ||
| SubscriptionPosition = commitPosition | ||
| }, stats); | ||
| } | ||
| } | ||
| } |
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.
- similarly, quite expensive to do for every event that we send to a subscription?
- also we probably want to update the specific subscription that processed this event or all the subscriptions will have the same position
src/EventStore.Core/Services/Transport/Enumerators/Enumerator.AllSubscriptionFiltered.cs
Show resolved
Hide resolved
timothycoleman
left a comment
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.
questions/suggestions above
|
|
||
| meter.CreateObservableUpDownCounter($"{name}-completed", Completed); | ||
| meter.CreateObservableUpDownCounter($"{name}-subscription-position", SubscriptionPosition); | ||
| meter.CreateObservableUpDownCounter($"{name}-stream-position", StreamPosition); |
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.
the ticket talks about having the timestamps of the current vs latest events, is that still in scope?
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.
If we use the read index we could read the last event to get that info, but dunno how expensive that is every n seconds. We would have to expose IAllReader to do it for the all stream
Or we go back to using EventCommitted
Or, we could occasionally update this from the grpc subscription
| public void Add(Guid subscriptionId, string? streamName, long endOfStream) => | ||
| _subscriptionStats.TryAdd(subscriptionId, new(subscriptionId, streamName, EndOfStream: endOfStream)); | ||
|
|
||
| public void Remove(Guid subscriptionId) => _subscriptionStats.TryRemove(subscriptionId, out _); |
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.
could you double check what happens in the dashboard if we stop reporting a particular subscription, does it stop drawing it or does it just keep drawing the last reported values for a while
b8b9277 to
4a841ea
Compare
d2d8408 to
527be4d
Compare
|
|
Added: new metrics for catchup subscriptions