Skip to content

Conversation

@thefringeninja
Copy link
Contributor

@thefringeninja thefringeninja commented May 31, 2024

Added: new metrics for catchup subscriptions

YoEight
YoEight previously approved these changes Jun 5, 2024
Copy link
Contributor

@YoEight YoEight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines 40 to 59
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);
}
}
}
Copy link
Contributor

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

Copy link
Contributor

@timothycoleman timothycoleman left a 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);
Copy link
Contributor

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?

Copy link
Contributor Author

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 _);
Copy link
Contributor

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

@thefringeninja thefringeninja marked this pull request as draft June 7, 2024 11:53
@CLAassistant
Copy link

CLAassistant commented Oct 16, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants