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(insights): Add division_if for span metrics #72995

Merged
merged 7 commits into from
Jul 17, 2024

Conversation

philipphofmann
Copy link
Member

Add division_if for span metrics so we can calculate rates such as slow and frozen rates.

Add division_if for span metrics so we can calculate rates such as
slow and frozen rates.
@philipphofmann philipphofmann requested review from a team as code owners June 19, 2024 09:13
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 19, 2024
Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.08%. Comparing base (b35aea1) to head (e7b01be).
Report is 2 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #72995       +/-   ##
===========================================
+ Coverage   64.40%   78.08%   +13.68%     
===========================================
  Files        6673     6677        +4     
  Lines      298641   298874      +233     
  Branches    51437    51466       +29     
===========================================
+ Hits       192350   233389    +41039     
+ Misses      99806    59219    -40587     
+ Partials     6485     6266      -219     
Files Coverage Δ
src/sentry/search/events/datasets/spans_metrics.py 86.48% <100.00%> (+0.29%) ⬆️

... and 1708 files with indirect coverage changes

@philipphofmann philipphofmann self-assigned this Jun 20, 2024
@philipphofmann philipphofmann changed the title feat(starfish): Add division_if for span metrics feat(insights): Add division_if for span metrics Jun 20, 2024
Copy link
Member

@narsaynorath narsaynorath left a comment

Choose a reason for hiding this comment

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

Just a comment about the test setup, but I think the code looks good

Comment on lines 124 to 129
self.store_span_metric(
1,
internal_metric=constants.SPAN_METRICS_MAP["mobile.slow_frames"],
timestamp=self.three_days_ago,
tags={"release": "1.0.0"},
)
Copy link
Member

Choose a reason for hiding this comment

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

These look like they'd pass but that's just because of how the data is being mocked and where the mock data is set up. There's another example of slow frames tests here where the first arg is actually passed as an object which is consistent for the gauge type, I'd suggest changing these to match that type to make sure it's working the way you want for these metrics, e.g.

        self.store_span_metric(
            {
                "min": 1,
                "max": 1,
                "sum": 1,
                "count": 1,
                "last": 1,
            },
            entity="metrics_gauges",
            metric="mobile.slow_frames",
            timestamp=self.six_min_ago,
            tags={"release": "foo"},
        )

Total frames might be the only one that needs to have different values for min/max/sum/count/last when entered

@getsantry
Copy link
Contributor

getsantry bot commented Jul 12, 2024

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

Copy link
Member

@narsaynorath narsaynorath 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, just left a comment on naming. Thanks for finding that column is actually a special arg that we need to define, we won't be able to change that one but we could do the second column

src/sentry/search/events/datasets/spans_metrics.py Outdated Show resolved Hide resolved
@markushi markushi merged commit a88b476 into master Jul 17, 2024
50 checks passed
@markushi markushi deleted the feat/starfish-divide-if branch July 17, 2024 16:33
@markushi markushi removed the WIP label Jul 18, 2024
priscilawebdev pushed a commit that referenced this pull request Jul 18, 2024
Add division_if for span metrics so we can calculate rates such as slow
and frozen rates.

---------

Co-authored-by: Markus Hintersteiner <markus.hintersteiner@sentry.io>
markushi added a commit that referenced this pull request Jul 26, 2024
As described [here](#73039),
we want to move to ratios for slow and frozen frames.

Utilizes [division_if](#72995)
to calculate the ratios.

<img width="1240" alt="image"
src="https://github.com/user-attachments/assets/66d0b3ee-22ff-43eb-aee6-9242b9d3404a">
@github-actions github-actions bot locked and limited conversation to collaborators Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants