Skip to content

Add ProjectDB operations to datadog - #38130

Merged
esoergel merged 3 commits into
es/no-case-case-searchfrom
es/projectdb-metrics
Sep 10, 2026
Merged

Add ProjectDB operations to datadog#38130
esoergel merged 3 commits into
es/no-case-case-searchfrom
es/projectdb-metrics

Conversation

@esoergel

@esoergel esoergel commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Product Description

no user-facing changes

Technical Summary

Add a few metrics to datadog for key ProjectDB operations

Feature Flag

Safety Assurance

Safety story

Automated test coverage

QA Plan

Rollback instructions

  • This PR can be reverted after deploy with no further considerations

Labels & Review

  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@esoergel esoergel added the product/invisible Change has no end-user visible impact label Sep 9, 2026
@esoergel esoergel changed the title Es/projectdb metrics Add ProjectDB operations to datadog Sep 9, 2026
@esoergel
esoergel force-pushed the es/projectdb-metrics branch from 518c17d to 7f4eeff Compare September 9, 2026 12:07
@esoergel
esoergel changed the base branch from master to es/no-case-case-search September 9, 2026 12:07
Tagged by endpoint ID, so a slow endpoint can be identified without
correlating against the domain's other projectDB traffic.
@esoergel
esoergel force-pushed the es/projectdb-metrics branch from 7f4eeff to 1677d41 Compare September 9, 2026 12:54
@esoergel
esoergel marked this pull request as ready for review September 9, 2026 16:21
for case_type, case_type_cases in cases_by_type.items():
populate_case_type(domain, case_type, case_type_cases)
metric = 'commcare.project_db.populate.duration'
with metrics_histogram_timer(metric, timing_buckets=(.1, .5, 1, 2, 5), tags={'domain': domain}):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we use (.1, .5, 1, 2, 5) in other places. Should there be a constant to standardize it?

@esoergel esoergel Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I dunno, depends on whether they should be connected. The timing buckets depend on the application - some things we expect to be fast, some things slower, and the bucketing should reflect that. Like, I'd expect queries to usually be fast, but certainly could be slow, while row insertions should definitely be fast. That said, when comparing two things apples to apples, it would be nice to have the same buckets for each.

Another thought is we could come up with a platform-wide idea of different categories of speed that apply to a range of things, like:

  • Imperceptible
  • Fast
  • Medium (user is waiting, but some hesitation is acceptable)
  • Slow (will require UI affordances)
  • Long-running (imports, migrations, etc)

And then define benchmarks around each of those, bucketing as appropriate. It'd be nice to have a more concrete way to talk about and measure performance - I bet the product team would be interested.

result = user_sql.run(query_params, max_rows=CASE_SEARCH_MAX_RESULTS)
with metrics_histogram_timer(
'commcare.project_db.endpoint_query.duration',
timing_buckets=(.1, .5, 1, 2, 5, 10),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

case in point

@esoergel
esoergel merged commit 5787733 into es/no-case-case-search Sep 10, 2026
8 checks passed
@esoergel
esoergel deleted the es/projectdb-metrics branch September 10, 2026 08:24
@esoergel
esoergel restored the es/projectdb-metrics branch September 10, 2026 08:26
@esoergel
esoergel deleted the es/projectdb-metrics branch September 10, 2026 08:26
@esoergel
esoergel restored the es/projectdb-metrics branch September 10, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product/invisible Change has no end-user visible impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants