Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Unable to adapt to the Hyperf framework #12806

Closed
2 of 3 tasks
wisonlau opened this issue Nov 28, 2024 · 5 comments · Fixed by apache/skywalking-php#120
Closed
2 of 3 tasks

[Bug] Unable to adapt to the Hyperf framework #12806

wisonlau opened this issue Nov 28, 2024 · 5 comments · Fixed by apache/skywalking-php#120
Assignees
Labels
bug Something isn't working and you are sure it's a bug! php PHP agent related
Milestone

Comments

@wisonlau
Copy link

wisonlau commented Nov 28, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Apache SkyWalking Component

PHP (apache/skywalking-php)

What happened

according to https://skywalking.apache.org/docs/skywalking-php/next/en/configuration/context-injection/ File access, the following error occurred

2024-11-28T02:10:22.410539Z DEBUG skywalking_agent::plugin::plugin_curl: curl_getinfo get url: https://cms.tencentcloudapi.com/
2024-11-28T02:10:22.410691Z ERROR skywalking_agent::execute: before execute internal request_id=None function_name="curl_exec" class_name=None err=Anyhow(global tracing context not exists)

What you expected to happen

I hope it's normal not to report mistakes.

How to reproduce

It can be reproduced by accessing the official document.

config:

[skywalking_agent]
extension = skywalking_agent.so

; Enable skywalking_agent extension or not.
skywalking_agent.enable = Off

; Log file path.
skywalking_agent.log_file = /tmp/skywalking-agent.log

; Log level: one of `OFF`, `TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`.
skywalking_agent.log_level = DEBUG

; Address of skywalking oap server.
skywalking_agent.server_addr = 168.100.54.201:11800

; Application service name.
skywalking_agent.service_name = app-local

; Context injection
skywalking_agent.inject_context = On

starting mode:

php -d skywalking_agent.enable=On -d memory_limit=1G /opt/www/bin/hyperf.php start

Anything else

Hyperf is a Swoole-based framework that needs to run the way Swoole does. I started both grpc and http services within the framework,grpc services are monitored normally, but http services cannot be monitored.

Here's the full boot log.

2024-11-28T02:21:24.203389Z  INFO skywalking_agent::module: Starting skywalking agent service_name="app-local" service_instance="[email protected]" skywalking_version=9 heartbeat_period=30 properties_report_period_factor=10
2024-11-28T02:21:24.205124Z DEBUG skywalking_php_worker: Starting worker...
2024-11-28T02:21:24.205285Z DEBUG skywalking_php_worker: Bind unix stream socket_file="/tmp/skywalking-agent/627efbd24449f.sock"
2024-11-28T02:21:24.205448Z DEBUG skywalking_php_worker::reporter::reporter_grpc: Create Endpoint url="http://168.100.54.201:11800"
2024-11-28T02:21:24.205466Z DEBUG skywalking_php_worker::reporter::reporter_grpc: Skywalking TLS info enable_tls=false ssl_trusted_ca_path="" ssl_key_path="" ssl_cert_chain_path=""
2024-11-28T02:21:24.207119Z DEBUG skywalking_php_worker: Report instance properties props=Properties { inner: {"Process No.": ["1433"], "ipv4": ["172.16.0.67"], "OS Name": ["Linux"], "hostname": ["9809320f329a"], "language": ["php"]} }
2024-11-28T02:21:24.208134Z  INFO connect: skywalking_php_worker::reporter::reporter_grpc: Skywalking server connected uri="http://168.100.54.201:11800/"
2024-11-28T02:21:24.208164Z  INFO skywalking_php_worker::reporter::reporter_grpc: Worker is ready...
2024-11-28T02:21:24.815126Z DEBUG skywalking_agent::module: skywalking agent shutdown hook called
2024-11-28T02:21:24.829564Z  INFO skywalking_php_worker: Start to shutdown skywalking grpc reporter
2024-11-28T02:21:24.829589Z  INFO skywalking_php_worker: Remove socket file socket_file="/tmp/skywalking-agent/627efbd24449f.sock"
2024-11-28T02:21:35.938929Z  INFO skywalking_agent::module: Starting skywalking agent service_name="app-local" service_instance="[email protected]" skywalking_version=9 heartbeat_period=30 properties_report_period_factor=10
2024-11-28T02:21:35.940720Z DEBUG skywalking_php_worker: Starting worker...
2024-11-28T02:21:35.940784Z DEBUG skywalking_php_worker: Bind unix stream socket_file="/tmp/skywalking-agent/627efbdd756aa.sock"
2024-11-28T02:21:35.940918Z DEBUG skywalking_php_worker::reporter::reporter_grpc: Create Endpoint url="http://168.100.54.201:11800:11800"
2024-11-28T02:21:35.940936Z DEBUG skywalking_php_worker::reporter::reporter_grpc: Skywalking TLS info enable_tls=false ssl_trusted_ca_path="" ssl_key_path="" ssl_cert_chain_path=""
2024-11-28T02:21:35.942757Z DEBUG skywalking_php_worker: Report instance properties props=Properties { inner: {"Process No.": ["1452"], "language": ["php"], "ipv4": ["172.16.0.67"], "hostname": ["9809320f329a"], "OS Name": ["Linux"]} }
2024-11-28T02:21:35.944951Z  INFO connect: skywalking_php_worker::reporter::reporter_grpc: Skywalking server connected uri="http://168.100.54.201:11800/"
2024-11-28T02:21:35.945014Z  INFO skywalking_php_worker::reporter::reporter_grpc: Worker is ready...

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

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

