Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Migration Guide

This guide provides instructions on how to migrate from the custom exporters in this repository to the standard OpenTelemetry OTLP exporters.

## Overview
Google Cloud now supports native OTLP (OpenTelemetry Protocol) ingestion for Cloud Trace and Cloud Monitoring via the [Telemetry API](https://docs.cloud.google.com/stackdriver/docs/reference/telemetry/overview). This allows you to use the standard OpenTelemetry OTLP exporters for sending telemetry data to Google Cloud.

## Migrate from OpenTelemetry Google Cloud Trace Exporter to OTLP exporter
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was imagining this would be fairly detailed, but I guess it doesn't have to be if it is covered in the GCP docs. We should make sure we tell users of each of the configuration options how they can obtain the same behavior with the OTLP exporter:

  • setFixedAttributes
  • setAttributeMapping


Follow the [Migrate from the Trace exporter to the OTLP endpoint](https://docs.cloud.google.com/trace/docs/migrate-to-otlp-endpoints) guide for migration instructions.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use https://docs.cloud.google.com/trace/docs/migrate-to-otlp-endpoints#java_3 to make sure it shows the java samples?


## Migrate from OpenTelemetry Google Cloud Monitoring Exporter to OTLP exporter

> [!NOTE] The Google Cloud OTLP metrics endpoint is currently in preview and the migration guides are being developed.

TODO: Add migration guide for metrics exporter
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things to cover for metrics other than just the default "make it work":

  • How to set a prefix with the OTLP exporter (Currently using setPrefix, or if they want the previous default workload.googleapis.com)
  • setResourceAttributesFilter
  • setInstrumentationLibraryLabelsEnabled


## Migrate from OpenTelemetry Google Cloud Auto Exporter

The Auto exporter allowed the [auto-configuration module](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure#opentelemetry-sdk-autoconfigure) of OpenTelemetry Java to work with OpenTelemetry Google Cloud Trace and Monitoring exporters in this repository.

The standard OpenTelemetry OTLP exporters natively support auto-configuration and are the recommended way to send telemetry to Google Cloud. You can configure the OTLP exporters using the standard [exporter properties](https://opentelemetry.io/docs/languages/java/configuration/#properties-exporters) that are supported by the autoconfiguration module.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Open-Telemetry Operations Exporters for Java

> [!WARNING]
> **DEPRECATION NOTICE**: This project and all its published artifacts are deprecated. No new features will be added, and this repository may be archived in the future.

[![Maven Central][maven-image]][maven-url]

Provides OpenTelemetry Exporters for Google Cloud Operations.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ subprojects {
}
afterEvaluate {
// description is not available until evaluated.
description = project.description
description = "DEPRECATED: " + project.description
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.google.cloud.opentelemetry.auto;

@Deprecated
public class Constants {

static final String CLOUD_TRACE_NAME = "google_cloud_trace";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,20 @@
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider;
import io.opentelemetry.sdk.metrics.export.MetricExporter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@AutoService(ConfigurableMetricExporterProvider.class)
@Deprecated
public class GoogleCloudMetricExporterFactory implements ConfigurableMetricExporterProvider {
private static final Logger logger =
LoggerFactory.getLogger(GoogleCloudMetricExporterFactory.class);

static {
logger.warn(
"Google Cloud OpenTelemetry Auto exporter for Java is deprecated. Please migrate to the OpenTelemetry OTLP exporters. For migration details, see https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/blob/main/MIGRATION.md");
}

@Override
public MetricExporter createExporter(ConfigProperties config) {
return GoogleCloudMetricExporter.createWithDefaultConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,19 @@
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider;
import io.opentelemetry.sdk.trace.export.SpanExporter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@AutoService(ConfigurableSpanExporterProvider.class)
@Deprecated
public class GoogleCloudSpanExporterFactory implements ConfigurableSpanExporterProvider {
private static final Logger logger =
LoggerFactory.getLogger(GoogleCloudSpanExporterFactory.class);

static {
logger.warn(
"Google Cloud OpenTelemetry Auto exporter for Java is deprecated. Please migrate to the OpenTelemetry OTLP exporters. For migration details, see https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/blob/main/MIGRATION.md");
}

@Override
public SpanExporter createExporter(ConfigProperties config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
* Builds GCM TimeSeries from each OTEL metric point, creating metric descriptors based on the
* "first" seen point for any given metric.
*/
@Deprecated
public final class AggregateByLabelMetricTimeSeriesBuilder implements MetricTimeSeriesBuilder {

public static final String LABEL_INSTRUMENTATION_SOURCE =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.List;

/** Wrapper interface for writing to Google Cloud Monitoring. */
@Deprecated
public interface CloudMetricClient {
/**
* Construct a metric descriptor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.List;

/** Directly talks to Cloud Monitoring. */
@Deprecated
public final class CloudMetricClientImpl implements CloudMetricClient {
private final MetricServiceClient metricServiceClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated
public class GoogleCloudMetricExporter implements MetricExporter {
private static final Logger logger = LoggerFactory.getLogger(GoogleCloudMetricExporter.class);

static {
logger.warn(
"Google Cloud OpenTelemetry Metric exporter for Java is deprecated. Please migrate to the OpenTelemetry OTLP exporters. For migration details, see https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/blob/main/MIGRATION.md");
}

private final Supplier<MetricExporter> internalMetricExporterSupplier;

private GoogleCloudMetricExporter(MetricConfiguration configuration) {
Expand Down Expand Up @@ -64,6 +70,7 @@ private GoogleCloudMetricExporter(MetricConfiguration configuration) {
* which gets initialized lazily once {@link GoogleCloudMetricExporter#export(Collection)} is
* called.
*/
@Deprecated
public static MetricExporter createWithDefaultConfiguration() {
return new GoogleCloudMetricExporter(MetricConfiguration.builder().build());
}
Expand All @@ -81,6 +88,7 @@ public static MetricExporter createWithDefaultConfiguration() {
* preferences for metrics.
* @return An instance of {@link GoogleCloudMetricExporter} as a {@link MetricExporter} object.
*/
@Deprecated
public static MetricExporter createWithConfiguration(MetricConfiguration configuration) {
return new GoogleCloudMetricExporter(configuration);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
*/
@AutoValue
@Immutable
@Deprecated
public abstract class MetricConfiguration {
static final String DEFAULT_PREFIX = "workload.googleapis.com";

Expand Down Expand Up @@ -224,6 +225,7 @@ public static Builder builder() {

/** Builder for {@link MetricConfiguration}. */
@AutoValue.Builder
@Deprecated
public abstract static class Builder {

Builder() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.function.Consumer;

/** The strategy for how to handle metric descriptors. */
@Deprecated
public interface MetricDescriptorStrategy {
/**
* Determines what to do with metric descriptors.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.List;

/** An interface that denotes how we build our API calls from metric data. */
@Deprecated
public interface MetricTimeSeriesBuilder {
/** Records a LongPoint of the given metric. */
void recordPoint(MetricData metric, LongPointData point);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.slf4j.LoggerFactory;

/** Utility methods to translate metrics from OTEL to GCM format. */
@Deprecated
public final class MetricTranslator {

private static final Logger logger = LoggerFactory.getLogger(MetricTranslator.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* identifying the given monitored resource type.
*/
@Immutable
@Deprecated
public final class MonitoredResourceDescription {
private final String mrType;
private final Set<String> mrLabels;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.logging.Logger;

/** Translates from OpenTelemetry Resource into Google Cloud Monitoring's MonitoredResource. */
@Deprecated
public class ResourceTranslator {
private static final String CUSTOM_MR_KEY = "gcp.resource_type";
private static final Logger LOGGER =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.devtools.cloudtrace.v2.Span;
import java.util.List;

@Deprecated
public interface CloudTraceClient {
void batchWriteSpans(ProjectName name, List<Span> spans);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.devtools.cloudtrace.v2.Span;
import java.util.List;

@Deprecated
public class CloudTraceClientImpl implements CloudTraceClient {
private final TraceServiceClient traceServiceClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
/** Configurations for {@link TraceExporter}. */
@AutoValue
@Immutable
@Deprecated
public abstract class TraceConfiguration {

@VisibleForTesting static final Duration DEFAULT_DEADLINE = Duration.ofSeconds(10, 0);
Expand Down Expand Up @@ -149,6 +150,7 @@ public static Builder builder() {

/** Builder for {@link TraceConfiguration}. */
@AutoValue.Builder
@Deprecated
public abstract static class Builder {

@VisibleForTesting static final Duration ZERO = Duration.ZERO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated
public class TraceExporter implements SpanExporter {

private static final Logger logger = LoggerFactory.getLogger(TraceExporter.class);

static {
logger.warn(
"Google Cloud OpenTelemetry Trace exporter for Java is deprecated. Please migrate to the OpenTelemetry OTLP exporters. For migration details, see https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/blob/main/MIGRATION.md");
}

private final Supplier<SpanExporter> internalTraceExporterSupplier;

private TraceExporter(TraceConfiguration configuration) {
Expand Down Expand Up @@ -62,6 +68,7 @@ private TraceExporter(TraceConfiguration configuration) {
* @return A configured instance of {@link TraceExporter} which gets initialized lazily once
* {@link TraceExporter#export(Collection)} is called.
*/
@Deprecated
public static SpanExporter createWithDefaultConfiguration() {
return new TraceExporter(TraceConfiguration.builder().build());
}
Expand All @@ -79,6 +86,7 @@ public static SpanExporter createWithDefaultConfiguration() {
* for trace.
* @return An instance of {@link TraceExporter} as a {@link SpanExporter} object
*/
@Deprecated
public static SpanExporter createWithConfiguration(TraceConfiguration configuration) {
return new TraceExporter(configuration);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import javax.annotation.Nullable;

/** Helper to grab version numbers from builds. */
@Deprecated
public class TraceVersions {

public static final String SDK_VERSION = readSdkVersion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* propagation.
*/
@AutoService(ConfigurablePropagatorProvider.class)
@Deprecated
public class OneWayXCloudTraceConfigurablePropagatorProvider
implements ConfigurablePropagatorProvider {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* @see OneWayXCloudTraceConfigurablePropagatorProvider
*/
@AutoService(ConfigurablePropagatorProvider.class)
@Deprecated
public class XCloudTraceConfigurablePropagatorProvider implements ConfigurablePropagatorProvider {
@Override
public TextMapPropagator getPropagator(ConfigProperties config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* <p>See: <a href="https://cloud.google.com/trace/docs/setup#force-trace">Google Cloud Trace
* Documentation</a> for details.
*/
@Deprecated
public final class XCloudTraceContextPropagator implements TextMapPropagator {

private static final String FIELD = "x-cloud-trace-context";
Expand All @@ -53,7 +54,10 @@ public final class XCloudTraceContextPropagator implements TextMapPropagator {
*
* @param oneway boolean to configure if the trace should propagate in a single direction.
*/
@Deprecated
public XCloudTraceContextPropagator(boolean oneway) {
LOGGER.warning(
"XCloudTraceContextPropagator is deprecated and will be removed in a future release.");
this.oneway = oneway;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* <p>Unlike pure OpenTelemetry, GCP adds a "type" to a raw bundle of labels.
*/
@AutoValue
@Deprecated
public abstract class GcpResource {
/** The type of resource, e.g. gce_instance. */
public abstract String getResourceType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* Guice for collections.
*/
@AutoValue
@Deprecated
public abstract class ResourceLabels {
public abstract Map<String, String> getLabels();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.Optional;

/** Translates from OpenTelemetry Resource into Google Cloud's notion of resource. */
@Deprecated
public class ResourceTranslator {

private static final String UNKNOWN_SERVICE_PREFIX = "unknown_service";
Expand Down
Loading