Skip to content
Open
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
481 changes: 481 additions & 0 deletions MIGRATION.md
Comment thread
DylanRussell marked this conversation as resolved.

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ for Google Cloud Platform.
To get started with instrumentation in Google Cloud, see [Generate traces and metrics with
Python](https://cloud.google.com/stackdriver/docs/instrumentation/setup/python).

## ⚠️ Deprecation Notice

**All custom Google Cloud exporters in this repository (`opentelemetry-exporter-gcp-trace`, `opentelemetry-exporter-gcp-monitoring`, and `opentelemetry-exporter-gcp-logging`) are deprecated.**

Google Cloud supports native OpenTelemetry Protocol (OTLP) ingestion for Cloud Trace, Cloud Monitoring, and Cloud Logging via the [Telemetry API](https://docs.cloud.google.com/stackdriver/docs/reference/telemetry/overview).

Please refer to the [Migration Guide](MIGRATION.md) for detailed instructions on migrating your application to standard OpenTelemetry OTLP exporters.

## Documentation

To learn more about instrumentation and observability, including opinionated recommendations
Expand Down
2 changes: 2 additions & 0 deletions opentelemetry-exporter-gcp-logging/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ install_requires =
opentelemetry-api >= 1.39.0

opentelemetry-resourcedetector-gcp >= 1.5.0dev0, == 1.*
typing-extensions


[options.packages.find]
where = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
from proto.datetime_helpers import ( # type: ignore[import]
DatetimeWithNanoseconds,
)
from typing_extensions import deprecated # type: ignore[attr-defined]

DEFAULT_MAX_ENTRY_SIZE = 256000 # 256 KB
DEFAULT_MAX_REQUEST_SIZE = 10000000 # 10 MB
Expand Down Expand Up @@ -254,6 +255,10 @@ def _get_monitored_resource(
)


@deprecated(
"CloudLoggingExporter is deprecated. See migration guide at "
"https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/blob/main/MIGRATION.md"
)
class CloudLoggingExporter(LogRecordExporter):
def __init__(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,3 +446,9 @@ def test_structured_json_lines():
{"logging.googleapis.com/labels":{"event.name":"foo","key":"4"},"logging.googleapis.com/spanId":"0000000000000016","logging.googleapis.com/trace":"projects/fakeproject/traces/00000000000000000000000000000019","logging.googleapis.com/trace_sampled":false,"message":"hello","severity":"ERROR","time":"2025-01-15T21:25:10.997977393Z"}
"""
), "Each `LogData` should be on its own line"


def test_deprecation_warning():
buf = StringIO()
with pytest.deprecated_call():
CloudLoggingExporter(project_id=PROJECT_ID, structured_json_file=buf)
2 changes: 2 additions & 0 deletions opentelemetry-exporter-gcp-monitoring/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ install_requires =
opentelemetry-api ~= 1.30
opentelemetry-sdk ~= 1.30
opentelemetry-resourcedetector-gcp >= 1.5.0dev0, == 1.*
typing-extensions


[options.packages.find]
where = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
NumberDataPoint,
Sum,
)
from typing_extensions import deprecated # type: ignore[attr-defined]

logger = logging.getLogger(__name__)
MAX_BATCH_WRITE = 200
Expand All @@ -92,6 +93,10 @@
# pylint: disable=no-member
# pylint: disable=too-many-branches
# pylint: disable=too-many-locals
@deprecated(
"CloudMonitoringMetricsExporter is deprecated. See migration guide at "
"https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/blob/main/MIGRATION.md"
)
class CloudMonitoringMetricsExporter(MetricExporter):
"""Implementation of Metrics Exporter to Google Cloud Monitoring

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
}


def test_deprecation_warning() -> None:
client = MetricServiceClient(credentials=AnonymousCredentials())
with pytest.deprecated_call():
CloudMonitoringMetricsExporter(project_id=PROJECT_ID, client=client)


def test_create_monitoring_exporter() -> None:
client = MetricServiceClient(credentials=AnonymousCredentials())
CloudMonitoringMetricsExporter(project_id=PROJECT_ID, client=client)
Expand Down
2 changes: 2 additions & 0 deletions opentelemetry-exporter-gcp-trace/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ install_requires =
opentelemetry-api ~= 1.30
opentelemetry-sdk ~= 1.30
opentelemetry-resourcedetector-gcp >= 1.5.0dev0, == 1.*
typing-extensions


[options.packages.find]
where = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
from opentelemetry.trace import format_span_id, format_trace_id
from opentelemetry.trace.status import StatusCode
from opentelemetry.util import types
from typing_extensions import deprecated # type: ignore[attr-defined]

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -152,6 +153,10 @@ def _create_default_client() -> TraceServiceClient:
)


@deprecated(
"CloudTraceSpanExporter is deprecated. See migration guide at "
"https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/blob/main/MIGRATION.md"
)
class CloudTraceSpanExporter(SpanExporter):
"""Cloud Trace span exporter for OpenTelemetry.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ def tearDown(self):
for patcher in self.patchers:
patcher.stop()

def test_deprecation_warning(self):
with self.assertWarns(DeprecationWarning):
CloudTraceSpanExporter(project_id=self.project_id)

@classmethod
def setUpClass(cls):
cls.project_id = "PROJECT"
Expand Down
Loading