diff options
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r-- | Bugzilla.pm | 21 |
1 files changed, 21 insertions, 0 deletions
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(); |