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

ref(profiles): Counting profiles, V2 #2163

Merged
merged 8 commits into from
Jun 5, 2023
Merged

Conversation

jjbayer
Copy link
Member

@jjbayer jjbayer commented May 31, 2023

Instead of counting processed profiles in two different places (see #2054), add a has_profile tag to the transaction counter metric, and define

processed_profiles := count(processed_transactions) WHERE has_profile = true

Changes

This PR contains the following changes:

Caveats

With this PR, rate limits will be applied consistently if they are issued for DataCategory.Transaction. However, if a rate limit with a numeric value > 0 (e.g. spike protection) is issued only for DataCategory.Profile, it will not be enforced correctly.

Rollout Order

  1. Merge and deploy feat(profiles): Count processed profiles in billing metrics consumer sentry#50047. The billing metrics consumer will now listen for profiles, but not receive any.
  2. Deploy processing Relays. Profile counts will go down, because PoP-Relays are not sending the has_profile tag yet.
  3. Deploy PoP Relays. Profile counts should go back to normal.

In case of rollback

  1. First revert the sentry change (feat(profiles): Count processed profiles in billing metrics consumer sentry#50047) and deploy it to stop counting profiles.
  2. Then revert the Relay change (this PR) and deploy to processing Relays and PoPs.

ref: #2158

@jjbayer jjbayer marked this pull request as ready for review June 1, 2023 06:53
@jjbayer jjbayer requested a review from a team June 1, 2023 06:53
As described in #2158, track
the number of processed profiles by tagging the corresponding
transaction metric.

Also: Do not accept multiple profiles per envelope.

**Not in this PR:**
* Distinguishing between `Profile` and `ProfileIndexed`
* Rate limiting processed profiles based on metrics

---------

Co-authored-by: Iker Barriocanal <32816711+iker-barriocanal@users.noreply.github.com>
@jjbayer jjbayer requested a review from a team as a code owner June 2, 2023 09:15
@jjbayer jjbayer changed the title ref(profiles): Revert counting of processed profiles ref(profiles): Counting profiles, V2 Jun 5, 2023
jjbayer added a commit to getsentry/sentry that referenced this pull request Jun 5, 2023
…50047)

Currently, accepted processed profiles are counted in Relay. To align
processed transactions and processed profiles more consistently, we will
change this by adding a tag to the `transaction.duration` metric (which
we use for counting transactions), and defining `num_processed_profiles
:= num_processed_transactions with profiles` (see issue linked below for
more information).

This PR needs to be deployed _before_
getsentry/relay#2163 to prevent over-counting.

ref: getsentry/relay#2158
@jjbayer jjbayer merged commit 7452732 into master Jun 5, 2023
19 checks passed
@jjbayer jjbayer deleted the ref/profiles-revert-count branch June 5, 2023 13:09
jjbayer added a commit that referenced this pull request Jun 6, 2023
Follow-up to #2163:

When transaction metric buckets are rate limited, we only report
outcomes for transactions, not profiles.

With this PR, `RateLimited` will be reported for the `Profile` category
as well.

ref: #2158
jjbayer added a commit that referenced this pull request Jun 13, 2023
In #2163 we decided not to
enforce rate limits on processed profiles with `limit > 0`, to prevent
complexity (see PR description).

I wrongly assumed that quotas (i.e. rate limits with `limit:0`) would be
correctly enforced by dropping the profile envelope item before metrics
are extracted. I overlooked the fact that PoP Relays (where metrics are
extracted) do not _receive_ quota configuration, because they do not
request it:


https://github.com/getsentry/relay/blob/0505c88f932d89bd42ee75114440f7f08fe7d938/relay-server/src/actors/project_upstream.rs#L273

Note that this only affects rate limits that are issued _only_ for
profiles. Rate limits issued for _transactions_ correctly drop the
processed profiles.

This PR fixes the issue by stripping the `has_profile` tag off metrics
buckets if a `Profile` rate limit is active.

Fixes #2207
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