Skip to content

feat(bindings): add support for metric aggregation#5709

Merged
jmayclin merged 6 commits intoaws:mainfrom
jmayclin:2026-01-20-metric-aggregation-pr
Feb 6, 2026
Merged

feat(bindings): add support for metric aggregation#5709
jmayclin merged 6 commits intoaws:mainfrom
jmayclin:2026-01-20-metric-aggregation-pr

Conversation

@jmayclin
Copy link
Copy Markdown
Contributor

Goal

Add the ability to aggregate handshake events into a single metric record.

Why

This functionality will be used to emit EMF records to CloudWatch, giving s2n-tls application a much clearer few of their TLS stack.

How

We want to avoid any locks, so the aggregation is done using arrays of atomic integers.

At a high level, there is an "in-progress" record which may be access from multiple threads. This in-progress records has the counters. Then when the record is finished, we "freeze" it and export it.

Testing

I added unit tests.

Related

Depends on #5708

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

@jmayclin jmayclin marked this pull request as ready for review February 3, 2026 19:49

/// The [`s2n_tls::events::EventSubscriber`] may be invoked concurrently, which
/// means that multiple threads might be incrementing the current record. To handle
/// this and ensure that the `HandshakeRecordInProgress` is never flushed while
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stakes are very low even if you flush mid-update right? You just miss like one handshake event.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

On one hand yes, but it would be tricky because it would make it hard to determine that 100% of clients supported something.

@jmayclin jmayclin added this pull request to the merge queue Feb 6, 2026
Merged via the queue into aws:main with commit 8dc7d9c Feb 6, 2026
53 checks passed
@jmayclin jmayclin deleted the 2026-01-20-metric-aggregation-pr branch February 6, 2026 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants