Skip to content

Commit

Permalink
Annotate deprecated APIs/Methods (#1157)
Browse files Browse the repository at this point in the history
* added initial annotations

* spotless apply template

* clean up spotless formatting

* reformat comment, fix accidental code change

* undeprecatesplunkrumbuilder
  • Loading branch information
tonzhan2 authored Jan 28, 2025
1 parent 0a3fe6e commit 323a463
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,54 +22,92 @@
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import javax.net.ssl.SSLSocketFactory;

/** Entrypoint for tracing Volley clients. */
/**
* Entrypoint for tracing Volley clients.
*
* @deprecated This API is deprecated and will be removed in a future release.
*/
@Deprecated
public final class VolleyTracing {

/** Returns a new {@link VolleyTracing} configured with the given {@link SplunkRum}. */
/**
* Returns a new {@link VolleyTracing} configured with the given {@link SplunkRum}.
*
* @deprecated This method is deprecated and will be removed in a future release.
*/
@Deprecated
public static VolleyTracing create(SplunkRum splunkRum) {
return create(splunkRum.getOpenTelemetry());
}

/** Returns a new {@link VolleyTracing} configured with the given {@link OpenTelemetry}. */
/**
* Returns a new {@link VolleyTracing} configured with the given {@link OpenTelemetry}.
*
* @deprecated This method is deprecated and will be removed in a future release.
*/
@Deprecated
public static VolleyTracing create(OpenTelemetry openTelemetry) {
return builder(openTelemetry).build();
}

/** Returns a new {@link VolleyTracingBuilder} configured with the given {@link SplunkRum}. */
/**
* Returns a new {@link VolleyTracingBuilder} configured with the given {@link SplunkRum}.
*
* @deprecated This method is deprecated and will be removed in a future release.
*/
@Deprecated
public static VolleyTracingBuilder builder(SplunkRum splunkRum) {
return new VolleyTracingBuilder(splunkRum.getOpenTelemetry());
}

/**
* Returns a new {@link VolleyTracingBuilder} configured with the given {@link OpenTelemetry}.
*
* @deprecated This method is deprecated and will be removed in a future release.
*/
@Deprecated
public static VolleyTracingBuilder builder(OpenTelemetry openTelemetry) {
return new VolleyTracingBuilder(openTelemetry);
}

private final Instrumenter<RequestWrapper, HttpResponse> instrumenter;

/**
* @deprecated This method is deprecated and will be removed in a future release.
*/
@Deprecated
VolleyTracing(Instrumenter<RequestWrapper, HttpResponse> instrumenter) {
this.instrumenter = instrumenter;
}

/** Returns a new {@link HurlStack} capable of tracing requests. */
/**
* Returns a new {@link HurlStack} capable of tracing requests.
*
* @deprecated This method is deprecated and will be removed in a future release.
*/
@Deprecated
public HurlStack newHurlStack() {
return new TracingHurlStack(instrumenter);
}

/**
* Returns a new {@link HurlStack} capable of tracing requests configured with given {@link
* HurlStack.UrlRewriter}.
*
* @deprecated This method is deprecated and will be removed in a future release.
*/
@Deprecated
public HurlStack newHurlStack(HurlStack.UrlRewriter urlRewriter) {
return new TracingHurlStack(instrumenter, urlRewriter);
}

/**
* Returns a new {@link HurlStack} capable of tracing requests configured with given {@link
* HurlStack.UrlRewriter} and {@link SSLSocketFactory}.
*
* @deprecated This method is deprecated and will be removed in a future release.
*/
@Deprecated
public HurlStack newHurlStack(
HurlStack.UrlRewriter urlRewriter, SSLSocketFactory sslSocketFactory) {
return new TracingHurlStack(instrumenter, urlRewriter, sslSocketFactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
import java.util.ArrayList;
import java.util.List;

/** A builder for {@link VolleyTracing}. */
/**
* A builder for {@link VolleyTracing}.
*
* @deprecated This API is deprecated and will be removed in a future release.
*/
@Deprecated
public final class VolleyTracingBuilder {

private static final String INSTRUMENTATION_NAME = "com.splunk.android.volley";
Expand All @@ -42,14 +47,18 @@ public final class VolleyTracingBuilder {
HttpClientAttributesExtractor.builder(
VolleyHttpClientAttributesGetter.INSTANCE);

@Deprecated
VolleyTracingBuilder(OpenTelemetry openTelemetry) {
this.openTelemetry = openTelemetry;
}

/**
* Adds an additional {@link AttributesExtractor} to invoke to set attributes to instrumented
* items.
*
* @deprecated This method is deprecated and will be removed in a future release
*/
@Deprecated
public VolleyTracingBuilder addAttributesExtractor(
AttributesExtractor<RequestWrapper, HttpResponse> attributesExtractor) {
additionalExtractors.add(attributesExtractor);
Expand All @@ -60,7 +69,9 @@ public VolleyTracingBuilder addAttributesExtractor(
* Configures the HTTP request headers that will be captured as span attributes.
*
* @param requestHeaders A list of HTTP header names.
* @deprecated This method is deprecated and will be removed in a future release
*/
@Deprecated
public VolleyTracingBuilder setCapturedRequestHeaders(List<String> requestHeaders) {
this.httpClientAttributesExtractorBuilder.setCapturedRequestHeaders(requestHeaders);
return this;
Expand All @@ -70,15 +81,20 @@ public VolleyTracingBuilder setCapturedRequestHeaders(List<String> requestHeader
* Configures the HTTP response headers that will be captured as span attributes.
*
* @param responseHeaders A list of HTTP header names.
* @deprecated This method is deprecated and will be removed in a future release
*/
@Deprecated
public VolleyTracingBuilder setCapturedResponseHeaders(List<String> responseHeaders) {
this.httpClientAttributesExtractorBuilder.setCapturedResponseHeaders(responseHeaders);
return this;
}

/**
* Returns a new {@link VolleyTracing} with the settings of this {@link VolleyTracingBuilder}.
*
* @deprecated This method is deprecated and will be removed in a future release
*/
@Deprecated
public VolleyTracing build() {
VolleyHttpClientAttributesGetter httpAttributesGetter =
VolleyHttpClientAttributesGetter.INSTANCE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ private NoOpSplunkRum() {
}

@Override
@Deprecated
public Call.Factory createRumOkHttpCallFactory(OkHttpClient client) {
return client;
}
Expand Down Expand Up @@ -81,11 +82,13 @@ void flushSpans() {
}

@Override
@Deprecated
public void experimentalSetScreenName(String screenName) {
// no-op
}

@Override
@Deprecated
public void experimentalSetScreenName(String screenName, String spanType) {
// no-op
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
* This annotation can be used to customize the {@code screen.name} attribute for an instrumented
* Fragment or Activity. @Deprecated RumScreenName moved to
* io.opentelemetry.rum.internal.instrumentation package
*
* @deprecated This interface is deprecated and will be removed in a future release
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Deprecated
public @interface RumScreenName {
/** Return the customized screen name. */
String value();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ static SplunkRum initialize(SplunkRumBuilder builder, Application application) {
*
* @param screenName Name of the new screen or null when exiting explicit UI navigation mode.
* @param spanType "Created", "Restarted", or "Resumed"
* @deprecated This method is deprecated and will be removed in a future release
*/
@Deprecated
public void experimentalSetScreenName(String screenName, String spanType) {
screenAttributesAppender.setScreenName(screenName);

Expand All @@ -140,7 +142,9 @@ public void experimentalSetScreenName(String screenName, String spanType) {
* Starts a "Created" UI navigation span and remembers the last screen name.
*
* @param screenName Name of the new screen or null when exiting explicit UI navigation mode.
* @deprecated This method is deprecated and will be removed in a future release
*/
@Deprecated
public void experimentalSetScreenName(String screenName) {
experimentalSetScreenName(screenName, "Created");
}
Expand Down Expand Up @@ -177,7 +181,9 @@ public static SplunkRum noop() {
*
* @param client The {@link OkHttpClient} to wrap with OpenTelemetry and RUM instrumentation.
* @return A {@link okhttp3.Call.Factory} implementation.
* @deprecated This method is deprecated and will be removed in a future release
*/
@Deprecated
public Call.Factory createRumOkHttpCallFactory(OkHttpClient client) {
return createOkHttpTracing().newCallFactory(client);
}
Expand Down Expand Up @@ -339,7 +345,9 @@ public void integrateWithBrowserRum(WebView webView) {
* LocationListener} or {@code LocationCallback}.
*
* @param location the current location. Passing {@code null} removes the location data.
* @deprecated This method is deprecated and will be removed in a future release
*/
@Deprecated
public void updateLocation(@Nullable Location location) {
if (location == null) {
updateGlobalAttributes(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ public SplunkRumBuilder setBeaconEndpoint(String beaconEndpoint) {
* @param customizer that can make changes to the OkHttpSender.Builder
* @return {@code this}
* @since 1.4.0
* @deprecated This method is deprecated and will be removed in a future release
*/
@Deprecated
public SplunkRumBuilder setHttpSenderCustomizer(HttpSenderCustomizer customizer) {
this.httpSenderCustomizer = customizer;
return this;
Expand Down Expand Up @@ -173,7 +175,9 @@ public SplunkRumBuilder enableDiskBuffering() {
* <p>This feature is disabled by default. You can enable it by calling this method.
*
* @return {@code this}
* @deprecated This method is deprecated and will be removed in a future release
*/
@Deprecated
public SplunkRumBuilder enableReactNativeSupport() {
configFlags.enableReactNativeSupport();
return this;
Expand Down Expand Up @@ -379,7 +383,9 @@ public SplunkRumBuilder enableBackgroundInstrumentationDeferredUntilForeground()
* Enables experimental support for exporting via OTLP instead of Zipkin.
*
* @return {@code this}
* @deprecated This method is deprecated and will be removed in a future release
*/
@Deprecated
public SplunkRumBuilder enableExperimentalOtlpExporter() {
if (isDiskBufferingEnabled()) {
Log.w(SplunkRum.LOG_TAG, "OTLP export is not yet compatible with disk buffering!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
* yet stable and its APIs are subject to change at any time.
*
* @since 1.4.0
* @deprecated This API is deprecated and will be removed in a future release.
*/
public interface HttpSenderCustomizer {

HttpSenderCustomizer DEFAULT = x -> {};

@Deprecated
void customize(OkHttpSender.Builder builder);
}

0 comments on commit 323a463

Please sign in to comment.