Skip to content

Commit 0d3697b

Browse files
feat(bigtable): enable new auth library and remove async refresh (#19943)
Context: b/372244283 --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent c7f0b97 commit 0d3697b

3 files changed

Lines changed: 4 additions & 30 deletions

File tree

bigtable/admin.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"google.golang.org/api/cloudresourcemanager/v1"
3737
"google.golang.org/api/iterator"
3838
"google.golang.org/api/option"
39+
"google.golang.org/api/option/internaloption"
3940
gtransport "google.golang.org/api/transport/grpc"
4041
"google.golang.org/genproto/googleapis/rpc/status"
4142
"google.golang.org/grpc/codes"
@@ -120,6 +121,7 @@ func NewAdminClient(ctx context.Context, project, instance string, opts ...optio
120121
o = append(o, btopt.ClientInterceptorOptions(nil, nil)...)
121122
// Need to add scopes for long running operations (for create table & snapshots)
122123
o = append(o, option.WithScopes(cloudresourcemanager.CloudPlatformScope))
124+
o = append(o, internaloption.EnableNewAuthLibrary())
123125
o = append(o, opts...)
124126
connPool, err := gtransport.DialPool(ctx, o...)
125127
if err != nil {

bigtable/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func NewClientWithConfig(ctx context.Context, project, instance string, config C
145145
o = append(o, opts...)
146146

147147
// TODO(b/372244283): Remove after b/358175516 has been fixed
148-
o = append(o, internaloption.EnableAsyncRefreshDryRun(metricsTracerFactory.newAsyncRefreshErrHandler()))
148+
o = append(o, internaloption.EnableNewAuthLibrary())
149149

150150
disableRetryInfo := false
151151

bigtable/metrics.go

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ type builtinMetricsTracerFactory struct {
220220
clientBlockingLatencies metric.Float64Histogram
221221
retryCount metric.Int64Counter
222222
connErrCount metric.Int64Counter
223-
debugTags metric.Int64Counter
224223
}
225224

226225
// Returns error only if metricsProvider is of unknown type. Rest all errors are swallowed
@@ -312,26 +311,6 @@ func builtInMeterProviderOptions(project string, opts ...option.ClientOption) ([
312311
)}, nil
313312
}
314313

315-
func (tf *builtinMetricsTracerFactory) newAsyncRefreshErrHandler() func() {
316-
if !tf.enabled {
317-
return func() {}
318-
}
319-
320-
asyncRefreshMetricAttrs := tf.clientAttributes
321-
asyncRefreshMetricAttrs = append(asyncRefreshMetricAttrs,
322-
attribute.String(metricLabelKeyTag, "async_refresh_dry_run"),
323-
// Table, cluster and zone are unknown at this point
324-
// Use default values
325-
attribute.String(monitoredResLabelKeyTable, defaultTable),
326-
attribute.String(monitoredResLabelKeyCluster, defaultCluster),
327-
attribute.String(monitoredResLabelKeyZone, defaultZone),
328-
)
329-
return func() {
330-
tf.debugTags.Add(context.Background(), 1,
331-
metric.WithAttributes(asyncRefreshMetricAttrs...))
332-
}
333-
}
334-
335314
func (tf *builtinMetricsTracerFactory) createInstruments(meter metric.Meter) error {
336315
var err error
337316

@@ -421,13 +400,7 @@ func (tf *builtinMetricsTracerFactory) createInstruments(meter metric.Meter) err
421400
return err
422401
}
423402

424-
// Create debug_tags
425-
tf.debugTags, err = meter.Int64Counter(
426-
metricNameDebugTags,
427-
metric.WithDescription("A counter of internal client events used for debugging."),
428-
metric.WithUnit(metricUnitCount),
429-
)
430-
return err
403+
return nil
431404
}
432405

433406
// builtinMetricsTracer is created one per operation
@@ -577,7 +550,6 @@ func (tf *builtinMetricsTracerFactory) createBuiltinMetricsTracer(ctx context.Co
577550
instrumentClientBlockingLatencies: tf.clientBlockingLatencies,
578551
instrumentRetryCount: tf.retryCount,
579552
instrumentConnErrCount: tf.connErrCount,
580-
instrumentDebugTags: tf.debugTags,
581553

582554
tableName: tableName,
583555
isStreaming: isStreaming,

0 commit comments

Comments
 (0)