Skip to content

Commit

Permalink
Document preferred method for attribute setting (#2712)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl authored May 25, 2022
1 parent 8200f45 commit 709afdd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions opentelemetry-api/src/opentelemetry/trace/span.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ def set_attributes(
Sets Attributes with the key and value passed as arguments dict.
Note: The behavior of `None` value attributes is undefined, and hence strongly discouraged.
Note: The behavior of `None` value attributes is undefined, and hence
strongly discouraged. It is also preferred to set attributes at span
creation, instead of calling this method later since samplers can only
consider information already present during span creation.
"""

@abc.abstractmethod
Expand All @@ -95,7 +98,10 @@ def set_attribute(self, key: str, value: types.AttributeValue) -> None:
Sets a single Attribute with the key and value passed as arguments.
Note: The behavior of `None` value attributes is undefined, and hence strongly discouraged.
Note: The behavior of `None` value attributes is undefined, and hence
strongly discouraged. It is also preferred to set attributes at span
creation, instead of calling this method later since samplers can only
consider information already present during span creation.
"""

@abc.abstractmethod
Expand Down

0 comments on commit 709afdd

Please sign in to comment.