Skip to content

Commit 7a46352

Browse files
chore!: Remove opencensus (#2568)
* chore: mark opencensus as deprecated * fix formatting * addressing pr comments * chore!: Remove OpenCensus support * Remove unused dependency * formating
1 parent 8892990 commit 7a46352

21 files changed

+36
-2309
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ This project follows
4141
### Integration Tests
4242

4343
Bigtable integration tests can either be run against an emulator or a real Bigtable instance.
44-
The target environment can be selected by setting a maven profile. By default it is set to
44+
The target environment can be selected by setting a maven profile. By default it is set to
4545
`bigtable-emulator-it` and other options are `bigtable-prod-it` and `bigtable-directpath-it`.
4646

4747
To use the `bigtable-prod-it` and `bigtable-directpath-it` environments:
4848

4949
1. Set up the target table using scripts/setup-test-table.sh
5050
2. Download the JSON service account credentials file from the Google Developer's Console.
5151
3. Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of the credentials file
52-
4. Enable the profile and the system properties `bigtable.project`, `bigtable.instance`
52+
4. Enable the profile and the system properties `bigtable.project`, `bigtable.instance`
5353
and `bigtable.table` to created earlier. Example:
5454
```bash
5555
mvn verify \
@@ -82,7 +82,7 @@ on how to run conformance tests.
8282

8383
## Formatting the code
8484

85-
To auto-format any code changes, run ``mvn com.coveo:fmt-maven-plugin:format``.
85+
To auto-format any code changes, run ``mvn com.spotify.fmt:fmt-maven-plugin:format``.
8686

8787
## Native Image Testing
8888
Native Image testing is enabled for tests that follow a particular naming
@@ -95,4 +95,4 @@ image compilation.
9595
A rollback plan is required for all new features. The rollback plan should include:
9696

9797
1. How to disable this feature from the server side.
98-
2. For features that are strictly client side, what the risks are, and what tests are done.
98+
2. For features that are strictly client side, what the risks are, and what tests are done.

google-cloud-bigtable-deps-bom/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,6 @@
7878
<type>pom</type>
7979
<scope>import</scope>
8080
</dependency>
81-
<!-- Other opencensus packages' versions are pulled through com.google.cloud:third-party-dependencies, but has to be manually specified for this one. -->
82-
<dependency>
83-
<groupId>io.opencensus</groupId>
84-
<artifactId>opencensus-contrib-resource-util</artifactId>
85-
<version>0.31.1</version>
86-
</dependency>
8781
</dependencies>
8882
</dependencyManagement>
8983

google-cloud-bigtable/clirr-ignored-differences.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,4 +382,23 @@
382382
<method>*</method>
383383
<to>*</to>
384384
</difference>
385+
<!-- OpenCensus removal -->
386+
<difference>
387+
<differenceType>7002</differenceType>
388+
<className>com/google/cloud/bigtable/data/v2/BigtableDataSettings</className>
389+
<method>*OpenCensusStats*</method>
390+
</difference>
391+
<difference>
392+
<differenceType>8001</differenceType>
393+
<className>com/google/cloud/bigtable/data/v2/stub/metrics/MetricsTracerFactory*</className>
394+
</difference>
395+
<difference>
396+
<differenceType>8001</differenceType>
397+
<className>com/google/cloud/bigtable/data/v2/stub/metrics/RpcMeasureConstants*</className>
398+
</difference>
399+
<difference>
400+
<differenceType>8001</differenceType>
401+
<className>com/google/cloud/bigtable/data/v2/stub/metrics/RpcViews*</className>
402+
</difference>
403+
<!-- /OpenCensus removal -->
385404
</differences>

google-cloud-bigtable/pom.xml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,6 @@
138138
<groupId>com.google.code.gson</groupId>
139139
<artifactId>gson</artifactId>
140140
</dependency>
141-
<dependency>
142-
<groupId>io.opencensus</groupId>
143-
<artifactId>opencensus-api</artifactId>
144-
</dependency>
145141
<dependency>
146142
<groupId>io.grpc</groupId>
147143
<artifactId>grpc-alts</artifactId>
@@ -184,10 +180,6 @@
184180
<groupId>io.grpc</groupId>
185181
<artifactId>grpc-util</artifactId>
186182
</dependency>
187-
<dependency>
188-
<groupId>io.grpc</groupId>
189-
<artifactId>grpc-core</artifactId>
190-
</dependency>
191183
<dependency>
192184
<groupId>io.grpc</groupId>
193185
<artifactId>grpc-googleapis</artifactId>
@@ -324,11 +316,6 @@
324316
<artifactId>grpc-testing</artifactId>
325317
<scope>test</scope>
326318
</dependency>
327-
<dependency>
328-
<groupId>io.opencensus</groupId>
329-
<artifactId>opencensus-impl</artifactId>
330-
<scope>test</scope>
331-
</dependency>
332319
<dependency>
333320
<groupId>junit</groupId>
334321
<artifactId>junit</artifactId>
@@ -709,20 +696,6 @@
709696
</dependencies>
710697
</plugin>
711698

712-
<plugin>
713-
<groupId>org.apache.maven.plugins</groupId>
714-
<artifactId>maven-dependency-plugin</artifactId>
715-
<configuration>
716-
<!--
717-
grpc-auth is not directly used transitively, but is pulled to align with other grpc parts
718-
opencensus-impl-core is brought in transitively through opencensus-impl
719-
-->
720-
<ignoredUsedUndeclaredDependencies>
721-
<ignoredUsedUndeclaredDependency>io.opencensus:opencensus-impl-core</ignoredUsedUndeclaredDependency>
722-
</ignoredUsedUndeclaredDependencies>
723-
</configuration>
724-
</plugin>
725-
726699
<plugin>
727700
<artifactId>maven-failsafe-plugin</artifactId>
728701
<configuration>

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -145,62 +145,6 @@ public static Builder newBuilderForEmulator(String hostname, int port) {
145145
return builder;
146146
}
147147

148-
/**
149-
* @deprecated OpenCensus support is deprecated and will be removed in a future version
150-
* Enables OpenCensus metric aggregations.
151-
*
152-
* <p>This will register Bigtable client relevant {@link io.opencensus.stats.View}s. When coupled
153-
* with an exporter, it allows users to monitor client behavior.
154-
*
155-
* <p>Please note that in addition to calling this method, the application must:
156-
* <ul>
157-
* <li>Include openensus-impl dependency on the classpath
158-
* <li>Configure an exporter like opencensus-exporter-stats-stackdriver
159-
* </ul>
160-
*
161-
* <p>Example usage for maven:
162-
* <pre>{@code
163-
* <dependency>
164-
* <groupId>io.opencensus</groupId>
165-
* <artifactId>opencensus-impl</artifactId>
166-
* <version>${opencensus.version}</version>
167-
* <scope>runtime</scope>
168-
* </dependency>
169-
*
170-
* <dependency>
171-
* <groupId>io.opencensus</groupId>
172-
* <artifactId>opencensus-exporter-stats-stackdriver</artifactId>
173-
* <version>${opencensus.version}</version>
174-
* </dependency>
175-
* </pre>
176-
*
177-
* Java:
178-
* <pre>{@code
179-
* StackdriverStatsExporter.createAndRegister();
180-
* BigtableDataSettings.enableOpenCensusStats();
181-
* }</pre>
182-
*/
183-
@Deprecated
184-
public static void enableOpenCensusStats() {
185-
com.google.cloud.bigtable.data.v2.stub.metrics.RpcViews.registerBigtableClientViews();
186-
// TODO(igorbernstein): Enable grpc views once we upgrade to grpc-java 1.24.0
187-
// Required change: https://github.com/grpc/grpc-java/pull/5996
188-
// io.opencensus.contrib.grpc.metrics.RpcViews.registerClientGrpcBasicViews();
189-
}
190-
191-
/**
192-
* @deprecated OpenCensus support is deprecated and will be removed in a future version Enables
193-
* OpenCensus GFE metric aggregations.
194-
* <p>This will register views for gfe_latency and gfe_header_missing_count metrics.
195-
* <p>gfe_latency measures the latency between Google's network receives an RPC and reads back
196-
* the first byte of the response. gfe_header_missing_count is a counter of the number of RPC
197-
* responses received without the server-timing header.
198-
*/
199-
@Deprecated
200-
public static void enableGfeOpenCensusStats() {
201-
com.google.cloud.bigtable.data.v2.stub.metrics.RpcViews.registerBigtableClientGfeViews();
202-
}
203-
204148
/**
205149
* Register built in metrics.
206150
*

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java

Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import com.google.api.gax.batching.BatcherImpl;
2929
import com.google.api.gax.batching.FlowController;
3030
import com.google.api.gax.core.BackgroundResource;
31-
import com.google.api.gax.grpc.GaxGrpcProperties;
3231
import com.google.api.gax.grpc.GrpcCallContext;
3332
import com.google.api.gax.grpc.GrpcCallSettings;
3433
import com.google.api.gax.grpc.GrpcRawCallableFactory;
@@ -48,7 +47,6 @@
4847
import com.google.api.gax.rpc.UnaryCallSettings;
4948
import com.google.api.gax.rpc.UnaryCallable;
5049
import com.google.api.gax.tracing.ApiTracerFactory;
51-
import com.google.api.gax.tracing.OpencensusTracerFactory;
5250
import com.google.api.gax.tracing.SpanName;
5351
import com.google.api.gax.tracing.TracedServerStreamingCallable;
5452
import com.google.api.gax.tracing.TracedUnaryCallable;
@@ -100,8 +98,6 @@
10098
import com.google.cloud.bigtable.data.v2.stub.metrics.BigtableTracerUnaryCallable;
10199
import com.google.cloud.bigtable.data.v2.stub.metrics.BuiltinMetricsTracerFactory;
102100
import com.google.cloud.bigtable.data.v2.stub.metrics.CompositeTracerFactory;
103-
import com.google.cloud.bigtable.data.v2.stub.metrics.MetricsTracerFactory;
104-
import com.google.cloud.bigtable.data.v2.stub.metrics.RpcMeasureConstants;
105101
import com.google.cloud.bigtable.data.v2.stub.metrics.StatsHeadersServerStreamingCallable;
106102
import com.google.cloud.bigtable.data.v2.stub.metrics.StatsHeadersUnaryCallable;
107103
import com.google.cloud.bigtable.data.v2.stub.metrics.TracedBatcherUnaryCallable;
@@ -126,7 +122,6 @@
126122
import com.google.cloud.bigtable.data.v2.stub.sql.SqlRowMergingCallable;
127123
import com.google.cloud.bigtable.gaxx.retrying.ApiResultRetryAlgorithm;
128124
import com.google.cloud.bigtable.gaxx.retrying.RetryInfoRetryAlgorithm;
129-
import com.google.common.annotations.VisibleForTesting;
130125
import com.google.common.base.Functions;
131126
import com.google.common.base.MoreObjects;
132127
import com.google.common.base.Preconditions;
@@ -135,12 +130,6 @@
135130
import com.google.common.util.concurrent.MoreExecutors;
136131
import com.google.protobuf.ByteString;
137132
import io.grpc.MethodDescriptor;
138-
import io.opencensus.stats.Stats;
139-
import io.opencensus.stats.StatsRecorder;
140-
import io.opencensus.tags.TagKey;
141-
import io.opencensus.tags.TagValue;
142-
import io.opencensus.tags.Tagger;
143-
import io.opencensus.tags.Tags;
144133
import io.opentelemetry.api.OpenTelemetry;
145134
import io.opentelemetry.api.common.Attributes;
146135
import java.io.IOException;
@@ -226,47 +215,11 @@ public static BigtableClientContext createBigtableClientContext(
226215
public static ApiTracerFactory createBigtableTracerFactory(
227216
EnhancedBigtableStubSettings settings, @Nullable OpenTelemetry openTelemetry)
228217
throws IOException {
229-
return createBigtableTracerFactory(
230-
settings, Tags.getTagger(), Stats.getStatsRecorder(), openTelemetry);
231-
}
232-
233-
@VisibleForTesting
234-
public static ApiTracerFactory createBigtableTracerFactory(
235-
EnhancedBigtableStubSettings settings,
236-
Tagger tagger,
237-
StatsRecorder stats,
238-
@Nullable OpenTelemetry openTelemetry)
239-
throws IOException {
240-
String projectId = settings.getProjectId();
241-
String instanceId = settings.getInstanceId();
242-
String appProfileId = settings.getAppProfileId();
243-
244-
ImmutableMap<TagKey, TagValue> attributes =
245-
ImmutableMap.<TagKey, TagValue>builder()
246-
.put(RpcMeasureConstants.BIGTABLE_PROJECT_ID, TagValue.create(projectId))
247-
.put(RpcMeasureConstants.BIGTABLE_INSTANCE_ID, TagValue.create(instanceId))
248-
.put(RpcMeasureConstants.BIGTABLE_APP_PROFILE_ID, TagValue.create(appProfileId))
249-
.build();
250218

251219
ImmutableList.Builder<ApiTracerFactory> tracerFactories = ImmutableList.builder();
252-
tracerFactories
253-
.add(
254-
// Add OpenCensus Tracing
255-
new OpencensusTracerFactory(
256-
ImmutableMap.<String, String>builder()
257-
// Annotate traces with the same tags as metrics
258-
.put(RpcMeasureConstants.BIGTABLE_PROJECT_ID.getName(), projectId)
259-
.put(RpcMeasureConstants.BIGTABLE_INSTANCE_ID.getName(), instanceId)
260-
.put(RpcMeasureConstants.BIGTABLE_APP_PROFILE_ID.getName(), appProfileId)
261-
// Also annotate traces with library versions
262-
.put("gax", GaxGrpcProperties.getGaxGrpcVersion())
263-
.put("grpc", GaxGrpcProperties.getGrpcVersion())
264-
.put("gapic", Version.VERSION)
265-
.build()))
266-
// Add OpenCensus Metrics
267-
.add(MetricsTracerFactory.create(tagger, stats, attributes))
268-
// Add user configured tracer
269-
.add(settings.getTracerFactory());
220+
221+
tracerFactories.add(settings.getTracerFactory());
222+
270223
BuiltinMetricsTracerFactory builtinMetricsTracerFactory =
271224
openTelemetry != null
272225
? BuiltinMetricsTracerFactory.create(openTelemetry, createBuiltinAttributes(settings))

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableTracerStreamingCallable.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
* This callable will
3232
* <li>-Inject a {@link GrpcResponseMetadata} to access the headers returned by gRPC methods upon
3333
* completion. The {@link BigtableTracer} will process metrics that were injected in the
34-
* header/trailer and publish them to OpenCensus. If {@link GrpcResponseMetadata#getMetadata()}
35-
* returned null, it probably means that the request has never reached GFE, and it'll increment
36-
* the gfe_header_missing_counter in this case.
34+
* header/trailer and publish them. If {@link GrpcResponseMetadata#getMetadata()} returned null,
35+
* it probably means that the request has never reached GFE, and it'll increment the
36+
* gfe_header_missing_counter in this case.
3737
* <li>-This class will also access trailers from {@link GrpcResponseMetadata} to record zone and
3838
* cluster ids.
3939
* <li>-Call {@link BigtableTracer#onRequest(int)} to record the request events in a stream.

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableTracerUnaryCallable.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
* This callable will:
3131
* <li>- Inject a {@link GrpcResponseMetadata} to access the headers returned by gRPC methods upon
3232
* completion. The {@link BigtableTracer} will process metrics that were injected in the
33-
* header/trailer and publish them to OpenCensus. If {@link GrpcResponseMetadata#getMetadata()}
34-
* returned null, it probably means that the request has never reached GFE, and it'll increment
35-
* the gfe_header_missing_counter in this case.
33+
* header/trailer and publish them. If {@link GrpcResponseMetadata#getMetadata()} returned null,
34+
* it probably means that the request has never reached GFE, and it'll increment the
35+
* gfe_header_missing_counter in this case.
3636
* <li>-This class will also access trailers from {@link GrpcResponseMetadata} to record zone and
3737
* cluster ids.
3838
* <li>-This class will also inject a {@link BigtableGrpcStreamTracer} that'll record the time an

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ static TransportAttrs create(@Nullable String locality, @Nullable String backend
122122

123123
private TransportAttrs transportAttrs = null;
124124

125-
// OpenCensus (and server) histogram buckets use [start, end), however OpenTelemetry uses (start,
126-
// end]. To work around this, we measure all the latencies in nanoseconds and convert them
125+
// Server histogram buckets use [start, end), however OpenTelemetry uses (start, end]. To work
126+
// around this, we measure all the latencies in nanoseconds and convert them
127127
// to milliseconds and use DoubleHistogram. This should minimize the chance of a data
128128
// point fall on the bucket boundary that causes off by one errors.
129129
private final DoubleHistogram operationLatenciesHistogram;

0 commit comments

Comments
 (0)