@wisonlau wisonlau added the bug Something isn't working and you are sure it's a bug! label Nov 28, 2024
@wu-sheng
Copy link
Member

I think we never declared our support for that. @jmjoy right?

@wu-sheng wu-sheng added the php PHP agent related label Nov 28, 2024
@jmjoy
Copy link
Member

jmjoy commented Nov 28, 2024

Do you mean this problem only occurs when skywalking_agent.inject_context is enabled?

@wisonlau
Copy link
Author

Do you mean this problem only occurs when skywalking_agent.inject_context is enabled?

no, Not related to context injection, it should be incompatible with this framework

@jmjoy
Copy link
Member

jmjoy commented Nov 28, 2024

Which version of swoole and hyperf do you use?

@wu-sheng wu-sheng added this to the PHP - 0.8.0 milestone Nov 28, 2024
@wisonlau
Copy link
Author

wisonlau commented Nov 28, 2024

Which version of swoole and hyperf do you use?

hyperf 3.0
swoole 5.1.5

FROM hyperf/hyperf:8.1-alpine-v3.19-swoole
LABEL maintainer="Hyperf Developers <[email protected]>" version="1.0" license="MIT" app.name="Hyperf"
ARG timezone

ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \
    SCAN_CACHEABLE=(true)
0ea9bab0fe2d:/tmp# php -v
PHP 8.1.30 (cli) (built: Oct 31 2024 20:20:50) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.30, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.29, Copyright (c), by Zend Technologies
0ea9bab0fe2d:/tmp# php -m
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
fileinfo
filter
gd
grpc
hash
iconv
igbinary
json
libxml
mbstring
msgpack
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite
Phar
posix
protobuf
readline
redis
Reflection
session
SimpleXML
skywalking_agent
sockets
sodium
SPL
standard
swoole
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

0ea9bab0fe2d:/tmp# php -ri swoole
PHP Parse error:  syntax error, unexpected end of file in Command line code on line 1
0ea9bab0fe2d:/tmp# php --ri swoole

swoole

Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 5.1.5
Built => Oct 22 2024 06:13:45
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 3.1.7 3 Sep 2024
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
c-ares => 1.27.0
zlib => 1.3.1
brotli => E16781312/D16781312
mutex_timedlock => enabled
pthread_barrier => enabled
async_redis => enabled
coroutine_pgsql => enabled
coroutine_odbc => enabled
coroutine_sqlite => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_fiber_mock => Off => Off
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608


0ea9bab0fe2d:/tmp# php --ri swoole

swoole

Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 5.1.5
Built => Oct 22 2024 06:13:45
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 3.1.7 3 Sep 2024
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
c-ares => 1.27.0
zlib => 1.3.1
brotli => E16781312/D16781312
mutex_timedlock => enabled
pthread_barrier => enabled
async_redis => enabled
coroutine_pgsql => enabled
coroutine_odbc => enabled
coroutine_sqlite => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_fiber_mock => Off => Off
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608

