Giter Club home page Giter Club logo

php-spx's People

Contributors

8ctopus avatar a110ut avatar alexndrmac avatar andypost avatar athorcis avatar bafs avatar bramesposito avatar giulianoriccio avatar glensc avatar grahamcampbell avatar ilnytskyi avatar jadeops avatar noisebynorthwest avatar quazz avatar vencakrecl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-spx's Issues

Wrong API version chosen in configure script

I'm using Debian 9.5 and multiple PHP installations from packages.sury.org. I've updated the phpize to point to 7.2 version. Phpize outputs 20170718 PHP Api version (PHP 7.2) but configure script is picking 20180731 PHP Api version (PHP 7.3).

# phpize
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718

# ./configure
...
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20180731 -I/usr/include/php/20180731/main -I/usr/include/php/20180731/TSRM -I/usr/include/php/20180731/Zend -I/usr/include/php/20180731/ext -I/usr/include/php/20180731/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20180731
checking for PHP installed headers prefix... /usr/include/php/20180731
...

It's the first time I've encountered such behaviour when compiling extensions from the source.

Clean/fix global hooks use

It is currently broken in ZTS context. Despite ZTS is not officially supported, I want to be as close as possible to theoretical support.

Remove "Callgrind" report type

As it will be far less relevant with incoming embedded web UI.
It could be added back later as an embedded web UI feature.

Running the webinterface on another port

Hi,

I was trying to get this working on my dev env, but i can't reach the webinterface. Is there a possibility to run it on a different point so it doesn't conflict with apache?

Regards,

Bjorn.

Browser Freezes

I am successfully able to configure the extension, but when I try to see the matrix details my browser freezes. I tried it on both Firefox and Latest Version of Google Chrome.

I am collecting matrix for Laravel's 5.6 default home page.
My Computer Specs are:

RAM: 16GB
CPU: Core i7
Platform: Docker for windows 10

The configuration can be found in this screenshot:
https://imgur.com/cVdr5NJ

And the actual Report that I am trying to load is here:

https://imgur.com/l57nfMc

Trace GC calls

It would be great to trace, by default (no need to be configurable) GC calls (AKA gc_collect_cycles) to see the impact of GC pauses.

Failed to build with GCC 8.1.1

  • GCC Version
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 8.1.1 20180531 (GCC) 
  • Output
$ phpize
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718

$ ./configure 
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib/php/modules
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable SPX extension... yes, shared
checking for zlib header... yes
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h

$ make
/bin/sh /home/chivincent/tmp/php-spx/libtool --mode=compile cc  -I. -I/home/chivincent/tmp/php-spx -DPHP_ATOM_INC -I/home/chivincent/tmp/php-spx/include -I/home/chivincent/tmp/php-spx/main -I/home/chivincent/tmp/php-spx -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -Werror -Wfatal-errors -Wall -DSPX_HTTP_UI_ASSETS_DIR=\"/usr/share/misc/php-spx/assets/web-ui\"   -c /home/chivincent/tmp/php-spx/src/php_spx.c -o src/php_spx.lo 
mkdir src/.libs
 cc -I. -I/home/chivincent/tmp/php-spx -DPHP_ATOM_INC -I/home/chivincent/tmp/php-spx/include -I/home/chivincent/tmp/php-spx/main -I/home/chivincent/tmp/php-spx -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -Werror -Wfatal-errors -Wall -DSPX_HTTP_UI_ASSETS_DIR=\"/usr/share/misc/php-spx/assets/web-ui\" -c /home/chivincent/tmp/php-spx/src/php_spx.c  -fPIC -DPIC -o src/.libs/php_spx.o
/home/chivincent/tmp/php-spx/src/php_spx.c: In function ‘http_ui_handler_shutdown’:
/home/chivincent/tmp/php-spx/src/php_spx.c:617:5: error: ‘strncpy’ specified bound 512 equals destination size [-Werror=stringop-truncation]
     strncpy(relative_path, request_uri + strlen(SPX_G(http_ui_uri_prefix)), sizeof(relative_path));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1: all warnings being treated as errors
make: *** [Makefile:204: src/php_spx.lo] Error 1

Add an embedded web UI

Shipped with the PHP extension.
Nothing else to install (zero server side dependencies).
jQuery 3+ as client side dependency.
ES6 targeting last Firefox & Chromium (based) browsers.

It must sustain up to tens of millions events per report with high (20+) FPS.

