Skip to content

Commit

Permalink
update calculate metrics task return value
Browse files Browse the repository at this point in the history
  • Loading branch information
jabelone committed May 31, 2024
1 parent da579e2 commit defd85f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions memberportal/api_metrics/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ def setup_periodic_tasks(sender, **kwargs):
@app.task
def calculate_metrics():
logger.info("Calculating metrics!")
metric_results = {
"member_count": [],
"subscription_count": [],
}

# get the count of all the different member profile states
logger.debug("Calculating member count total")
Expand Down Expand Up @@ -68,4 +64,9 @@ def calculate_metrics():
except Exception as e:
logger.error(f"Failed to update Prometheus metrics: {e}")

return metric_results
return {
"member_count": Profile.objects.count(),
"subscription_count": Profile.objects.filter(
subscription_status__in=["active", "cancelling"]
).count(),
}

0 comments on commit defd85f

Please sign in to comment.