summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Metrics/Collector.pm
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2014-03-19 09:03:37 +0100
committerByron Jones <glob@mozilla.com>2014-03-19 09:03:37 +0100
commit80c784ce1b8805b4d1797bcc1c49bc40a7ea1946 (patch)
tree3a482ceebb4e397018b7d9e13f5612f851980f51 /Bugzilla/Metrics/Collector.pm
parentf77964694b3bd7a3c4c733824614659c44057bf6 (diff)
downloadbugzilla-80c784ce1b8805b4d1797bcc1c49bc40a7ea1946.tar.gz
bugzilla-80c784ce1b8805b4d1797bcc1c49bc40a7ea1946.tar.xz
Bug 985305: update the metrics elasticsearch reporter to bypass es node discovery
Diffstat (limited to 'Bugzilla/Metrics/Collector.pm')
-rw-r--r--Bugzilla/Metrics/Collector.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/Bugzilla/Metrics/Collector.pm b/Bugzilla/Metrics/Collector.pm
index 2f9b6130d..53cbac819 100644
--- a/Bugzilla/Metrics/Collector.pm
+++ b/Bugzilla/Metrics/Collector.pm
@@ -9,6 +9,7 @@ package Bugzilla::Metrics::Collector;
use strict;
use warnings;
+use 5.10.1;
# the reporter needs to be a constant and use'd here to ensure it's loaded at
# compile time.
@@ -19,6 +20,8 @@ use Bugzilla::Metrics::Reporter::ElasticSearch;
#use constant REPORTER => 'Bugzilla::Metrics::Reporter::STDERR';
#use Bugzilla::Metrics::Reporter::STDERR;
+use Bugzilla::Constants;
+use Cwd qw(abs_path);
use File::Basename;
use Time::HiRes qw(gettimeofday clock_gettime CLOCK_MONOTONIC);
@@ -102,12 +105,15 @@ sub db_start {
my @stack;
my $i = 0;
+ state $path = quotemeta(abs_path(bz_locations()->{cgi_path}) . '/');
while (1) {
my @caller = caller($i);
last unless @caller;
- last if substr($caller[1], -5, 5) eq '.tmpl';
- push @stack, "$caller[1]:$caller[2]"
- unless substr($caller[1], 0, 16) eq 'Bugzilla/Metrics';
+ my $file = $caller[1];
+ $file =~ s/^$path//o;
+ push @stack, "$file:$caller[2]"
+ unless substr($file, 0, 16) eq 'Bugzilla/Metrics';
+ last if $file =~ /\.(?:tmpl|cgi)$/;
$i++;
}
$timer->{stack} = \@stack;