Features:

  • interactive time line: will allow to zoom & go back/forward to adjust the current time range
  • time line overview (including selected metric graph)
  • flat profile : sortable & updated according to time range changes
  • flame graph : updated according to time range changes
  • metric selection

not able to compile

hello,

my compilation ends with:
cc1: warnings being treated as errors
/usr/src/php-spx/src/spx_output_stream.c: In function 'gz_file_handler_vprintf':
/usr/src/php-spx/src/spx_output_stream.c:179: error: implicit declaration of function 'gzvprintf'
compilation terminated due to -Wfatal-errors.
make: *** [src/spx_output_stream.lo] Error 1

centos 6
php56w

Add a toolbar

To allow to, on any URL with HTML content:

  • configure & trigger profiling
  • analyze reports of the last profiling run

Do not log to output

When SPX issues log messages via zend_error they could be printed on output according to PHP configuration. Logging must be disabled in this case to avoid sensible informations leak.

Compilation failed on Alpine distribution

Hello, first of all, thanks for this awesome library!

I tried to compile your extension on the docker image php:7.0-fpm-alpine (which is based on the last alpine distribution )
And after installing the zlib-dev package as requested, this extension won't compile.

Dockerfile:

FROM php:7.0-fpm-alpine

RUN apk update \
    && apk add --no-cache zlib-dev

## Install spx extension

# git clone of the project
COPY ./spx /usr/src/php/ext/spx 
COPY ./spx.ini /usr/local/etc/php/conf.d/

# run the classic extension installation (same one as indicated in the documentation)
RUN docker-php-ext-install pdo pdo_mysql spx

EXPOSE 9000

CMD ["php-fpm"]

As you see, this is pretty straightforward. pdo and pdo_mysql are correctly compiled and installed.

Here is the build report:

+ cd spx
+ phpize
Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012
+ ./configure --build=x86_64-linux-musl
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
expr: syntax error
sh: 0: unknown operand
expr: syntax error
sh: 0: unknown operand
expr: syntax error
sh: 0: unknown operand
expr: syntax error
sh: 0: unknown operand
expr: syntax error
sh: 0: unknown operand
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-musl
checking host system type... x86_64-pc-linux-musl
checking target system type... x86_64-pc-linux-musl
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20151012
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.14.3 (ok)
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable SPX extension... yes, shared
checking for zlib header... yes
checking for ld used by cc... /usr/x86_64-alpine-linux-musl/bin/ld
checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld) is GNU ld... yes
checking for /usr/x86_64-alpine-linux-musl/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 98304
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
/bin/sh /usr/src/php/ext/spx/libtool --mode=compile cc  -I. -I/usr/src/php/ext/spx -DPHP_ATOM_INC -I/usr/src/php/ext/spx/include -I/usr/src/php/ext/spx/main -I/usr/src/php/ext/spx -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fpie -O2 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -Werror -Wfatal-errors -Wall   -c /usr/src/php/ext/spx/src/php_spx.c -o src/php_spx.lo
mkdir src/.libs
 cc -I. -I/usr/src/php/ext/spx -DPHP_ATOM_INC -I/usr/src/php/ext/spx/include -I/usr/src/php/ext/spx/main -I/usr/src/php/ext/spx -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -Werror -Wfatal-errors -Wall -c /usr/src/php/ext/spx/src/php_spx.c  -fPIC -DPIC -o src/.libs/php_spx.o
In file included from /usr/src/php/ext/spx/src/php_spx.c:1:0:
/usr/src/php/ext/spx/src/php_spx.c: In function 'init':
/usr/src/php/ext/spx/src/php_spx.c:294:23: error: expected identifier before '(' token
     context.fd_backup.stdout = -1;
                       ^
compilation terminated due to -Wfatal-errors.
Makefile:193: recipe for target 'src/php_spx.lo' failed
make: *** [src/php_spx.lo] Error 1
ERROR: Service 'php' failed to build: The command '/bin/sh -c docker-php-ext-install pdo pdo_mysql spx' returned a non-zero code: 2

empty metadata resullt

I test it after open my web page (simple phpinfo()) function the files are generated but seems be backend spx server dosnt show the result as expected.

