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

feat(s2n-quic-dc): implement connection-level counter aggregation #2397

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

camshaft
Copy link
Contributor

@camshaft camshaft commented Dec 3, 2024

Description of changes:

This change implements connection-level counter aggregation. This allows aggregating counters at the connection level and then aggregating them as metrics, as opposed to them being pure counters or measurements, which don't have enough granularity to give insight into distribution of connection behaviors. For example, this change allows getting a distribution of the number of bytes sent and received on streams.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@camshaft camshaft marked this pull request as ready for review December 3, 2024 22:23
@@ -419,3 +410,13 @@ struct DcStateChanged {
#[nominal_counter("state")]
state: DcState,
}

// NOTE - This event MUST come last, since connection-level aggregation depends on it
Copy link
Collaborator

Choose a reason for hiding this comment

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

You mean last in this file? (Asking since you moved it in the file..)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Based on s2n-quic-events changes I don't think order matters so approving, but maybe worth fixing up the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah last in this file. basically i didn't want to have scan everything twice - once to look for all the counters, then to process the connection close.


if units == "Duration" {
on_connection_closed.extend(quote!(
self.measure(#info, #id, core::time::Duration::from_micros(context.#ctx_name #counter_load));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm, I guess I missed before that we have u64 granularity of microseconds in our metrics. Maybe we should switch to nanoseconds? Anyway, not important for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah we do currently:

The tricky bit is our timestamps aren't more granular than that either, so it would be a bit of a change:

let micros = duration.as_micros() as u64;

@camshaft camshaft merged commit bdb03ea into main Dec 3, 2024
129 of 130 checks passed
@camshaft camshaft deleted the camshaft/measure-counter branch December 3, 2024 22:42
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.

2 participants