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

Report app dependency removal to DataDog #35455

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Charl1996
Copy link
Contributor

@Charl1996 Charl1996 commented Nov 28, 2024

Relates to this PR

Technical Summary

Ticket

This PR increments a counter on DataDog whenever the app dependencies feature has been disabled for a build which had it enabled which allows us to track the feature drop-out rate. We don't need to know any domain information, just the overall counter.

Note that the counter is incremented during the make_build phase.

(The related PR will be changed to support a management command which will be run to "top up" the counter with historic data)

Safety Assurance

Safety story

Tested locally as far as I could. Testing on staging will commence.

Automated test coverage

No automated tests included.

QA Plan

No formal QA will be done

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


latest_build = get_latest_build_doc(self.domain, self.id)
if not latest_build:
Copy link
Contributor

Choose a reason for hiding this comment

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

When would there not be a latest build?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The "latest_build" here refers to the previous build, as the new build has not been made at this point. So the "latest_build" could be None if it's the first build.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see, thanks for the clarification

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: to make it slightly better, you could consider naming this last_build.

Copy link
Contributor

@ajeety4 ajeety4 left a comment

Choose a reason for hiding this comment

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

LGTM

return

if has_dependencies(latest_build) and not has_dependencies(new_build):
metrics_counter('commcare.app_build.dependencies_removed')
Copy link
Contributor

Choose a reason for hiding this comment

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

I like that we have simplified the approach here.

Wanted to check if this metric in itself would be useful? Don't we need the uptake as well?
I believe on datadog you can have a counter with both positive and negative values, so you get a graph with both additions and removals at once.
example here

Or we could report uptake separately, which seems easy enough to add now.

if (not latest_build or not has_dependencies(latest_build)) and has_dependencies(new_build):
    metrics_counter('commcare.app_build.dependencies_added')

I would vote for the single counter with both +/-

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe on datadog you can have a counter with both positive and negative values, so you get a graph with both additions and removals at once.

I'll check this out. Thanks for the suggestion.

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.

4 participants