Skip to content

Commit

Permalink
ref(metrics): Improve type hints for set metrics (#3048)
Browse files Browse the repository at this point in the history
Remove MetricValue from the set metric's value type hint. MetricValue is a union that includes floatwhich is correct based on how other parts of the code uses MetricValue. However, as floats are intentionally floored for set metrics, the current type hint might be confusing for a user as it looks like floats would work as unique values in a set.

Fixes GH-3038
  • Loading branch information
elramen committed May 14, 2024
1 parent 40746ef commit cc11c0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sentry_sdk/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ def distribution(

def set(
key, # type: str
value, # type: MetricValue
value, # type: Union[int, str]
unit="none", # type: MeasurementUnit
tags=None, # type: Optional[MetricTags]
timestamp=None, # type: Optional[Union[float, datetime]]
Expand Down

0 comments on commit cc11c0f

Please sign in to comment.