pinba_extension icon indicating copy to clipboard operation
pinba_extension copied to clipboard

php80 support plz ?

Open cyberfunkua opened this issue 3 years ago • 2 comments
trafficstars

Thank you so much for pinba ext Will it possible to make pinba for php 8.0+

/root/pinba/pinba_extension/pinba.c: In function 'php_create_pinba_packet': /root/pinba/pinba_extension/pinba.c:730:3: warning: passing argument 3 of 'zend_hash_sort_ex' from incompatible pointer type [enabled by default] zend_hash_sort(tags, php_pinba_key_compare, 0); ^ In file included from /opt/alt/php80/usr/include/php/Zend/zend.h:33:0, from /opt/alt/php80/usr/include/php/main/php.h:31, from /root/pinba/pinba_extension/pinba.c:35: /opt/alt/php80/usr/include/php/Zend/zend_hash.h:268:30: note: expected 'bucket_compare_func_t' but argument is of type 'int (*)(const void *, const void *)' ZEND_API void ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort_func, bucket_compare_func_t compare_func, zend_bool renumber); ^ /root/pinba/pinba_extension/pinba.c: In function 'php_pinba_array_to_tags': /root/pinba/pinba_extension/pinba.c:1100:2: warning: passing argument 3 of 'zend_hash_sort_ex' from incompatible pointer type [enabled by default] zend_hash_sort(array, php_pinba_key_compare, 0); ^ In file included from /opt/alt/php80/usr/include/php/Zend/zend.h:33:0, from /opt/alt/php80/usr/include/php/main/php.h:31, from /root/pinba/pinba_extension/pinba.c:35: /opt/alt/php80/usr/include/php/Zend/zend_hash.h:268:30: note: expected 'bucket_compare_func_t' but argument is of type 'int (*)(const void *, const void *)' ZEND_API void ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort_func, bucket_compare_func_t compare_func, zend_bool renumber);

cyberfunkua avatar Jul 05 '22 07:07 cyberfunkua

Shameless plug: while we wait for the php extension to be made compatible, you could use https://github.com/gggeek/pinba_php. It's a reimplementation of the same API in php: slower, uses more ram, and reports less accurate timing data. But it is tested on all php versions from 5.3 to 8.1

gggeek avatar Dec 06 '22 08:12 gggeek

It's working both with php 8.1 and 8.2:

cat Dockerfile
FROM php:8.2

ENV PINBA_REF=4726c3666d27a2d25f073ea9a06720e3199fde09
RUN apt-get update \
    && apt-get install -y git \
    && git clone https://github.com/tony2001/pinba_extension.git /root/pinba_extension \
    && cd /root/pinba_extension \
    && git checkout ${PINBA_REF} \
    && phpize \
    && ./configure --enable-pinba \
    && make install

RUN echo "extension=pinba.so" > /usr/local/etc/php/conf.d/60-pinba.ini

time docker build --tag tmp .
[+] Building 0.7s (7/7) FINISHED
 => [internal] load build definition from Dockerfile                                                                  0.0s
 => => transferring dockerfile: 468B                                                                                  0.0s
 => [internal] load .dockerignore                                                                                     0.0s
 => => transferring context: 2B                                                                                       0.0s
 => [internal] load metadata for docker.io/library/php:8.2                                                            0.6s
 => [1/3] FROM docker.io/library/php:8.2@sha256:1ff766570a985398423fa93ccd98d5d76b7b4ffd395b4e99895a6ebe0236f584      0.0s
 => CACHED [2/3] RUN apt-get update     && apt-get install -y git     && git clone https://github.com/tony2001/pinba  0.0s
 => CACHED [3/3] RUN echo "extension=pinba.so" > /usr/local/etc/php/conf.d/60-pinba.ini                               0.0s
 => exporting to image                                                                                                0.0s
 => => exporting layers                                                                                               0.0s
 => => writing image sha256:896d7130d9c423505edbd9545bddd9d3ba212d7c79febb723a25ff6c45b1e7af                          0.0s
 => => naming to docker.io/library/tmp                                                                                0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
docker build --tag tmp .  0.12s user 0.14s system 19% cpu 1.343 total

docker run --rm -it tmp php -v
PHP 8.2.1 (cli) (built: Jan 11 2023 08:20:05) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.1, Copyright (c) Zend Technologie

docker run --rm -it tmp php -r "print_r(pinba_get_info());"
Array
(
    [mem_peak_usage] => 2097152
    [req_time] => 6.4E-5
    [ru_utime] => 4.4E-5
    [ru_stime] => 2.0E-5
    [req_count] => 1
    [doc_size] => 0
    [schema] =>
    [server_name] => unknown
    [script_name] => Standard input code
    [hostname] => a3b3b91bad79
    [timers] => Array
        (
        )

    [tags] => Array
        (
        )

)

Same for 8.1

caseycs avatar Jan 27 '23 09:01 caseycs