|
@@ -21,31 +21,21 @@ import multiprocessing
|
|
|
import threading
|
|
import threading
|
|
|
|
|
|
|
|
from django.contrib.auth.models import User
|
|
from django.contrib.auth.models import User
|
|
|
-from django.contrib.auth.signals import user_logged_in, user_logged_out
|
|
|
|
|
-from django.dispatch import receiver
|
|
|
|
|
|
|
|
|
|
from desktop.lib.metrics import global_registry
|
|
from desktop.lib.metrics import global_registry
|
|
|
|
|
|
|
|
global_registry().gauge_callback(
|
|
global_registry().gauge_callback(
|
|
|
name='python.threads.total',
|
|
name='python.threads.total',
|
|
|
callback=lambda: len(threading.enumerate()),
|
|
callback=lambda: len(threading.enumerate()),
|
|
|
- label='Thread count',
|
|
|
|
|
|
|
+ label='Thread Count',
|
|
|
description='Number of threads',
|
|
description='Number of threads',
|
|
|
numerator='threads',
|
|
numerator='threads',
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
-global_registry().gauge_callback(
|
|
|
|
|
- name='python.threads.active',
|
|
|
|
|
- callback=lambda: threading.active_count(),
|
|
|
|
|
- label='Active thread count',
|
|
|
|
|
- description='Number of active threads',
|
|
|
|
|
- numerator='threads',
|
|
|
|
|
-)
|
|
|
|
|
-
|
|
|
|
|
global_registry().gauge_callback(
|
|
global_registry().gauge_callback(
|
|
|
name='python.threads.daemon',
|
|
name='python.threads.daemon',
|
|
|
callback=lambda: sum(1 for thread in threading.enumerate() if thread.isDaemon()),
|
|
callback=lambda: sum(1 for thread in threading.enumerate() if thread.isDaemon()),
|
|
|
- label='Daemon thread count',
|
|
|
|
|
|
|
+ label='Daemon Thread Count',
|
|
|
description='Number of daemon threads',
|
|
description='Number of daemon threads',
|
|
|
numerator='threads',
|
|
numerator='threads',
|
|
|
)
|
|
)
|
|
@@ -55,7 +45,7 @@ global_registry().gauge_callback(
|
|
|
global_registry().gauge_callback(
|
|
global_registry().gauge_callback(
|
|
|
name='python.multiprocessing.total',
|
|
name='python.multiprocessing.total',
|
|
|
callback=lambda: len(multiprocessing.active_children()),
|
|
callback=lambda: len(multiprocessing.active_children()),
|
|
|
- label='Process count',
|
|
|
|
|
|
|
+ label='Process Count',
|
|
|
description='Number of multiprocessing processes',
|
|
description='Number of multiprocessing processes',
|
|
|
numerator='processes',
|
|
numerator='processes',
|
|
|
)
|
|
)
|
|
@@ -63,7 +53,7 @@ global_registry().gauge_callback(
|
|
|
global_registry().gauge_callback(
|
|
global_registry().gauge_callback(
|
|
|
name='python.multiprocessing.active',
|
|
name='python.multiprocessing.active',
|
|
|
callback=lambda: sum(1 for proc in multiprocessing.active_children() if proc.is_alive()),
|
|
callback=lambda: sum(1 for proc in multiprocessing.active_children() if proc.is_alive()),
|
|
|
- label='Active multiprocessing processes',
|
|
|
|
|
|
|
+ label='Active Multiprocessing Processes',
|
|
|
description='Number of active multiprocessing processes',
|
|
description='Number of active multiprocessing processes',
|
|
|
numerator='processes',
|
|
numerator='processes',
|
|
|
)
|
|
)
|
|
@@ -71,7 +61,7 @@ global_registry().gauge_callback(
|
|
|
global_registry().gauge_callback(
|
|
global_registry().gauge_callback(
|
|
|
name='python.multiprocessing.daemon',
|
|
name='python.multiprocessing.daemon',
|
|
|
callback=lambda: sum(1 for proc in multiprocessing.active_children() if proc.daemon),
|
|
callback=lambda: sum(1 for proc in multiprocessing.active_children() if proc.daemon),
|
|
|
- label='Daemon processes count',
|
|
|
|
|
|
|
+ label='Daemon Processes Count',
|
|
|
description='Number of daemon multiprocessing processes',
|
|
description='Number of daemon multiprocessing processes',
|
|
|
numerator='processes',
|
|
numerator='processes',
|
|
|
)
|
|
)
|
|
@@ -80,57 +70,43 @@ global_registry().gauge_callback(
|
|
|
|
|
|
|
|
for i in xrange(3):
|
|
for i in xrange(3):
|
|
|
global_registry().gauge_callback(
|
|
global_registry().gauge_callback(
|
|
|
- name='python.gc.collection.count%s' % i,
|
|
|
|
|
|
|
+ name='python.gc.generation.%s' % i,
|
|
|
callback=lambda: gc.get_count()[i],
|
|
callback=lambda: gc.get_count()[i],
|
|
|
- label='GC collection count %s' % i,
|
|
|
|
|
- description='Current collection counts',
|
|
|
|
|
- numerator='collections',
|
|
|
|
|
|
|
+ label='GC Object Count in Generation %s' % i,
|
|
|
|
|
+ description='Total number of objects in garbage collection generation %s' % i,
|
|
|
|
|
+ numerator='objects',
|
|
|
|
|
+ raw_counter=True,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
global_registry().gauge_callback(
|
|
global_registry().gauge_callback(
|
|
|
name='python.gc.objects',
|
|
name='python.gc.objects',
|
|
|
- callback=lambda: len(gc.get_objects()),
|
|
|
|
|
- label='GC tracked object count',
|
|
|
|
|
- description='Number of objects being tracked by the garbage collector',
|
|
|
|
|
|
|
+ callback=lambda: sum(gc.get_count()),
|
|
|
|
|
+ label='GC Object Count',
|
|
|
|
|
+ description='Total number of objects in the Python process',
|
|
|
numerator='objects',
|
|
numerator='objects',
|
|
|
-)
|
|
|
|
|
-
|
|
|
|
|
-global_registry().gauge_callback(
|
|
|
|
|
- name='python.gc.referrers',
|
|
|
|
|
- callback=lambda: len(gc.get_referrers()),
|
|
|
|
|
- label='GC tracked object referrers',
|
|
|
|
|
- description='Number of objects that directly refer to any objects',
|
|
|
|
|
- numerator='referrers',
|
|
|
|
|
-)
|
|
|
|
|
-
|
|
|
|
|
-global_registry().gauge_callback(
|
|
|
|
|
- name='python.gc.referents',
|
|
|
|
|
- callback=lambda: len(gc.get_referrers()),
|
|
|
|
|
- label='GC tracked object referents',
|
|
|
|
|
- description='Number of objects that directly referred to any objects',
|
|
|
|
|
- numerator='referents',
|
|
|
|
|
|
|
+ raw_counter=True,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
active_requests = global_registry().counter(
|
|
active_requests = global_registry().counter(
|
|
|
name='requests.active',
|
|
name='requests.active',
|
|
|
- label='Active requests',
|
|
|
|
|
|
|
+ label='Active Requests',
|
|
|
description='Number of currently active requests',
|
|
description='Number of currently active requests',
|
|
|
- numerator='active requests',
|
|
|
|
|
|
|
+ numerator='requests',
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
request_exceptions = global_registry().counter(
|
|
request_exceptions = global_registry().counter(
|
|
|
name='requests.exceptions',
|
|
name='requests.exceptions',
|
|
|
- label='Request exceptions',
|
|
|
|
|
|
|
+ label='Request Exceptions',
|
|
|
description='Number requests that resulted in an exception',
|
|
description='Number requests that resulted in an exception',
|
|
|
- numerator='failed requests',
|
|
|
|
|
|
|
+ numerator='requests',
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
response_time = global_registry().timer(
|
|
response_time = global_registry().timer(
|
|
|
- name='requests.aggregate-response-time',
|
|
|
|
|
- label='Request aggregate response time',
|
|
|
|
|
- description='Time taken to respond to requests',
|
|
|
|
|
|
|
+ name='requests.response-time',
|
|
|
|
|
+ label='Request Response Time',
|
|
|
|
|
+ description='Time taken to respond to requests across all Hue endpoints',
|
|
|
numerator='seconds',
|
|
numerator='seconds',
|
|
|
counter_numerator='requests',
|
|
counter_numerator='requests',
|
|
|
rate_denominator='seconds',
|
|
rate_denominator='seconds',
|
|
@@ -139,62 +115,47 @@ response_time = global_registry().timer(
|
|
|
# ------------------------------------------------------------------------------
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
user_count = global_registry().gauge_callback(
|
|
user_count = global_registry().gauge_callback(
|
|
|
- name='users.total',
|
|
|
|
|
|
|
+ name='users',
|
|
|
callback=lambda: User.objects.count(),
|
|
callback=lambda: User.objects.count(),
|
|
|
- label='User count',
|
|
|
|
|
- description='Total number of users',
|
|
|
|
|
|
|
+ label='Users',
|
|
|
|
|
+ description='Total number of user accounts in Hue',
|
|
|
numerator='users',
|
|
numerator='users',
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
-logged_in_users = global_registry().counter(
|
|
|
|
|
- name='users.logged-in',
|
|
|
|
|
- label='Number of logged in users',
|
|
|
|
|
- description='Number of logged in users',
|
|
|
|
|
- numerator='logged in users',
|
|
|
|
|
-)
|
|
|
|
|
-
|
|
|
|
|
-@receiver(user_logged_in)
|
|
|
|
|
-def user_logged_in_handler(sender, **kwargs):
|
|
|
|
|
- logged_in_users.inc()
|
|
|
|
|
-
|
|
|
|
|
-@receiver(user_logged_out)
|
|
|
|
|
-def user_logged_out_handler(sender, **kwargs):
|
|
|
|
|
- logged_in_users.dec()
|
|
|
|
|
-
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
ldap_authentication_time = global_registry().timer(
|
|
ldap_authentication_time = global_registry().timer(
|
|
|
name='ldap.authentication-time',
|
|
name='ldap.authentication-time',
|
|
|
- label='LDAP Authentication time',
|
|
|
|
|
- description='Time taken to authenticate a user with LDAP',
|
|
|
|
|
|
|
+ label='LDAP Authentication Time',
|
|
|
|
|
+ description='The time spent waiting for LDAP to authenticate a user over the life of the process',
|
|
|
numerator='seconds',
|
|
numerator='seconds',
|
|
|
- counter_numerator='auths',
|
|
|
|
|
|
|
+ counter_numerator='authentications',
|
|
|
rate_denominator='seconds',
|
|
rate_denominator='seconds',
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
oauth_authentication_time = global_registry().timer(
|
|
oauth_authentication_time = global_registry().timer(
|
|
|
name='auth.oauth.authentication-time',
|
|
name='auth.oauth.authentication-time',
|
|
|
- label='OAUTH Authentication time',
|
|
|
|
|
- description='Time taken to authenticate a user with OAUTH',
|
|
|
|
|
|
|
+ label='OAUTH Authentication Time',
|
|
|
|
|
+ description='The time spent waiting for OAUTH to authenticate a user over the life of the process',
|
|
|
numerator='seconds',
|
|
numerator='seconds',
|
|
|
- counter_numerator='auths',
|
|
|
|
|
|
|
+ counter_numerator='authentications',
|
|
|
rate_denominator='seconds',
|
|
rate_denominator='seconds',
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
pam_authentication_time = global_registry().timer(
|
|
pam_authentication_time = global_registry().timer(
|
|
|
name='auth.pam.authentication-time',
|
|
name='auth.pam.authentication-time',
|
|
|
- label='PAM Authentication time',
|
|
|
|
|
- description='Time taken to authenticate a user with PAM',
|
|
|
|
|
|
|
+ label='PAM Authentication Time',
|
|
|
|
|
+ description='The time spent waiting for PAM to authenticate a user over the life of the process',
|
|
|
numerator='seconds',
|
|
numerator='seconds',
|
|
|
- counter_numerator='auths',
|
|
|
|
|
|
|
+ counter_numerator='authentications',
|
|
|
rate_denominator='seconds',
|
|
rate_denominator='seconds',
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
spnego_authentication_time = global_registry().timer(
|
|
spnego_authentication_time = global_registry().timer(
|
|
|
name='auth.spnego.authentication-time',
|
|
name='auth.spnego.authentication-time',
|
|
|
- label='SPNEGO Authentication time',
|
|
|
|
|
- description='Time taken to authenticate a user with SPNEGO',
|
|
|
|
|
|
|
+ label='SPNEGO Authentication Time',
|
|
|
|
|
+ description='The time spent waiting for SPNEGO to authenticate a user over the life of the process',
|
|
|
numerator='seconds',
|
|
numerator='seconds',
|
|
|
- counter_numerator='auths',
|
|
|
|
|
|
|
+ counter_numerator='authentications',
|
|
|
rate_denominator='seconds',
|
|
rate_denominator='seconds',
|
|
|
)
|
|
)
|