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

feat: Code locations for metrics #2526

Merged
merged 10 commits into from Nov 24, 2023
Merged

feat: Code locations for metrics #2526

merged 10 commits into from Nov 24, 2023

Conversation

jan-auer
Copy link
Member

@jan-auer jan-auer commented Nov 23, 2023

DDM wants to show code locations with metrics. Locations are semi-static information: they change infrequently, so they don't need to be reported with every data point.

Sentry expects locations to be reported at least once per day. With backdating of metrics, the timestamp used to report the location is the metric bucket's timestamp rounded down to the start of the day (UTC timezone).

The metrics aggregator keeps a cache of previously reported locations. When a location is seen for the first time on a day, it is added to a list of pending locations. On the next flush cycle, all pending locations are sent to Sentry in the same envelope as the metric buckets.

See: getsentry/relay#2751
Epic: getsentry/sentry#60260

@jan-auer jan-auer self-assigned this Nov 23, 2023
@jan-auer jan-auer marked this pull request as ready for review November 23, 2023 12:26
@antonpirker
Copy link
Member

The mock imports should be like this to work everywhere:

try:
    from unittest import mock  # python 3.3 and above
except ImportError:
    import mock  # python < 3.3

Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I few minor changes I mentioned.

sentry_sdk/client.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
sentry_sdk/client.py Outdated Show resolved Hide resolved
sentry_sdk/metrics.py Show resolved Hide resolved
sentry_sdk/metrics.py Outdated Show resolved Hide resolved
Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 🚢

@antonpirker antonpirker merged commit a67914c into master Nov 24, 2023
313 of 314 checks passed
@antonpirker antonpirker deleted the feature/code-locations branch November 24, 2023 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants