Skip to content

Commit

Permalink
Add attribute name to type warning message.
Browse files Browse the repository at this point in the history
Without this, the error message simply specifies that some attribute has the incorrect type, but this is very difficult to debug without knowing which attribute it was.
  • Loading branch information
aebrahim authored Jan 10, 2023
1 parent af83ef1 commit 3cc55d0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion opentelemetry-api/src/opentelemetry/attributes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ def _clean_attribute(
return tuple(cleaned_seq)

_logger.warning(
"Invalid type %s for attribute value. Expected one of %s or a "
"Invalid type %s for attribute '%s' value. Expected one of %s or a "
"sequence of those types",
type(value).__name__,
key,
[valid_type.__name__ for valid_type in _VALID_ATTR_VALUE_TYPES],
)
return None
Expand Down

0 comments on commit 3cc55d0

Please sign in to comment.