3434import com .google .api .core .ObsoleteApi ;
3535import com .google .api .gax .retrying .ServerStreamingAttemptException ;
3636import com .google .api .gax .tracing .SpanName ;
37- import com .google .auto .value .AutoValue ;
3837import com .google .bigtable .v2 .PeerInfo ;
3938import com .google .cloud .bigtable .Version ;
4039import com .google .cloud .bigtable .data .v2 .stub .MetadataExtractorInterceptor ;
4140import com .google .common .base .Stopwatch ;
4241import com .google .common .math .IntMath ;
43- import com .google .gson .reflect .TypeToken ;
4442import io .grpc .Deadline ;
4543import io .opentelemetry .api .common .Attributes ;
4644import io .opentelemetry .api .metrics .DoubleGauge ;
4745import io .opentelemetry .api .metrics .DoubleHistogram ;
4846import io .opentelemetry .api .metrics .LongCounter ;
4947import java .time .Duration ;
50- import java .util .Map ;
5148import java .util .Optional ;
5249import java .util .concurrent .CancellationException ;
5350import java .util .concurrent .TimeUnit ;
6158 * bigtable.googleapis.com/client namespace
6259 */
6360class BuiltinMetricsTracer extends BigtableTracer {
64- @ AutoValue
65- abstract static class TransportAttrs {
66- @ Nullable
67- abstract String getLocality ();
68-
69- @ Nullable
70- abstract String getBackendService ();
71-
72- static TransportAttrs create (@ Nullable String locality , @ Nullable String backendService ) {
73- return new AutoValue_BuiltinMetricsTracer_TransportAttrs (locality , backendService );
74- }
75- }
76-
77- private static final TypeToken <Map <String , String >> LOCALITY_TYPE =
78- new TypeToken <Map <String , String >>() {};
79-
8061 private static final String NAME = "java-bigtable/" + Version .VERSION ;
8162 private final OperationType operationType ;
8263 private final SpanName spanName ;
@@ -370,8 +351,8 @@ private void recordOperationCompletion(@Nullable Throwable status) {
370351 Attributes attributes =
371352 baseAttributes .toBuilder ()
372353 .put (TABLE_ID_KEY , tableId )
373- .put (CLUSTER_ID_KEY , Util .formatClusterIdMetricLabel (sidebandData . getResponseParams () ))
374- .put (ZONE_ID_KEY , Util .formatZoneIdMetricLabel (sidebandData . getResponseParams () ))
354+ .put (CLUSTER_ID_KEY , Util .formatClusterIdMetricLabel (sidebandData ))
355+ .put (ZONE_ID_KEY , Util .formatZoneIdMetricLabel (sidebandData ))
375356 .put (METHOD_KEY , spanName .toString ())
376357 .put (CLIENT_NAME_KEY , NAME )
377358 .put (STREAMING_KEY , isStreaming )
@@ -425,8 +406,8 @@ private void recordAttemptCompletion(@Nullable Throwable status) {
425406 Attributes attributes =
426407 baseAttributes .toBuilder ()
427408 .put (TABLE_ID_KEY , tableId )
428- .put (CLUSTER_ID_KEY , Util .formatClusterIdMetricLabel (sidebandData . getResponseParams () ))
429- .put (ZONE_ID_KEY , Util .formatZoneIdMetricLabel (sidebandData . getResponseParams () ))
409+ .put (CLUSTER_ID_KEY , Util .formatClusterIdMetricLabel (sidebandData ))
410+ .put (ZONE_ID_KEY , Util .formatZoneIdMetricLabel (sidebandData ))
430411 .put (METHOD_KEY , spanName .toString ())
431412 .put (CLIENT_NAME_KEY , NAME )
432413 .put (STREAMING_KEY , isStreaming )
@@ -445,7 +426,7 @@ private void recordAttemptCompletion(@Nullable Throwable status) {
445426 String transportSubzone = "" ;
446427
447428 if (sidebandData != null ) {
448- transportTypeStr = Util .formatTransportTypeMetricLabel (sidebandData . getPeerInfo () );
429+ transportTypeStr = Util .formatTransportTypeMetricLabel (sidebandData );
449430 transportZone =
450431 Optional .ofNullable (sidebandData .getPeerInfo ())
451432 .map (PeerInfo ::getApplicationFrontendZone )
0 commit comments