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-core): add nominal counter aggregations #2369

Merged
merged 2 commits into from
Nov 7, 2024

Conversation

camshaft
Copy link
Contributor

@camshaft camshaft commented Nov 6, 2024

Description of changes:

This change adds the ability to emit counter metrics based on individual variants. For example, we want a total number of errors for each type of error that can occur.

The event specifies this aggregation as such:

struct MyEvent {
    #[nominal_counter("state", "")]
    state: State,
}

enum State {
    A,
    B,
    C,
}

There will be a total of 4 counters registered for this particular event: 1 for the overall event, and then an individual counter for each possible variant inside of State.

Testing:

The dc path secret map tests can be run to show it all working:

$ S2N_LOG=trace cargo test -p s2n-quic-core -p s2n-quic-dc --features probe-tracing -- map::event_tests::control_packets --nocapture
...
2024-11-06T22:36:20.268288Z TRACE s2n_quic_core::event::metrics::aggregate::probe::dynamic::counter::record: id=41 name="replay_detected_packet_accepted" units="" value=1
2024-11-06T22:36:20.268297Z TRACE s2n_quic_dc::event::generated::metrics::probe::nominal_counter::replay_detected_packet_accepted__peer_address__protocol: value=1 variant=0 variant_name="IP_V4"
2024-11-06T22:36:20.268306Z TRACE s2n_quic_core::event::metrics::aggregate::probe::dynamic::nominal_counter::record: id=42 name="replay_detected_packet_accepted.peer_address.protocol" units="" variant="IP_V4" value=1
2024-11-06T22:36:20.268334Z TRACE s2n_quic_dc::event::generated::metrics::probe::counter::path_secret_map_background_handshake_requested: value=1
2024-11-06T22:36:20.268341Z TRACE s2n_quic_core::event::metrics::aggregate::probe::dynamic::counter::record: id=16 name="path_secret_map_background_handshake_requested" units="" value=1
2024-11-06T22:36:20.268351Z TRACE s2n_quic_dc::event::generated::metrics::probe::nominal_counter::path_secret_map_background_handshake_requested__peer_address__protocol: value=1 variant=0 variant_name="IP_V4"
2024-11-06T22:36:20.268359Z TRACE s2n_quic_core::event::metrics::aggregate::probe::dynamic::nominal_counter::record: id=17 name="path_secret_map_background_handshake_requested.peer_address.protocol" units="" variant="IP_V4" value=1

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

quic/s2n-quic-core/src/transport/error.rs Outdated Show resolved Hide resolved
quic/s2n-quic-core/src/transport/error.rs Outdated Show resolved Hide resolved
quic/s2n-quic-core/events/connection.rs Outdated Show resolved Hide resolved
quic/s2n-quic-core/src/connection/error.rs Show resolved Hide resolved
quic/s2n-quic-core/src/event/metrics/aggregate/variant.rs Outdated Show resolved Hide resolved
@camshaft camshaft marked this pull request as ready for review November 7, 2024 02:54
@camshaft camshaft merged commit cfd87b9 into main Nov 7, 2024
130 checks passed
@camshaft camshaft deleted the camshaft/nominal-counters branch November 7, 2024 14:16
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