Skip to content

Commit

Permalink
Merge pull request #35102 from dimagi/gh/deduplicate/metrics
Browse files Browse the repository at this point in the history
Add metric for dedupe load
  • Loading branch information
gherceg authored Sep 10, 2024
2 parents b133773 + 53dfecc commit cece521
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions corehq/apps/data_interfaces/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
)
from corehq import toggles
from corehq.util.log import with_progress_bar
from corehq.util.metrics.load_counters import dedupe_load_counter
from corehq.util.quickcache import quickcache
from corehq.util.test_utils import unit_testing_only
from corehq.apps.locations.models import SQLLocation
Expand Down Expand Up @@ -1162,6 +1163,8 @@ def _handle_case_duplicate(self, case, rule):
if is_copied_case(case):
return CaseRuleActionResult()

dedupe_load_counter('unknown', case.domain)

if not case_matching_rule_criteria_exists_in_es(case, rule):
ALLOWED_ES_DELAY = timedelta(hours=1)
if datetime.utcnow() - case.server_modified_on > ALLOWED_ES_DELAY:
Expand Down
9 changes: 9 additions & 0 deletions corehq/util/metrics/load_counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ def ucr_load_counter(engine_id, *args, **kw):
return load_counter("ucr.{}".format(engine_id), *args, **kw)


def dedupe_load_counter(*args, **kw):
"""Make a deduplication load counter
This is used to count the number of cases that go through deduplication code.
"""
# grep: commcare.load.dedupe
return load_counter("dedupe", *args, **kw)


def schedule_load_counter(*args, **kw):
"""Make a schedule load counter function
Expand Down

0 comments on commit cece521

Please sign in to comment.