Skip to content
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

Add StatisticsCollector to Options for custom statistics tracking #964

Merged
merged 7 commits into from
Sep 7, 2023

Conversation

johnlcox
Copy link
Contributor

@johnlcox johnlcox commented Sep 1, 2023

Add an interface for statistics collection that can be set on Options to allow for custom metric collection (e.g. to prometheus).

This fixes #960

@scottf scottf marked this pull request as ready for review September 2, 2023 18:48
Copy link
Contributor

@scottf scottf left a comment

Choose a reason for hiding this comment

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

LGTM

}
else {
statistics.incrementOrphanRepliesReceived();
if (advancedTracking) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously, all orphan counter was being incremented for every duplicate or orphan when advancedTracking was not enabled. Does this change to first check the advancedTracking flag and only when enabled increment duplicate or orphan replies.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this is some weird original code, and I'm to blame, sigh. This change is good.

Copy link
Contributor

@scottf scottf left a comment

Choose a reason for hiding this comment

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

LGTM

}
else {
statistics.incrementOrphanRepliesReceived();
if (advancedTracking) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this is some weird original code, and I'm to blame, sigh. This change is good.

@scottf scottf merged commit 2a01825 into nats-io:main Sep 7, 2023
1 check passed
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.

Add a hook into the Statistics interface to observe counter changes
2 participants