Skip to content

feat(inbound-filters) Add health check inbound filter - #49176

Merged
RaduW merged 37 commits into
masterfrom
feat/metrics/inbount-filter-health-checks
Jun 28, 2023
Merged

feat(inbound-filters) Add health check inbound filter#49176
RaduW merged 37 commits into
masterfrom
feat/metrics/inbount-filter-health-checks

Conversation

@RaduW

@RaduW RaduW commented May 16, 2023

Copy link
Copy Markdown
Contributor

This PR adds support for inbound filters for health check transactions.

implements: #49081

@RaduW
RaduW requested a review from a team May 16, 2023 10:39
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 16, 2023

@jjbayer jjbayer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me! See comments about tests, especially the one about validate_project_config.

Comment thread src/sentry/ingest/inbound_filters.py Outdated
Comment on lines +409 to +431
@pytest.mark.django_db
@pytest.mark.parametrize("is_business", [True, False], ids=["business_plan", "free_plan"])
def test_health_check_filters(call_endpoint, add_org_key, relay, default_project, is_business):
"""
Test that only business plans contain healthcheck filters
"""
relay.save()

default_project.update_option("filters:health-check", "1")
with Feature({"organizations:health-check-filter": is_business}):
result, status_code = call_endpoint(full_config=True, version=2)

assert status_code < 400

configs = safe.get_path(result, "configs")

(project_key,) = configs.keys()
filter_settings = safe.get_path(configs, project_key, "config", "filterSettings")
assert filter_settings is not None

has_health_check = "healthCheck" in filter_settings

assert has_health_check == is_business

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • This test could be moved to test_config.py, i.e. test get_project_config directly instead of testing the endpoint.
  • Please call validate_project_config in one of the tests to make sure that relay can parse the new config.

Comment thread tests/sentry/api/endpoints/test_project_filter_details.py Outdated
Co-authored-by: Joris Bayer <joris.bayer@sentry.io>
Co-authored-by: Joris Bayer <joris.bayer@sentry.io>

@priscilawebdev priscilawebdev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the code looks good to me

Comment thread src/sentry/tsdb/base.py
# the number of events filtered because their group was discarded
project_total_received_discarded = 610
# the number of events filtered because they refer to a healthcheck endpoint
project_total_healthcheck = 611

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we need this? Jan told me once that this is something really old and not very used

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

just saw that it is being used. so never mind


if filter_id in ("browser-extensions", "localhost", "web-crawlers"):
if filter_id in (
FilterStatKeys.BROWSER_EXTENSION,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is great 👏

@RaduW
RaduW requested a review from a team as a code owner May 17, 2023 17:12
@github-actions

Copy link
Copy Markdown
Contributor

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 label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


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

@codecov

codecov Bot commented Jun 27, 2023

Copy link
Copy Markdown

Codecov Report

Merging #49176 (b65707f) into master (fe26c8d) will decrease coverage by 1.70%.
The diff coverage is 91.42%.

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #49176     +/-   ##
=========================================
- Coverage    81.30    79.60   -1.70     
=========================================
  Files        4897     4897             
  Lines      205567   205584     +17     
  Branches    11051    11051             
=========================================
- Hits       167121   163654   -3467     
- Misses      38201    41685   +3484     
  Partials      245      245             
Impacted Files Coverage Δ
src/sentry/conf/server.py 91.84% <ø> (ø)
src/sentry/api/endpoints/project_filter_details.py 33.92% <33.33%> (-46.43%) ⬇️
src/sentry/ingest/inbound_filters.py 71.87% <94.11%> (-15.49%) ⬇️
src/sentry/api/endpoints/project_filters.py 100.00% <100.00%> (ø)
src/sentry/dynamic_sampling/__init__.py 100.00% <100.00%> (ø)
...sampling/rules/biases/ignore_health_checks_bias.py 100.00% <100.00%> (ø)
src/sentry/features/__init__.py 100.00% <100.00%> (ø)
...y/ingest/transaction_clusterer/datasource/snuba.py 100.00% <100.00%> (ø)
src/sentry/projectoptions/defaults.py 100.00% <100.00%> (ø)
src/sentry/relay/config/__init__.py 97.03% <100.00%> (+0.04%) ⬆️
... and 2 more

... and 258 files with indirect coverage changes

@RaduW
RaduW force-pushed the feat/metrics/inbount-filter-health-checks branch from 1a3095f to b65707f Compare June 28, 2023 07:34
@RaduW
RaduW merged commit 9305f12 into master Jun 28, 2023
@RaduW
RaduW deleted the feat/metrics/inbount-filter-health-checks branch June 28, 2023 08:06
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 13, 2023
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.

5 participants