0ea9bab0fe2d:/opt/www# composer info | grep hyperf
hyperf/async-queue                 3.0.43            A async queue component for hyperf.
hyperf/cache                       3.0.37            A cache component for hyperf.
hyperf/circuit-breaker             3.0.37            A circuit breaker component for hyperf.
hyperf/code-generator              0.3.3             Code Generator for Hyperf
hyperf/code-parser                 3.0.37            A code parser component for Hyperf.
hyperf/codec                       3.0.38            A codec component for Hyperf.
hyperf/collection                  3.0.44            Hyperf Collection package which come from illuminate/collections
hyperf/command                     3.0.41            Command for hyperf
hyperf/conditionable               3.0.37            Hyperf Macroable package which come from illuminate/conditionable
hyperf/config                      3.0.37            An independent component that provides configuration container.
hyperf/config-center               3.0.37            The abstraction component of config center
hyperf/config-nacos                3.0.37            A nacos adapter for config center component.
hyperf/constants                   3.0.37            A constants component for hyperf.
hyperf/context                     3.0.37            A coroutine/application context library.
hyperf/contract                    3.0.37            The contracts of Hyperf.
hyperf/coordinator                 3.0.37            Hyperf Coordinator
hyperf/coroutine                   3.0.37            Hyperf Coroutine
hyperf/crontab                     3.0.45            A crontab component for Hyperf.
hyperf/database                    3.0.49            A flexible database library.
hyperf/db-connection               3.0.37            A hyperf db connection handler for hyperf/database.
hyperf/devtool                     3.0.45            A Devtool for Hyperf.
hyperf/di                          3.0.42            A DI for Hyperf.
hyperf/dispatcher                  3.0.37            A HTTP Server for Hyperf.
hyperf/elasticsearch               3.0.37            Elasticsearch client for hyperf
hyperf/engine                      2.11.0            Coroutine engine provided by swoole.
hyperf/engine-contract             1.10.1            Contract for Coroutine Engine
hyperf/event                       3.0.37            an event manager that implements PSR-14.
hyperf/exception-handler           3.0.37            Exception handler for hyperf
hyperf/filesystem                  3.0.37            flysystem integration for hyperf
hyperf/framework                   3.0.45            A coroutine framework that focuses on hyperspeed and flexible, specifically...
hyperf/grpc                        3.0.38            A GRPC basic library for Hyperf.
hyperf/grpc-client                 3.0.37            A GRPC Client for Hyperf.
hyperf/grpc-server                 3.0.44            A GRPC Server for Hyperf.
hyperf/guzzle                      3.0.37            Swoole coroutine handler for guzzle
hyperf/http-message                3.0.37            microservice framework base on swoole
hyperf/http-server                 3.0.45            A HTTP Server for Hyperf.
hyperf/http2-client                3.0.37            A HTTP2 client library for Hyperf.
hyperf/ide-helper                  3.0.45            IDE help files for Hyperf.
hyperf/kafka                       3.0.41            A kafka client for Hyperf
hyperf/logger                      3.0.37            A logger component for hyperf.
hyperf/macroable                   3.0.37            Hyperf Macroable package which come from illuminate/macroable
hyperf/memory                      3.0.37            An independent component that use to operate and manage memory.
hyperf/metric                      3.0.43            hyperf metric component
hyperf/model-cache                 3.0.43            A model cache component for hyperf.
hyperf/model-listener              3.0.37            A model listener for Hyperf.
hyperf/nacos                       3.0.37            Nacos SDK
hyperf/paginator                   3.0.37            A paginator component for hyperf.
hyperf/pipeline                    3.0.37            Hyperf Macroable package which come from illuminate/pipeline
hyperf/pool                        3.0.37            An independent universal connection pool component.
hyperf/process                     3.0.37            A process component for hyperf.
hyperf/rate-limit                  3.0.45            A rate limiter implemented for Hyperf or other coroutine framework
hyperf/redis                       3.0.40            A redis component for hyperf.
hyperf/resource                    3.0.37            A api resource component for hyperf.
hyperf/resource-grpc               3.0.37            A api resource component for hyperf grpc server.
hyperf/retry                       3.0.37            A retry component for hyperf.
hyperf/scout                       3.0.37            Hyperf Scout provides a driver based solution to searching your Eloquent mo...
hyperf/serializer                  3.0.37            A serializer component for Hyperf.
hyperf/server                      3.0.39            A base server library for Hyperf.
hyperf/signal                      3.0.37            A signal library for Hyperf.
hyperf/snowflake                   3.0.37            A snowflake library
hyperf/stringable                  3.0.40            Hyperf Stringable package which come from illuminate/support
hyperf/support                     3.0.43            A support component for Hyperf.
hyperf/tappable                    3.0.37            Hyperf Macroable package which come from illuminate/tappable
hyperf/testing                     3.0.45            Testing for hyperf
hyperf/token-bucket                2.0.0             Implementation of the Token Bucket algorithm.
hyperf/translation                 3.0.42            An independent translation component, forked by illuminate/translation.
hyperf/utils                       3.0.37            A tools package that could help developer solved the problem quickly.
hyperf/validation                  3.0.44            hyperf validation
hyperf/watcher                     3.0.45            Hot reload watcher for Hyperf
hyperf/websocket-server            3.0.37            A websocket server library for Hyperf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working and you are sure it's a bug! php PHP agent related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants