From ae9885389d3ce428f24e0352814b70b099fadb95 Mon Sep 17 00:00:00 2001 From: Mars Date: Thu, 16 Aug 2018 17:39:19 -0400 Subject: Bug 1480878 - Monitor the health of Push connector job processing --- Bugzilla.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Bugzilla.pm') diff --git a/Bugzilla.pm b/Bugzilla.pm index 5e48d21f4..f26819d93 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -780,6 +780,27 @@ sub memcached { return request_cache->{memcached} ||= Bugzilla::Memcached->_new(); } +# Connector to the Datadog metrics collection daemon. +sub datadog { + my ($class, $namespace) = @_; + my $host = $class->localconfig->{datadog_host}; + my $port = $class->localconfig->{datadog_port}; + + $namespace //= ''; + + if ($class->has_feature('datadog') && $host) { + require DataDog::DogStatsd; + return request_cache->{datadog}{$namespace} //= DataDog::DogStatsd->new( + host => $host, + port => $port, + namespace => $namespace ? "$namespace." : '', + ); + } + else { + return undef; + } +} + sub elastic { my ($class) = @_; $class->process_cache->{elastic} //= Bugzilla::Elastic->new(); -- cgit v1.2.3-24-g4f1b