Skip to content

feat(storage): add http.client.request.duration metric for HTTP requests - #14744

Open
nidhiii-27 wants to merge 21 commits into
feat/storage-rpc-call-durationfrom
feat/storage-http-request-duration
Open

nidhiii-27 wants to merge 21 commits into
feat/storage-rpc-call-durationfrom
feat/storage-http-request-duration

Conversation

@nidhiii-27

@nidhiii-27 nidhiii-27 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Instruments HTTP/JSON storage requests to record http.client.request.duration OpenTelemetry histogram metrics.

  • Adds StorageHttpMetricsInterceptor to measure per-request duration and attach rpc.system.name, http.request.method, http.response.status_code, network.path, url.template, server.address, and error.type attributes across normal responses and IOException failures.
  • Wires StorageHttpMetricsInterceptor via HttpStorageOptions.decorateWithMetrics and HttpStorageRpc.
  • Adds unit tests in StorageHttpMetricsInterceptorTest.

Stacked on #14743.

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request introduces the StorageHttpMetricsInterceptor class to record HTTP client metrics, such as request duration, using OpenTelemetry. It integrates this interceptor into StorageOptions and HttpStorageRpc to decorate request initializers, and adds comprehensive unit tests. Feedback on the changes suggests initializing the recorded AtomicBoolean to true instead of false to prevent recording metrics for requests that fail before execution begins.

@nidhiii-27
nidhiii-27 marked this pull request as ready for review November 5, 2026 09:03
@nidhiii-27
nidhiii-27 requested review from a team as code owners November 5, 2026 09:03
Merge updated feat/storage-rpc-call-duration base branch, use OpenTelemetryBootstrappingUtils.extractServerAddress, pass String status codes to KEY_HTTP_RESPONSE_STATUS_CODE, wire batchRequestInitializer on overflow batches, and refine StorageHttpMetricsInterceptor Javadoc.

[Generated-by: AI]
…uestDuration to StorageMetricsContext

[Generated-by: AI]
…Interceptor

- Merge updated base branch feat/storage-rpc-call-duration (including #14694)
- Update HttpIOExceptionHandler error type to StorageErrorTypeMapper.STATUS_CONNECTION_ERROR
- Return "/storage/v1/b" in extractV1UrlTemplate when rest is "b" (CreateBucket / ListBuckets)

[Generated-by: AI]
… mapping

After merging StorageErrorTypeMapper updates from #14694, Status.DEADLINE_EXCEEDED
maps to DEADLINE_EXCEEDED while SocketTimeoutException maps to TIMEOUT. Update
recordAttemptError_specificExceptions_mappedToCanonicalTypes to assert 1 count
each for DEADLINE_EXCEEDED, TIMEOUT, and DNS_FAILURE.

[Generated-by: AI]
@nidhiii-27
nidhiii-27 requested a review from cpriti-os November 9, 2026 10:50

@cpriti-os cpriti-os left a comment

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.

Thanks for the fixes, a few follow-ups inline.

@nidhiii-27
nidhiii-27 requested a review from cpriti-os November 12, 2026 08:59
- Clarify StorageHttpMetricsInterceptor Javadoc on download header timing
- Capture end timestamp before delegating to UnsuccessfulResponseHandler so 401 duration excludes token refresh
- Restore {entity} and {notification} URL template placeholders on acl and notificationConfigs paths
- Add unit tests for notificationConfigs and UnsuccessfulResponseHandler returning false on 404

[Generated-by: AI]
@nidhiii-27
nidhiii-27 requested a review from cpriti-os November 17, 2026 07:13
- Move recordHttpRequestDuration onto StorageClientMetrics building from baseAttributes and drop resolveServerAddress/host
- Guard UnsuccessfulResponseHandler against BatchUnparsedResponse fake responses via response.getRequest() == req
- Remove unreachable null/Math.max/UNKNOWN guards and unissued notifications/copyTo/watchAll URL template branches
- Unify recordResponse helper sampling endNanos first across response hooks
- Consolidate StorageHttpMetricsInterceptorTest into table-driven tests and add real BatchRequest 401 part retry test

[Generated-by: AI]
…request-duration

Pull in 3d3930c / cdca421 (use TestUtils.nullStreamController in GrpcStorageImplTest) to resolve JDK 8 split-units failure.

[Generated-by: AI]
@nidhiii-27 nidhiii-27 added the ai-generated Pull Request generated by AI label Dec 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Pull Request generated by AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants