From 04f41fe13fc217fdc5b005fa9caee638efae8724 Mon Sep 17 00:00:00 2001 From: Rohan Sood Date: Thu, 19 Feb 2026 02:47:41 -0800 Subject: [PATCH 1/3] Fix Resource constructor examples to use Resource.create Signed-off-by: Rohan Sood --- docs/examples/opencensus-shim/app.py | 2 +- docs/exporter/prometheus/prometheus.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/examples/opencensus-shim/app.py b/docs/examples/opencensus-shim/app.py index 9103ba53337..6a110d8f0ff 100644 --- a/docs/examples/opencensus-shim/app.py +++ b/docs/examples/opencensus-shim/app.py @@ -31,7 +31,7 @@ # Set up OpenTelemetry tracer_provider = TracerProvider( - resource=Resource( + resource=Resource.create( { "service.name": "opencensus-shim-example-flask", } diff --git a/docs/exporter/prometheus/prometheus.rst b/docs/exporter/prometheus/prometheus.rst index f5c446f1cdf..d7a46793312 100644 --- a/docs/exporter/prometheus/prometheus.rst +++ b/docs/exporter/prometheus/prometheus.rst @@ -27,7 +27,7 @@ Prometheus text format on request:: from opentelemetry.sdk.resources import SERVICE_NAME, Resource # Service name is required for most backends - resource = Resource(attributes={ + resource = Resource.create(attributes={ SERVICE_NAME: "your-service-name" }) From 0e209ce30b64f96742bd47901282e0a1838f9968 Mon Sep 17 00:00:00 2001 From: Rohan Sood Date: Thu, 19 Feb 2026 02:59:21 -0800 Subject: [PATCH 2/3] retrigger CI Signed-off-by: Rohan Sood From fbb5a7c89369bcbecacdd285b5ee7c95345fb428 Mon Sep 17 00:00:00 2001 From: rohansood10 Date: Thu, 19 Feb 2026 07:55:24 -0800 Subject: [PATCH 3/3] Fix Resource constructor in OTLP exporter examples Address review feedback: also update Resource(attributes=...) to Resource.create(...) in otlp-proto-grpc and otlp-proto-http exporter module docstrings. --- .../src/opentelemetry/exporter/otlp/proto/grpc/__init__.py | 2 +- .../src/opentelemetry/exporter/otlp/proto/http/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/__init__.py index 12275ef481a..93972cc9af4 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/__init__.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/__init__.py @@ -50,7 +50,7 @@ # Resource can be required for some backends, e.g. Jaeger # If resource wouldn't be set - traces wouldn't appears in Jaeger - resource = Resource(attributes={ + resource = Resource.create({ "service.name": "service" }) diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/__init__.py index b8f92bd9a87..745a60424e7 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/__init__.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/__init__.py @@ -50,7 +50,7 @@ # Resource can be required for some backends, e.g. Jaeger # If resource wouldn't be set - traces wouldn't appears in Jaeger - resource = Resource(attributes={ + resource = Resource.create({ "service.name": "service" })