root@aasaam-test-app:/app/app# php -v
PHP 7.2.5-0ubuntu0.18.04.1 (cli) (built: May  9 2018 17:21:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.5-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.7.0alpha1, Copyright (c) 2002-2018, by Derick Rethans
=======================
root@aasaam-test-app:/app/app# php --ri spx

SPX

SPX Support => enabled
SPX Version => 0.3.0

Directive => Local Value => Master Value
spx.data_dir => /tmp/php/spx => /tmp/php/spx
spx.http_enabled => 1 => 1
spx.http_key => dev => dev
spx.http_ip_var => NGINX_SECURE_PROXY => NGINX_SECURE_PROXY
spx.http_ip_whitelist => 127.0.0.1 => 127.0.0.1
spx.http_ui_assets_dir => /usr/share/misc/php-spx/assets/web-ui => /usr/share/misc/php-spx/assets/web-ui
spx.http_ui_uri_prefix => /_spx => /_spx

Web UI: drop vhost setup constraint

The current routing system of the web UI, based on a request uri prefix, is a bit complicated as the user must setup a "catch all" location which covers the UI URIs in its vhost if not done yet, which could be the case for non-framework user.

The implementation is also quite complicated.

See #20 or #22 as related issue examples.

It can be simplified by adding a new query string variable (say SPX_UI_URI) to hold the current UI URI. And thus all the uri prefix related logic (spx.http_ui_uri_prefix INI entry...) can be removed.

MacOS support?

Hey, thanks for a cool piece of software. Do you have any plans to support MacOS in future versions?

/_spx/data/reports/metadata not picking up generated reports.

I have set the following config file:
extension=spx.so
spx.data_dir = /srv/nginx/profiler
spx.http_enabled = 1
spx.http_key = XXXXX
spx.http_ip_whitelist="127.0.0.1,XX.XX.XX.XX"

I enable profiling from the web ui and refresh a page im profiling - it clearly takes time and is doing its thing. The profiles are being written to the configured directory eg:

spx-full-20180314_115412-xxx-14281-1804289383.json
spx-full-20180314_115412-xxx-14281-1804289383.txt.gz

However the endpoint /_spx/data/reports/metadata does not serve the reports to the web ui so nothing populates and I cant select the profile to view.

I am running php-fpm on nginx on centos 7.4.1708.
PHP version: PHP 7.1.15

Let me know if I can get you any other data to help debug.

Sampling mode

  • add sampling mode with configurable sampling period
  • remove SPX_FULL_RES parameter

Create a "Control panel" page + cookie based settings

Security

It will be secured by these 2 mandatory locks:

  • IP whitelist
  • Secret random key in url

URI

Something like: /_spx/<key>

Behavior

This page will allow to configure SPX from a classic Web UI, without breaking security. All settings will be stored in a cookie.

Web UI on nginx + php-fpm

I'm building this inside a docker container. The build is good. Running from the CLI inside the container works fine. However when trying to open the web ui from http://localhost/_spx?SPX_KEY=dev it gives me an empty _spx file download.

Am I doing something wrong?

Dockerfile build instructions

  # SPX
  && git clone https://github.com/NoiseByNorthwest/php-spx.git /tmp/spx \
  && cd /tmp/spx \
  && phpize \
  && ./configure \
  && make \
  && make install \

spx.ini:

[spx]
; https://github.com/NoiseByNorthwest/php-spx#advanced-usage
extension=spx.so
spx.http_enabled       = 1
spx.http_key           = dev
spx.http_ip_whitelist  = 172.18.0.1,docker.for.win.localhost
spx.http_ui_assets_dir = /usr/share/misc/php-spx/assets/web-ui

Docker build log (located at the end).

Web UI idea: user-defined categories

As per the contribution guidelines, I'm opening an issue for discussion first; I'm writing this for myself anyway, but I won't bother opening a PR if you're not interested.

My suggestion: extra UI controls for users to declare categories for trace data. Each category is defined by a regex/namespace prefix, and has a user-selected colour. When this mode is activated, the timeline view colours items by the first matching category, instead of scale based on chosen metric. The flat profile table could also maybe show aggregate metrics by category (at the bottom, or separate 'tab' or something).

Why? It allows quick visual understanding of "regions" of code that might show up multiple times, or deep in stacks, without having to carefully mouse over everything reading names. For example, it lets me quickly see sunk costs and/or overheads from frameworks, libraries, DI container, ORM etc, compared to "actual" application code. I had some success with this idea in a custom xdebug profiler UI in the past, and would love to have it in SPX too.

This would be optional – a separate set of controls near the metric dropdown, probably – and not affect 'normal' usage. The definitions of category name/colour/regex/prefix would be stored in browser localStorage; no changes needed on collection/storage side.

A quick example (hardcoded categories) I've been hacking together:

Windows support

Thanks for the great effort in bringing an excellent extension! I would like to ask if there is any Windows support planned.

  • Ayesh.

WebUI not showing exclusive time properly when zoomed in

As the title says, take a look at this screenshot when zoomed in very closely. You'll notice that it's ordered by exclusive wall time, and buildInserts is at the top. But when you look at the gaps between the two calls to addPriceDatum, the time difference is around 15ms for buildIterator doing something. Shouldn't buildIterator be the third-ish entry on the function list?

But when zoomed out fully, buildIterator's exclusive time suddenly shows up properly.

Any ideas?

Profiling in curl or postman

First of all, your app works well and looks awesome.

Although is there any option to profile requests made from curl or postman?

Thanks!

Bad Gateway when accessing /_spx?SPX_KEY=dev

I'm trying to access the web ui to read out some CLI profiles created but I'm having trouble accessing it. I've followed the steps as laid out in the readme but after a few attempts, I'm not really getting anywhere.

When I try to access http://localhost/_spx?SPX_KEY=dev I get a bad gateway error. With both Nginx and Caddy.

The PHP error logs reports the following:

==> /var/log/php/fpm-www.log <==
[25-Mar-2018 01:19:27 Europe/Berlin] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[25-Mar-2018 01:19:27 Europe/Berlin] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[25-Mar-2018 01:19:40 Europe/Berlin] PHP Notice:  SPX: access granted: "127.0.0.1" IP with "dev" key in Unknown on line 0
[25-Mar-2018 01:19:40 Europe/Berlin] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[25-Mar-2018 01:19:40 Europe/Berlin] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[25-Mar-2018 01:19:40 Europe/Berlin] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[25-Mar-2018 01:29:03 Europe/Berlin] PHP Notice:  SPX: access granted: "127.0.0.1" IP with "dev" key in Unknown on line 0
[25-Mar-2018 01:29:03 Europe/Berlin] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[25-Mar-2018 01:29:03 Europe/Berlin] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0
[25-Mar-2018 01:29:03 Europe/Berlin] PHP Warning:  Cannot modify header information - headers already sent in Unknown on line 0

==> /var/log/php/www.access.log <==
127.0.0.1 -  25/Mar/2018:01:15:05 +0100 "GET /_spx/index.html" 404
127.0.0.1 -  25/Mar/2018:01:15:11 +0100 "GET /_spx/index.html" 404
127.0.0.1 -  25/Mar/2018:01:15:11 +0100 "GET /_spx/index.html" 404
127.0.0.1 -  25/Mar/2018:01:15:43 +0100 "GET /_spx/" 404
127.0.0.1 -  25/Mar/2018:01:15:50 +0100 "GET /_spx" 404
127.0.0.1 -  25/Mar/2018:01:18:34 +0100 "GET /_spx/index.html" 404
127.0.0.1 -  25/Mar/2018:01:19:09 +0100 "GET /_spx/index.html" 404
127.0.0.1 -  25/Mar/2018:01:19:27 +0100 "GET /_spx" 404
127.0.0.1 -  25/Mar/2018:01:19:40 +0100 "GET /_spx/" 404
127.0.0.1 -  25/Mar/2018:01:29:03 +0100 "GET /_spx/" 404

When I try to access http://localhost/_spx/?SPX_KEY=dev or http://localhost/_spx/index.html?SPX_KEY=dev through nginx I get weird malformed html presented as text.
See spx_responses.txt

Versions

I'm using the following software:
PHP 7.1.15-1+ubuntu16.04.1+deb.sury.org+2 (cli) (built: Mar 6 2018 11:10:13) ( NTS )
PHP is used as php-fpm through tcp socket to Nginx.

nginx version: nginx/1.13.9 Built by gcc 6.4.0 (Alpine 6.4.0) Built with OpenSSL 1.0.2n 7 Dec 2017 TLS SNI support enabled Through docker: nginx:alpine (537527661905)

I just build the extension from source, commit 91ea8d6.

Web UI: add a switch to show a call-graph view instead of Flamegraph

Call-graph & Flamegraph share some similarities, they are both a visualization for a graph data structure (more specifically a tree for the Flamegraph) and they both represent an intermediate level aggregation.

So it makes sense for me to group them in the same widget.

Consider switching to zend extension

SPX is currently a zend module while, semantically, it has more to do with a zend extension.

Additionally, registering a zend extension entry could allow safer (and finer - statement level -) hooking. Needs investigation.

And finally, being a zend_extension does not disallow to also register a module entry.

FreeBSD support

Hi, thank you for building this awesome extension! Is FreeBSD support planned in the future?

Improve HTTP response handling

Non 2XX response are not 100% handled due to some misunderstanding of Zend Engine HTTP output management.

Once resolved:

  • fix 404 responses
  • add permanent redirection {prefix} -> {prefix}/

Alpinelinux packaging fails on spx_013 test

I'm trying to package the extension to Alpinelinux alpinelinux/aports#5524

All packages supposed to run tests after build but one of tests fail because displays full path to script while expected output use %s

---- EXPECTED OUTPUT
....
    38.6K |        1 |        1 | %s/spx_013.php
---- ACTUAL OUTPUT
...
    38.6K |        1 |        1 | /mnt/testing/php7-spx/src/php-spx-0.4.0/tests/spx_013.php

Maybe I missed some default configuration options?

Web UI: dynamic height for widgets

Height of widgets are currently fixed, which make them fully visible only with a 1000px+ window's height.
Their height should be instead dynamically resolved to optimize widgets visibility whatever the height of the window.

Improve web UI doc

The way it works & the full requirements (its urls handled by a PHP application) are not well explained.

Enable at runtime for long running processes using a signal (ie USR2)

For a platform I am working on I am planning on integrating a profiler to be able to easily monitor it if stuff starts to go south.

This extensions looks very cool because:

  • supports google tracing format
  • support the metrics I need
  • it's a php extension, I don't need to fill my code with useless stuff

Sadly I will not be able to use it because currently it's not possible to enable / disable the profiler at runtime.

It would even be more cool if this extensions would be able to be turned on and off while the long running process is running.

How much complicated would it be?
First and foremost the extension should keep track of the stack trace even if it's off, and quite probably it should keep track internally of some more metrics, but, for example, it wouldn't need to buffer the timeline events.

If you give me some hints I can try to take a look at it!

The reason for which I am asking is that even setting the environment variable is not straightforward, especially on live environments running on docker, kubernetes or similar.

Compilation errors on mac osx

I'm trying to compile SPX on MacOS (El capitan). I run into this compilation error :

I'm just following the documentation, and hit that error at make time.

In file included from /Users/famille/bin/php-spx/src/spx_resource_stats.c:4:
/Users/famille/bin/php-spx/src/spx_resource_stats-macos.c:20:12: error: implicit declaration of function 'spx_resource_stats_wall_time_coarse' is invalid in
      C99 [-Werror,-Wimplicit-function-declaration]
    return spx_resource_stats_wall_time_coarse();
           ^
/Users/famille/bin/php-spx/src/spx_resource_stats-macos.c:20:12: note: did you mean 'spx_resource_stats_wall_time'?
/Users/famille/bin/php-spx/src/spx_resource_stats-macos.c:17:8: note: 'spx_resource_stats_wall_time' declared here
size_t spx_resource_stats_wall_time(void)
       ^
/Users/famille/bin/php-spx/src/spx_resource_stats-macos.c:31:12: error: implicit declaration of function 'spx_resource_stats_cpu_time_coarse' is invalid in
      C99 [-Werror,-Wimplicit-function-declaration]
    return spx_resource_stats_cpu_time_coarse();
           ^
/Users/famille/bin/php-spx/src/spx_resource_stats-macos.c:31:12: note: did you mean 'spx_resource_stats_wall_time_coarse'?
/Users/famille/bin/php-spx/src/spx_resource_stats-macos.c:20:12: note: 'spx_resource_stats_wall_time_coarse' declared here
    return spx_resource_stats_wall_time_coarse();
           ^
/Users/famille/bin/php-spx/src/spx_resource_stats-macos.c:48:22: error: static declaration of 'spx_resource_stats_wall_time_coarse' follows non-static
      declaration
static inline size_t spx_resource_stats_wall_time_coarse(void)
                     ^
/Users/famille/bin/php-spx/src/spx_resource_stats-macos.c:20:12: note: previous implicit declaration is here
    return spx_resource_stats_wall_time_coarse();
           ^
/Users/famille/bin/php-spx/src/spx_resource_stats-macos.c:63:22: error: static declaration of 'spx_resource_stats_cpu_time_coarse' follows non-static
      declaration
static inline size_t spx_resource_stats_cpu_time_coarse(void)
                     ^
/Users/famille/bin/php-spx/src/spx_resource_stats-macos.c:31:12: note: previous implicit declaration is here
    return spx_resource_stats_cpu_time_coarse();
           ^
4 errors generated.

More info upon request.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.