Skip to content

Commit b3207af

Browse files
committed
Issue #4833: add support for the web option 'nytprof'
this activates profiling. This works just like activation the shotgun option.
1 parent 1c35997 commit b3207af

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

bin/docker/entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ function exec_web() {
122122
elif [ "$otobo_devel" = "development" ]; then
123123
exec plackup --server Gazelle --port 5000 bin/psgi-bin/otobo.psgi
124124

125+
# For activating profiling. Loading the middleware tells otobo.psgi that profiling is enabled.
126+
elif [ "$otobo_devel" = "nytprof" ]; then
127+
exec plackup -M Plack::Middleware::Profiler::NYTProf --port 5000 bin/psgi-bin/otobo.psgi
128+
125129
# For being very sure that all modules are reloaded and the config being read again
126130
elif [ "$otobo_devel" = "shotgun" ]; then
127131
exec plackup --loader Shotgun --port 5000 bin/psgi-bin/otobo.psgi

bin/psgi-bin/otobo.psgi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ eval {
100100
require Net::DNS;
101101
};
102102

103-
# Activate profiling only when Plack::Middleware::Profiler::NYTProf is installed.
104-
my $ProfilingIsActive = 0;
103+
# Activate profiling when Plack::Middleware::Profiler::NYTProf is loaded.
104+
# Passing the option "-M Plack::Middleware::Profiler::NYTProf" to plackup does the trick.
105+
my $ProfilingIsActive = $INC{'Plack/Middleware/Profiler/NYTProf.pm'} ? 1: 0;
106+
#my $ProfilingIsActive = 1; # uncomment for activating profiling
105107

106108
# The OTOBO home is determined from the location of otobo.psgi.
107109
my $Home = abs_path("$Bin/../..");

0 commit comments

Comments
 (0)