Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public class BuiltinMetricsConstants {
static final AttributeKey<String> GRPC_XDS_SERVER_KEY = AttributeKey.stringKey("grpc.xds.server");
static final AttributeKey<String> GRPC_XDS_RESOURCE_TYPE_KEY =
AttributeKey.stringKey("grpc.xds.resource_type");
static final AttributeKey<String> GRPC_LB_POLICY_KEY = AttributeKey.stringKey("lb_policy");

public static final String METER_NAME = "bigtable.googleapis.com/internal/client/";

Expand Down Expand Up @@ -246,8 +247,6 @@ static void defineView(
.build();
Set<String> attributesFilter =
ImmutableSet.<String>builder()
.addAll(
COMMON_ATTRIBUTES.stream().map(AttributeKey::getKey).collect(Collectors.toSet()))
.addAll(attributes.stream().map(AttributeKey::getKey).collect(Collectors.toSet()))
.build();
ViewBuilder viewBuilder =
Expand Down Expand Up @@ -277,7 +276,7 @@ public static Map<InstrumentSelector, View> getInternalViews() {
InstrumentType.HISTOGRAM,
"1",
ImmutableSet.<AttributeKey>builder()
.add(BIGTABLE_PROJECT_ID_KEY, INSTANCE_ID_KEY, APP_PROFILE_KEY, CLIENT_NAME_KEY)
.add(TRANSPORT_TYPE, GRPC_LB_POLICY_KEY, STREAMING_KEY)
.build());
return views.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
*/
package com.google.cloud.bigtable.data.v2.stub.metrics;

import static com.google.cloud.bigtable.data.v2.stub.metrics.BuiltinMetricsConstants.GRPC_LB_POLICY_KEY;
import static com.google.cloud.bigtable.data.v2.stub.metrics.BuiltinMetricsConstants.METER_NAME;
import static com.google.cloud.bigtable.data.v2.stub.metrics.BuiltinMetricsConstants.OUTSTANDING_RPCS_PER_CHANNEL_NAME;
import static com.google.cloud.bigtable.data.v2.stub.metrics.BuiltinMetricsConstants.PER_CONNECTION_ERROR_COUNT_NAME;
import static com.google.cloud.bigtable.data.v2.stub.metrics.BuiltinMetricsConstants.STREAMING_KEY;
import static com.google.cloud.bigtable.data.v2.stub.metrics.BuiltinMetricsConstants.TRANSPORT_TYPE;

import com.google.api.core.InternalApi;
import com.google.cloud.bigtable.gaxx.grpc.BigtableChannelObserver;
Expand Down Expand Up @@ -103,9 +106,9 @@ public void run() {

// Build attributes if they haven't been built yet.
if (unaryAttributes == null || streamingAttributes == null) {
Attributes baseAttrs = commonAttrs.toBuilder().put("lb_policy", lbPolicy).build();
this.unaryAttributes = baseAttrs.toBuilder().put("streaming", false).build();
this.streamingAttributes = baseAttrs.toBuilder().put("streaming", true).build();
Attributes baseAttrs = Attributes.of(GRPC_LB_POLICY_KEY, lbPolicy);
this.unaryAttributes = baseAttrs.toBuilder().put(STREAMING_KEY, false).build();
this.streamingAttributes = baseAttrs.toBuilder().put(STREAMING_KEY, true).build();
}
List<? extends BigtableChannelObserver> channelInsights =
channelInsightsProvider.getChannelInfos();
Expand All @@ -115,9 +118,9 @@ public void run() {
for (BigtableChannelObserver info : channelInsights) {
String transportTypeValue = info.isAltsChannel() ? "DIRECTPATH" : "CLOUDPATH";
this.unaryAttributes =
this.unaryAttributes.toBuilder().put("transport_type", transportTypeValue).build();
this.unaryAttributes.toBuilder().put(TRANSPORT_TYPE, transportTypeValue).build();
this.streamingAttributes =
this.streamingAttributes.toBuilder().put("transport_type", transportTypeValue).build();
this.streamingAttributes.toBuilder().put(TRANSPORT_TYPE, transportTypeValue).build();

long currentOutstandingUnaryRpcs = info.getOutstandingUnaryRpcs();
long currentOutstandingStreamingRpcs = info.getOutstandingStreamingRpcs();
Expand Down
Loading