Skip to content

Commit

Permalink
feat: Initialize default no-op PubsubTracer in Publisher and Subscriber
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelpri10 committed Sep 12, 2024
1 parent d257b6b commit ca4680f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.pubsub.v1;

public class BasePubsubTracer implements PubsubTracer {
BasePubsubTracer() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public class Publisher implements PublisherInterface {

private final boolean enableOpenTelemetryTracing;
private final OpenTelemetry openTelemetry;
private PubsubTracer tracer = null;
private PubsubTracer tracer = new BasePubsubTracer();

/** The maximum number of messages in one request. Defined by the API. */
public static long getApiMaxRequestElementCount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public class Subscriber extends AbstractApiService implements SubscriberInterfac

private final boolean enableOpenTelemetryTracing;
private final OpenTelemetry openTelemetry;
private PubsubTracer tracer = null;
private PubsubTracer tracer = new BasePubsubTracer();

private Subscriber(Builder builder) {
receiver = builder.receiver;
Expand Down

0 comments on commit ca4680f

Please sign in to comment.