File tree 2 files changed +8
-5
lines changed
docs/examples/basic_tracer
opentelemetry-sdk/src/opentelemetry/sdk/resources
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 20
20
SimpleSpanProcessor ,
21
21
)
22
22
23
+ # Use Resource.create() instead of constructor directly
23
24
resource = Resource .create ({"service.name" : "basic_service" })
24
25
25
26
trace .set_tracer_provider (TracerProvider (resource = resource ))
Original file line number Diff line number Diff line change 23
23
these attributes can be included in the Resource.*
24
24
25
25
Resource objects are created with `Resource.create`, which accepts attributes
26
- (key-values). Resource attributes can also be passed at process invocation in
27
- the :envvar:`OTEL_RESOURCE_ATTRIBUTES` environment variable. You should
28
- register your resource with the `opentelemetry.sdk.trace.TracerProvider` by
29
- passing them into their constructors. The `Resource` passed to a provider is
30
- available to the exporter, which can send on this information as it sees fit.
26
+ (key-values). Resources should NOT be created via constructor, and working with
27
+ `Resource` objects should only be done via the Resource API methods. Resource
28
+ attributes can also be passed at process invocation in the
29
+ :envvar:`OTEL_RESOURCE_ATTRIBUTES` environment variable. You should register
30
+ your resource with the `opentelemetry.sdk.trace.TracerProvider` by passing
31
+ them into their constructors. The `Resource` passed to a provider is available
32
+ to the exporter, which can send on this information as it sees fit.
31
33
32
34
.. code-block:: python
33
35
You can’t perform that action at this time.
0 commit comments