فهرست منبع

HUE-9235 [metrics] Format long lines and remove noisy LOG

Logging those is non essential.
Romain 5 سال پیش
والد
کامیت
590572fded
1فایلهای تغییر یافته به همراه10 افزوده شده و 4 حذف شده
  1. 10 4
      desktop/core/src/desktop/metrics.py

+ 10 - 4
desktop/core/src/desktop/metrics.py

@@ -46,11 +46,13 @@ ALLOWED_DJANGO_PROMETHEUS_METRICS = (
 
 if ENABLE_PROMETHEUS.get():
   django_collectors = set()
-  django_metrics_names = [name for name in REGISTRY._names_to_collectors.keys() if name.startswith('django_') and not name.startswith(ALLOWED_DJANGO_PROMETHEUS_METRICS)]
+  django_metrics_names = [
+      name
+      for name in REGISTRY._names_to_collectors.keys() if name.startswith('django_') and not name.startswith(ALLOWED_DJANGO_PROMETHEUS_METRICS)
+  ]
 
   for metric_name in django_metrics_names:
     collector_obj = REGISTRY._names_to_collectors[metric_name]
-    LOG.debug("%d - %s" % (id(collector_obj), metric_name))
     django_collectors.add(collector_obj)
 
   for django_collector in django_collectors:
@@ -188,7 +190,11 @@ spnego_authentication_time = global_registry().timer(
 def num_of_queries():
   from desktop.models import Document2 # Avoid circular dependency
   try:
-    count = Document2.objects.filter(type__istartswith='query-', is_history=True, last_modified__gt=datetime.now() - timedelta(minutes=10)).count()
+    count = Document2.objects.filter(
+      type__istartswith='query-',
+      is_history=True,
+      last_modified__gt=datetime.now() - timedelta(minutes=10)
+    ).count()
   except:
     LOG.exception('Could not get num_of_queries')
     count = 0
@@ -203,4 +209,4 @@ global_registry().gauge_callback(
 )
 
 prometheus_queries_numbers = Gauge('hue_queries_numbers', 'Hue - numbers of queries')
-prometheus_queries_numbers.set_function(num_of_queries)
+prometheus_queries_numbers.set_function(num_of_queries)