Skip to content

Add client-level MetricPublisher support to the S3 CRT client - #7299

Merged
jencymaryjoseph merged 2 commits into
feature/master/S3CRTMetricPublisherfrom
jencyjos/s3crt/client-metrics
Aug 22, 2026
Merged

Add client-level MetricPublisher support to the S3 CRT client#7299
jencymaryjoseph merged 2 commits into
feature/master/S3CRTMetricPublisherfrom
jencyjos/s3crt/client-metrics

Conversation

@jencymaryjoseph

@jencymaryjoseph jencymaryjoseph commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

The S3 CRT-based client (S3AsyncClient.crtBuilder()) currently has no MetricPublisher support - unlike the
standard client, there's no way to collect metrics from it. CRT already emits per-request telemetry
(S3RequestMetrics, via the onTelemetry callback added in aws-crt-java#928); this change wires it to the SDK's MetricPublisher API for publishers configured on the builder (client level). Request-level and copyObject support will follow separately.

Modifications

  • Add metricPublishers(Collection<MetricPublisher>) and addMetricPublisher(MetricPublisher) to
    S3CrtAsyncClientBuilder.
  • Route these publishers to the CRT transport only (never the inner delegate client), so the inner pipeline
    stays a no-op and no empty ApiCall is emitted — all metrics come from CRT telemetry.
  • S3CrtResponseHandlerAdapter.onTelemetry(...) publishes each underlying CRT request as its own ApiCall → ApiCallAttempt → HttpClient collection (ServiceId, OperationName, ApiCallSuccessful, RetryCount,
    durations, request IDs, HttpClientName=s3crt); a fanned-out transfer (e.g. a multipart getObject) publishes
    one collection per underlying request.
  • Carry the publishers to the adapter via a new internal METRIC_PUBLISHERS execution attribute; unavailable
    metrics are skipped per-metric and onTelemetry never throws back into the native callback.

Follow-ups will add request-level publisher overrides, copyObject parity, expanded integration tests, and
more metrics as CRT exposes them (HTTP status- aws-crt-java#1011, endpoint URL, TTFB/TTLB,
connection-pool).

Testing

  • Unit (S3CrtResponseHandlerAdapterMetricsTest): mapping correctness, unavailable-metric skip, failed
    attempt (ApiCallSuccessful=false), empty-publisher no-op, N callbacks → N collections, and retry (per-attempt
    collections with increasing RetryCount). S3CrtResponseHandlerAdapterTest updated for the new constructor.
  • Integration (S3CrtClientMetricPublisherIntegrationTest): single-part getObject, multipart getObject
    (fan-out), putObject, and a failed getObject, verifying the published collections (ServiceId=S3,
    non-zero ApiCallDuration, HttpClientName=s3crt).

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@jencymaryjoseph
jencymaryjoseph requested a review from a team as a code owner August 20, 2026 20:42
@jencymaryjoseph
jencymaryjoseph merged commit ee5cadf into feature/master/S3CRTMetricPublisher Aug 22, 2026
4 of 5 checks passed
@github-actions

Copy link
Copy Markdown

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 22, 2026
@jencymaryjoseph
jencymaryjoseph deleted the jencyjos/s3crt/client-metrics branch August 22, 2026 00:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants