apache / skywalking

APM, Application Performance Monitoring System
https://skywalking.apache.org/
Apache License 2.0
23.92k stars 6.53k forks source link

[Bug] PHP agent don't have any endpoint info #11488

Closed aclstack closed 1 year ago

aclstack commented 1 year ago

Search before asking

Apache SkyWalking Component

PHP (apache/skywalking-php)

What happened

version info

php: 7.4 skywalking-agent: 0.7.0 swoole: 4.8.11 oap-server: 9.5.0 oap-ui: 9.5.0

skywalking-agent config info

extension=skywalking_agent.so skywalking_agent.enable=On skywalking_agent.skywalking_version=9 skywalking_agent.log_level=Debug skywalking_agent.log_file=/tmp/sky.log skywalking_agent.server_addr=192.168.9.247:11800

php code

<?php
  $http = new Swoole\Http\Server('0.0.0.0', 9999);

$http->on('Request', function ($request, $response) {
    $response->header('Content-Type', 'text/html; charset=utf-8');
    $response->end('<h1>Hello Swoole. #' . rand(1000, 9999) . '</h1>');
});

$http->start();

skywalking-agent log

2023-11-02T07:03:11.569411Z  INFO skywalking_agent::module: Starting skywalking agent service_name="hello-skywalking" service_instance="85973406911653529770130878522534491500@172.17.0.4" skywalking_version=9 heartbeat_period=30 properties_report_period_factor=10
2023-11-02T07:03:11.571008Z DEBUG skywalking_agent::worker: Starting worker...
2023-11-02T07:03:11.571160Z DEBUG skywalking_agent::worker: Bind unix stream socket_file="/tmp/skywalking-agent/60925fb1b3167.sock"
2023-11-02T07:03:11.571336Z DEBUG skywalking_agent::reporter::reporter_grpc: Create Endpoint url="http://192.168.9.247:11800"
2023-11-02T07:03:11.571366Z DEBUG skywalking_agent::reporter::reporter_grpc: Skywalking TLS info enable_tls=false ssl_trusted_ca_path="" ssl_key_path="" ssl_cert_chain_path=""
2023-11-02T07:03:11.575336Z  INFO connect: skywalking_agent::reporter::reporter_grpc: Skywalking server connected uri="http://192.168.9.247:11800/"
2023-11-02T07:03:11.575381Z  INFO skywalking_agent::reporter::reporter_grpc: Worker is ready...
2023-11-02T07:03:11.576111Z DEBUG skywalking_agent::worker: Report instance properties props=Properties { inner: {"Process No.": ["127"], "language": ["php"], "ipv4": ["172.17.0.4"], "hostname": ["766b2c633708"], "OS Name": ["Linux"]} }

question

when i access http://127.0.0.1:9999, The oap Server have Service Name is hello-skywalking ,but this service don't have any Endpoint info

What you expected to happen

i want to Service hello-skywalking have Endpoit info

How to reproduce

Software deployment

Oap Server && ui

docker run --name oap --restart always -d -p 11800:11800 -p 12800:12800  apache/skywalking-oap-server:9.5.0
docker run --name oap-ui --restart always -d -p 12580:8080 -e SW_OAP_ADDRESS=http://192.168.9.247:12800 apache/skywalking-ui:9.5.0
# 192.168.9.247 is my server ip

php

start PHP script,

cat test.php
<?php
  $http = new Swoole\Http\Server('0.0.0.0', 9999);

$http->on('Request', function ($request, $response) {
    $response->header('Content-Type', 'text/html; charset=utf-8');
    $response->end('<h1>Hello Swoole. #' . rand(1000, 9999) . '</h1>');
});

$http->start();
php  test.php

access site

curl http://127.0.0.1:9999

Anything else

No response

Are you willing to submit a pull request to fix on your own?

Code of Conduct

jmjoy commented 1 year ago

What's the mean of Endpoit info?

