#355 Distinguish between generic and service-specific metrrics
Merged 6 months ago by jkaluza. Opened 6 months ago by fivaldi.

file modified
+4 -4

@@ -37,6 +37,7 @@ 

  ProcessCollector(registry=registry)

  multiprocess.MultiProcessCollector(registry)

  

+ # Generic metrics

  messaging_received_counter = Counter(

      'messaging_received',

      'Total number of messages received',

@@ -79,6 +80,7 @@ 

      'Number of transactions, which were rolled back',

      registry=registry)

  

+ # Freshmaker-specific metrics

  freshmaker_artifact_build_done_counter = Counter(

      'freshmaker_artifact_build_done',

      'Number of successful artifact builds',

@@ -92,7 +94,6 @@ 

      'Number of artifact builds, which were canceled',

      registry=registry)

  

- 

  freshmaker_event_complete_counter = Counter(

      'freshmaker_event_complete',

      'Number of successfully handled events',

@@ -106,11 +107,10 @@ 

      'Number of events, for which no action was taken',

      registry=registry)

  

- 

- build_api_latency = Histogram(

+ freshmaker_build_api_latency = Histogram(

      'build_api_latency',

      'BuildAPI latency', registry=registry)

- event_api_latency = Histogram(

+ freshmaker_event_api_latency = Histogram(

      'event_api_latency',

      'EventAPI latency', registry=registry)

  

file modified
+4 -3

@@ -39,7 +39,8 @@ 

  from freshmaker.api_utils import pagination_metadata

  from freshmaker.auth import login_required, requires_role, require_scopes

  from freshmaker.parsers.internal.manual_rebuild import FreshmakerManualRebuildParser

- from freshmaker.monitor import MonitorAPI, build_api_latency, event_api_latency

+ from freshmaker.monitor import (

+     MonitorAPI, freshmaker_build_api_latency, freshmaker_event_api_latency)

  

  api_v1 = {

      'event_types': {

@@ -199,7 +200,7 @@ 

  

  

  class EventAPI(MethodView):

-     @event_api_latency.time()

+     @freshmaker_event_api_latency.time()

      def get(self, id):

          if id is None:

              p_query = filter_events(request)

@@ -220,7 +221,7 @@ 

  

  

  class BuildAPI(MethodView):

-     @build_api_latency.time()

+     @freshmaker_build_api_latency.time()

      def get(self, id):

          if id is None:

              p_query = filter_artifact_builds(request)

Before implementing monitor module to MBS, I realized that it'd good to distinguish between generic and service-specific metrics. Let's first fix it for Frehsmaker.

Does this change changes something outside of the Freshmaker's code?

It seems to me like rename of variable without any change elsewhere. Or does the variable name actually changes automatically on monitoring server somehow?

This is just a renaming thing to establish some conventions.

Pull-Request has been merged by jkaluza

6 months ago