From 006012d1bdaa9119bcab0d6a06b35325b6a12575 Mon Sep 17 00:00:00 2001 From: Mushtaq Rossier Date: Mon, 12 Aug 2024 15:29:48 +0200 Subject: [PATCH] feat: Testing custom agent check on stage --- commerce_coordinator/apps/commercetools/views.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/commerce_coordinator/apps/commercetools/views.py b/commerce_coordinator/apps/commercetools/views.py index f159248a..0765edb2 100644 --- a/commerce_coordinator/apps/commercetools/views.py +++ b/commerce_coordinator/apps/commercetools/views.py @@ -21,17 +21,21 @@ fulfill_order_sanctioned_message_signal ) from commerce_coordinator.apps.core.views import SingleInvocationAPIView +from datadog_checks import AgentCheck logger = logging.getLogger(__name__) # noinspection DuplicatedCode -class OrderFulfillView(SingleInvocationAPIView): +class OrderFulfillView(SingleInvocationAPIView, AgentCheck): """Order Fulfillment View""" authentication_classes = [JwtBearerAuthentication, SessionAuthentication] permission_classes = [IsAdminUser] + def check(self, instance): + self.gauge("hello.world", 1) + def post(self, request): """Receive a message from commerce tools forwarded by aws event bridge""" @@ -64,6 +68,8 @@ def post(self, request): message_id=message_id ) + self.check() + return Response(status=status.HTTP_200_OK)