Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading set metric value type hint #3038

Closed
elramen opened this issue May 2, 2024 · 0 comments · Fixed by #3048
Closed

Misleading set metric value type hint #3038

elramen opened this issue May 2, 2024 · 0 comments · Fixed by #3048
Assignees

Comments

@elramen
Copy link
Contributor

elramen commented May 2, 2024

How do you use Sentry?

Sentry Saas (sentry.io)

Version

2

Steps to Reproduce

  1. Write sentry_sdk.metrics.set and hover over set to see that the type hint for value is MetricValue. Go to the definition of MetricValue to see its definition: Union[int, float, str].

  2. Emit a set metric two times using the same metric name but values that differ in the decimals, e.g., sentry_sdk.metrics.set("test", 1.2)
    sentry_sdk.metrics.set("test", 1.6)

Expected Result

Metric shows unique count of 2 in the sentry.io dashboard.

Actual Result

Metric shows unique count of 1 in the sentry.io dashboard.

@elramen elramen self-assigned this May 2, 2024
elramen added a commit that referenced this issue May 14, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant