Skip to content

feat(storage): support DirectPath over Interconnect in Cloud Monitoring and register channel_creation_latency view - #15025

Open
nidhiii-27 wants to merge 5 commits into
mainfrom
feat/storage-dp-interconnect-channel-metrics
Open

nidhiii-27 wants to merge 5 commits into
mainfrom
feat/storage-dp-interconnect-channel-metrics

Conversation

@nidhiii-27

@nidhiii-27 nidhiii-27 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds Cloud Monitoring endpoint support for DirectPath over Cloud Interconnect (DP over GCI) and registers the channel_creation_latency OpenTelemetry histogram view and recorder in google-cloud-storage.

Key Changes

  • OpenTelemetryBootstrappingUtils:
    • Registers the storage.googleapis.com/internal/client/channel_creation_latency histogram view in createMeterProvider via registerGrpcChannelViews.
    • Adds createChannelCreationLatencyRecorder (configured with explicit seconds-scale latency bucket boundaries advice and transport_type attribute) for recording first-channel creation latency.
    • Exposes the MeterProvider from enableGrpcMetrics via GrpcMetricsChannelConfigurator implements ChannelConfigurator, Supplier<MeterProvider> while preserving the existing method signature.
    • Updates getCloudMonitoringEndpoint to handle google-c2p:/// and google-c2p-experimental:/// targets with query/fragment parameters, storage-direct.googleapis.com, storage-preprod-direct.sandbox.googleapis.com, storage-direct.<universeDomain>, and IPv6 literals, with defensive null/empty handling.
  • OpenTelemetryBootstrappingUtilsTest:
    • Adds unit tests for DirectPath over Interconnect Cloud Monitoring endpoint mapping, registerGrpcChannelViews seconds-scale bucket boundaries, createChannelCreationLatencyRecorder, and GrpcMetricsChannelConfigurator.

@nidhiii-27 nidhiii-27 added the ai-generated Pull Request generated by AI label Nov 16, 2026

@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 tracking for gRPC channel creation latency metrics and refactors endpoint parsing in OpenTelemetryBootstrappingUtils to be more robust, particularly for C2P and DirectPath interconnect hosts. It also adds corresponding unit tests to validate these changes. The review feedback points out a redundant check in the stream filter of getCloudMonitoringEndpoint and suggests simplifying it using a method reference on resolvedHost to improve clarity and correctness.

…ng and register channel_creation_latency view

- Register storage.googleapis.com/internal/client/channel_creation_latency histogram view in OpenTelemetryBootstrappingUtils.createMeterProvider.
- Expose MeterProvider from enableGrpcMetrics via GrpcMetricsChannelConfigurator implementing Supplier<MeterProvider> while preserving the existing method signature.
- Update getCloudMonitoringEndpoint to support DirectPath over Cloud Interconnect endpoints (storage-direct.googleapis.com, storage-preprod-direct.sandbox.googleapis.com, storage-direct.<universeDomain>, and google-c2p:/// / google-c2p-experimental:/// targets with query/fragment parameters) with defensive null/empty handling.
- Add unit tests in OpenTelemetryBootstrappingUtilsTest.

[Generated-by: AI]
@nidhiii-27
nidhiii-27 force-pushed the feat/storage-dp-interconnect-channel-metrics branch from a306a43 to 640013f Compare November 18, 2026 06:50
@nidhiii-27 nidhiii-27 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 18, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 18, 2026
@nidhiii-27
nidhiii-27 marked this pull request as ready for review November 18, 2026 10:20
@nidhiii-27
nidhiii-27 requested review from a team as code owners November 18, 2026 10:20

@kalragauri kalragauri 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.

A few notes on the description:

  • It lists storage-direct.googleapis.com and the preprod host as newly handled, but both already resolve to monitoring.googleapis.com on main. The actual changes are the universe-domain host, query and fragment stripping, the experimental scheme, and null handling.
  • Host matching moved from contains to exact equality. That is a behavior change worth calling out.
  • createChannelCreationLatencyRecorder and the Supplier<MeterProvider> have no production caller in this PR. A link to #15065, where they are wired in, would help reviewers.

String match =
ImmutableList.of(canonicalEndpoint, privateEndpoint, restrictedEndpoint).stream()
.filter(s -> endpoint.contains(s) || endpoint.contains("google-c2p:///" + s))
.filter(resolvedHost::contains)

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.

resolvedHost::contains can now match canonicalEndpoint, which was unreachable before the outer checks moved from contains to equals. For example, storage.googleapis.com.:443 (trailing dot) now returns storage.googleapis.com:443 instead of monitoring.googleapis.com:443.

Consider dropping canonicalEndpoint from this list, or matching the private and restricted hosts exactly.

}

@Test
public void getCloudMonitoringEndpoint_directPathInterconnectAndC2pEndpoints() {

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.

Most rows in this table also pass without the production change: only the storage-direct.apis-tpclp.goog and null rows fail on main. The two ?force-xds rows use port 443, which is also the default, so they do not show that the query string is stripped.

Consider adding a row such as google-c2p:///storage-direct.googleapis.com:8443?force-xds expecting port 8443.

|| host.equals("storage-direct." + universeDomain))) {
metricServiceEndpoint = "monitoring." + universeDomain;
} else if (!endpoint.contains("storage.googleapis.com")) {
} else if (!host.equals("storage.googleapis.com") && !isDirectPathInterconnectHost(host)) {

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.

isDirectPathInterconnectHost(host) does not change the result: neither host contains storage., private. or restricted. plus the domain, so the branch below leaves monitoring.googleapis.com in place.

Is the check, and its two constants, needed? If it is kept for readability, a short comment saying so would help.


@SuppressWarnings("rawtypes") // ManagedChannelBuilder
static final class GrpcMetricsChannelConfigurator
implements ChannelConfigurator, Supplier<MeterProvider> {

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.

IIUC, implements Supplier<MeterProvider> makes the provider reachable only while the caller holds this exact type. ChannelConfigurator.andThen returns a plain lambda, so any later composition silently drops the provider and the recorder becomes a no-op.

Should we return a small holder with both the configurator and the provider from a package-private overload?

|| DIRECT_PATH_INTERCONNECT_PREPROD_HOST.equals(host);
}

private static String extractHostFallback(String endpoint) {

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.

extractHostFallback only runs when HostAndPort.fromString rejects the input, and the one test that reaches it ([::1]:invalid) expects the default endpoint whatever host comes back.

Please add a case with a host such as storage.my-universe.com:99999 with universe my-universe.com expecting monitoring.my-universe.com:443.

BiConsumer<String, Duration> noopRecorder =
OpenTelemetryBootstrappingUtils.createChannelCreationLatencyRecorder(null);
noopRecorder.accept("CloudPath", Duration.ofMillis(10));
assertThat(metricReader.collectAllMetrics()).isEmpty();

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.

metricReader belongs to unusedProvider, which is never passed to the recorder, so this assertion holds for any implementation. The test really checks that accept does not throw.

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