Skip to content

Commit f0451bd

Browse files
authored
Fix Resource constructor examples to use Resource.create() (#4925)
* Fix Resource constructor examples to use Resource.create Signed-off-by: Rohan Sood <rohansood10@users.noreply.github.com> * retrigger CI Signed-off-by: Rohan Sood <rohansood10@users.noreply.github.com> * 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. --------- Signed-off-by: Rohan Sood <rohansood10@users.noreply.github.com> Co-authored-by: Rohan Sood <rohansood10@users.noreply.github.com>
1 parent f32b684 commit f0451bd

File tree

4 files changed

+4
-4
lines changed
  • docs
  • exporter
    • opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc
    • opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http

4 files changed

+4
-4
lines changed

docs/examples/opencensus-shim/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
# Set up OpenTelemetry
3333
tracer_provider = TracerProvider(
34-
resource=Resource(
34+
resource=Resource.create(
3535
{
3636
"service.name": "opencensus-shim-example-flask",
3737
}

docs/exporter/prometheus/prometheus.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Prometheus text format on request::
2727
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
2828

2929
# Service name is required for most backends
30-
resource = Resource(attributes={
30+
resource = Resource.create(attributes={
3131
SERVICE_NAME: "your-service-name"
3232
})
3333

exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
5151
# Resource can be required for some backends, e.g. Jaeger
5252
# If resource wouldn't be set - traces wouldn't appears in Jaeger
53-
resource = Resource(attributes={
53+
resource = Resource.create({
5454
"service.name": "service"
5555
})
5656

exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
5151
# Resource can be required for some backends, e.g. Jaeger
5252
# If resource wouldn't be set - traces wouldn't appears in Jaeger
53-
resource = Resource(attributes={
53+
resource = Resource.create({
5454
"service.name": "service"
5555
})
5656

0 commit comments

Comments
 (0)