Skip to content

Commit

Permalink
Merge branch 'main' into fix_instrumentation_scope_encoding_to_otlp
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarker authored Dec 23, 2024
2 parents 3410495 + 92f221c commit 643c7b8
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
these attributes can be included in the Resource.*
Resource objects are created with `Resource.create`, which accepts attributes
(key-values). Resources should NOT be created via constructor, and working with
(key-values). Resources should NOT be created via constructor except by `ResourceDetector`
instances which can't use `Resource.create` to avoid infinite loops. Working with
`Resource` objects should only be done via the Resource API methods. Resource
attributes can also be passed at process invocation in the
:envvar:`OTEL_RESOURCE_ATTRIBUTES` environment variable. You should register
Expand Down Expand Up @@ -175,6 +176,8 @@ def create(
) -> "Resource":
"""Creates a new `Resource` from attributes.
`ResourceDetector` instances should not call this method.
Args:
attributes: Optional zero or more key-value pairs.
schema_url: Optional URL pointing to the schema
Expand Down Expand Up @@ -316,6 +319,7 @@ def __init__(self, raise_on_error: bool = False) -> None:

@abc.abstractmethod
def detect(self) -> "Resource":
"""Don't call `Resource.create` here to avoid an infinite loop, instead instantiate `Resource` directly"""
raise NotImplementedError()


Expand Down

0 comments on commit 643c7b8

Please sign in to comment.