aclstack commented 1 year ago

image

wu-sheng commented 1 year ago

What's the mean of Endpoit info?

Endpoint is the entry span from agent perspective.

jmjoy commented 1 year ago

I have try and the endpoints exists.

Is there traces in your case?

aclstack commented 1 year ago

This is my php Dockerfile

FROM hyperf/hyperf:7.4-alpine-v3.14-swoole

ENV RUSTFLAGS="-C target-feature=-crt-static"
ENV RUSTUP_DIST_SERVER="https://rsproxy.cn"
ENV RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"

RUN sed -i 's#dl-cdn.alpinelinux.org#mirrors.aliyun.com#g' /etc/apk/repositories &&  apk add php7-dev gcc g++ protoc make clang gcompat --no-cache && rm -rf /var/cache/apk/*

COPY skywalking-php/ /usr/local/skywalking-php/

RUN curl --proto '=https' --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh -s -- -y

RUN source $HOME/.cargo/env && cd /usr/local/skywalking-php && phpize && ./configure && make -j4 && make install &&  echo 'extension=skywalking_agent.so' >> /etc/php7/conf.d/60_skywalking_agent.ini  && rm -rf /usr/local/skywalking-php && rm -rf ~/.cargo/registry

FROM hyperf/hyperf:7.4-alpine-v3.14-swoole
ENV RUSTFLAGS="-C target-feature=-crt-static"

COPY --from=0 /usr/lib/php7/modules/skywalking_agent.so /usr/lib/php7/modules/skywalking_agent.so
COPY --from=0 /etc/php7/conf.d/60_skywalking_agent.ini /etc/php7/conf.d/60_skywalking_agent.ini

local skywalking-php is from git clone https://github.com/apache/skywalking-php.git

jmjoy commented 1 year ago

Your demo is very simple, should have been covered by integration testing. Is there be any other error logs ?

aclstack commented 1 year ago

when set skywalking_agent.log_level=TRACE and restart demo , i access http://127.0.0.1:9999/ the log info is

2023-11-03T06:26:49.006925Z  INFO skywalking_agent::worker: Start to shutdown skywalking grpc reporter
2023-11-03T06:26:49.006978Z  INFO skywalking_agent::worker: Remove socket file socket_file="/tmp/skywalking-agent/609399453fa45.sock"
2023-11-03T06:26:51.447624Z  INFO skywalking_agent::module: Starting skywalking agent service_name="hello-skywalking" service_instance="69498981748909088254532449806842367552@172.17.0.4" skywalking_version=9 heartbeat_period=30 properties_report_period_factor=10
2023-11-03T06:26:51.452122Z DEBUG skywalking_agent::worker: Starting worker...
2023-11-03T06:26:51.452258Z DEBUG skywalking_agent::worker: Bind unix stream socket_file="/tmp/skywalking-agent/6093997008c52.sock"
2023-11-03T06:26:51.452446Z DEBUG skywalking_agent::reporter::reporter_grpc: Create Endpoint url="http://192.168.9.247:11800"
2023-11-03T06:26:51.452480Z DEBUG skywalking_agent::reporter::reporter_grpc: Skywalking TLS info enable_tls=false ssl_trusted_ca_path="" ssl_key_path="" ssl_cert_chain_path=""
2023-11-03T06:26:51.454907Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.454946Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("define") class_name=None
2023-11-03T06:26:51.455129Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.455476Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.455750Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.455870Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.455897Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.456563Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.456666Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.456749Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.456953Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.456966Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("method_exists") class_name=None
2023-11-03T06:26:51.456981Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("define") class_name=None
2023-11-03T06:26:51.457025Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.457109Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.457145Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.457629Z DEBUG skywalking_agent::worker: Report instance properties props=Properties { inner: {"hostname": ["766b2c633708"], "ipv4": ["172.17.0.4"], "OS Name": ["Linux"], "language": ["php"], "Process No.": ["1495"]} }
2023-11-03T06:26:51.457680Z  INFO connect: skywalking_agent::reporter::reporter_grpc: Skywalking server connected uri="http://192.168.9.247:11800/"
2023-11-03T06:26:51.457712Z  INFO skywalking_agent::reporter::reporter_grpc: Worker is ready...
2023-11-03T06:26:51.457831Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.457983Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.458015Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.458115Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.458184Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.458259Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.458445Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.458611Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.458700Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.458757Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.458873Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.459070Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.459150Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.459223Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.459394Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.459439Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462120Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462185Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462321Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462483Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462516Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462575Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462598Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462649Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462675Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462691Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462710Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462726Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462743Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462775Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462857Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462912Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.462991Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.463045Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.463360Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.463543Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.463767Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.463793Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.464009Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.464120Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.466550Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.466967Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.467180Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.467214Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.467288Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.467427Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.467543Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.467695Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.467891Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.468023Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.468370Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.468643Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.468664Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("function_exists") class_name=None
2023-11-03T06:26:51.468679Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("function_exists") class_name=None
2023-11-03T06:26:51.468739Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.468747Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("class_alias") class_name=None
2023-11-03T06:26:51.468798Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.469196Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=None class_name=None
2023-11-03T06:26:51.469217Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("__construct") class_name=Some("Swoole\\Server")
2023-11-03T06:26:51.469333Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("on") class_name=Some("Swoole\\Server")
2023-11-03T06:26:51.469345Z TRACE skywalking_agent::execute: execute_internal infer request id request_id=None function_name="on" class_name=Some("Swoole\\Server")
2023-11-03T06:26:51.469370Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("on") class_name=Some("Swoole\\Server\\Port")
2023-11-03T06:26:51.469388Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("start") class_name=Some("Swoole\\Server")
2023-11-03T06:26:51.469513Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=Some("onBeforeStart") class_name=Some("Swoole\\Server\\Helper")
2023-11-03T06:26:51.472719Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=Some("onWorkerStart") class_name=Some("Swoole\\Server\\Helper")
2023-11-03T06:26:51.472729Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=Some("onWorkerStart") class_name=Some("Swoole\\Server\\Helper")
2023-11-03T06:26:51.473269Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=Some("onManagerStart") class_name=Some("Swoole\\Server\\Helper")
2023-11-03T06:26:51.473452Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=Some("onStart") class_name=Some("Swoole\\Server\\Helper")
2023-11-03T06:27:34.102729Z TRACE skywalking_agent::execute: execute_ex function and class name function_name=Some("{closure}") class_name=None
2023-11-03T06:27:34.102787Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("header") class_name=Some("Swoole\\Http\\Response")
2023-11-03T06:27:34.102823Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("rand") class_name=None
2023-11-03T06:27:34.102861Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("end") class_name=Some("Swoole\\Http\\Response")
2023-11-03T06:27:34.102987Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("__destruct") class_name=Some("Swoole\\Http\\Request")
2023-11-03T06:27:34.103026Z TRACE skywalking_agent::execute: execute_internal function and class name function_name=Some("__destruct") class_name=Some("Swoole\\Http\\Response")
aclstack commented 1 year ago

but if use docker image skyapm/skywalking-php:v4.2.0-7.2-fpm-alpine the service endpoints can display image

aclstack commented 1 year ago

Can anyone help me?

wu-sheng commented 1 year ago

but if use docker image skyapm/skywalking-php:v4.2.0-7.2-fpm-alpine the service endpoints can display

This agent has a totally different tech stack by two different authors.

You can provide your failure image to help reproduce the error. Right now, @jmjoy had tried, but worked on his side. You need to provide more context.

aclstack commented 1 year ago

image is commit to docker hub , use

docker pull aclstack/php-skywalking:0.7.0

can get it

aclstack commented 1 year ago

who can help me

wu-sheng commented 1 year ago

There is no point in asking every day. @jmjoy will check this when he has time.

jmjoy commented 1 year ago

I think the problem is $http->on('Request').

The first param Request is not request.

I will adapt this situation.