diff --git a/leash-test/main.py b/leash-test/main.py index 454b4fa..03364bd 100644 --- a/leash-test/main.py +++ b/leash-test/main.py @@ -5,13 +5,17 @@ def handle_user_action(user_id, action_type): log.info(f"Handling action '{action_type}' for user {user_id}") - user_profile = get_user_profile(user_id) - if user_profile.is_active: - send_user_notification(user_id, f"Action '{action_type}' recognized.") + # Replaced user profile with more comprehensive data fetch + user_data = fetch_user_data(user_id) + if user_data.get("active"): + notification_service.send(user_id, f"Received '{action_type}' action.") else: - log.warning("Inactive user attempted an action.") + log.warning("Inactive user attempted an action!") + # Introduce Datadog metric for user clicks if action_type == "click": + statsd.increment(f"app.user_click_count.{user_id}") perform_click_action(user_id) log.debug("Action handling complete.") +