pinpoint-apm / pinpoint-c-agent

Pinpoint C Agent helps your monitor your PHP/PYTHON applications into [pinpoint-apm](https://github.com/pinpoint-apm/pinpoint).
http://pinpoint-apm.github.io/pinpoint/
Apache License 2.0
262 stars 77 forks source link

I need some help #596

Closed killen9 closed 3 months ago

killen9 commented 5 months ago

I need some help ...

##############PINPOINT########################### require_once DIR.'/../vendor/autoload.php'; define('APPLICATION_NAME','php'); define('APPLICATION_ID','2'); define('AOP_CACHE_DIR',DIR.'/../Cache/'); define('PLUGINS_DIR',DIR.'/../Plugins/'); define('PINPOINT_USE_CACHE','YES'); require_once DIR.'/../vendor/pinpoint-apm/pinpoint-php-aop/auto_pinpointed.php'; #################################################

collector.log

[2024-04-15 13:56:50.024840042] INFO client:10.0.0.167:35716 is online [2024-04-15 13:56:50.024928028] INFO send handshake msg:{"appid":"no","appname":"no","time":"1713141240"}

why "appid":"no","appname":"no ?

eeliu commented 5 months ago

why "appid":"no","appname":"no ?

it's an old setting, deprecated now. (agent information can be set at collector-agent side)

killen9 commented 5 months ago

how setting?

killen9 commented 5 months ago

Please tell me how to set up the collector-agent.

eeliu commented 5 months ago

collector-agent

https://github.com/pinpoint-apm/pinpoint-c-agent/blob/dev/DOC/collector-agent/readme.md

php agent

define('APPLICATION_NAME','php');
define('APPLICATION_ID','2');
killen9 commented 5 months ago

what?

killen9 commented 5 months ago

.bash_profile

export PP_COLLECTOR_AGENT_SPAN_IP=127.0.0.1 export PP_COLLECTOR_AGENT_SPAN_PORT=9993 export PP_COLLECTOR_AGENT_AGENT_IP=127.0.0.1 export PP_COLLECTOR_AGENT_AGENT_PORT=9991 export PP_COLLECTOR_AGENT_STAT_IP=127.0.0.1 export PP_COLLECTOR_AGENT_STAT_PORT=9992 export PP_COLLECTOR_AGENT_ISDOCKER=false export PP_LOG_DIR=/app/pinpoint/logs export PP_Log_Level=INFO export PP_ADDRESS=0.0.0.0@9999

php.ini

[pinpoint_php] extension = pinpoint_php.so pinpoint_php.CollectorHost = tcp:211.45.120.7:9999 pinpoint_php.SendSpanTimeOutMs = 0 pinpoint_php.TraceLimit = -1 pinpoint_php.DebugReport = true

[error_log] error_reporting = E_ALL

log_errors = On

error_log = /var/log/php/php-error.log

common.php

##############PINPOINT########################### require_once DIR.'/../vendor/autoload.php'; define('APPLICATION_NAME','GNB'); define('APPLICATION_ID','2'); define('AOP_CACHE_DIR',DIR.'/../Cache/'); define('PLUGINS_DIR',DIR.'/../Plugins/'); define('PINPOINT_USE_CACHE','YES'); require_once DIR.'/../vendor/pinpoint-apm/pinpoint-php-aop/auto_pinpointed.php'; #################################################

Is it different?

It is not registered on the web and cannot be connected to pinpoint-collector.

eeliu commented 5 months ago

Please attach the output of php agent.

https://github.com/pinpoint-apm/pinpoint-c-agent/blob/dev/testapps/PHP/php.ini

Does your pinpoint-collector locate at "PP_COLLECTOR_AGENT_SPAN_IP=127.0.0.1" ?

killen9 commented 5 months ago

It is installed locally.

killen9 commented 5 months ago

collector-agent / pinpoint-collector is installed locally.

eeliu commented 5 months ago

collector.log

[2024-04-15 13:56:50.024840042] INFO client:10.0.0.167:35716 is online [2024-04-15 13:56:50.024928028] INFO send handshake msg:{"appid":"no","appname":"no","time":"1713141240"}

why "appid":"no","appname":"no ?

Please tell me how to set up the collector-agent.

it looks collector-agent woks fine.

killen9 commented 5 months ago

collector.log

[2024-04-15 17:10:43.110591367] INFO client:127.0.0.1:50806 is online [2024-04-15 17:10:43.110772605] INFO send handshake msg:{"appid":"no","appname":"no","time":"1713165831"} [2024-04-15 17:10:43.111114644] WARN no FT [2024-04-15 17:10:43.111140757] WARN dispather packet with an exception: no FT [2024-04-15 17:10:43.111154559] WARN parseInComePacket catches error:no FT,client:127.0.0.1:50806 [2024-04-15 17:10:43.11116987] INFO connection:127.0.0.1:50806 is shutdown

why isn't registered on the web?

eeliu commented 5 months ago

Enable "log_errors= On " and share us the logging of your php application. https://github.com/pinpoint-apm/pinpoint-c-agent/blob/1bdfc706adc9cd44e93a9e6b08bd32fe1c6f685b/testapps/PHP/php.ini#L9

killen9 commented 5 months ago

no logging

killen9 commented 5 months ago

collector.log

[2024-04-15 17:51:14.645184858] INFO client:10.0.0.167:60632 is online [2024-04-15 17:51:14.645371276] INFO send handshake msg:{"appid":"no","appname":"no","time":"1713171031"} [2024-04-15 17:51:14.64558775] DEBUG size: 275 packetType: 1 body:{":E":252,":FT":1500,":S":1713171074392,"appid":"php-1","appname":"GNB","client":"192.168.10.20","clues":["46:200"],"name":"PHP Request: fpm-fcgi","server":"10.0.0.167","sid":"1718730853","stp":"1500","tid":"php-1^1713171066709^0","uri":"/gnuboard/bbs/board.php?bo_table=qa"} [2024-04-15 17:51:14.645708234] WARN no FT [2024-04-15 17:51:14.645762668] WARN dispather packet with an exception: no FT [2024-04-15 17:51:14.645790138] WARN parseInComePacket catches error:no FT,client:10.0.0.167:60632 [2024-04-15 17:51:14.645831342] INFO connection:10.0.0.167:60632 is shutdown

eeliu commented 5 months ago

collector.log

[2024-04-15 17:51:14.645184858] INFO client:10.0.0.167:60632 is online [2024-04-15 17:51:14.645371276] INFO send handshake msg:{"appid":"no","appname":"no","time":"1713171031"} [2024-04-15 17:51:14.64558775] DEBUG size: 275 packetType: 1 body:{":E":252,":FT":1500,":S":1713171074392,"appid":"php-1","appname":"GNB","client":"192.168.10.20","clues":["46:200"],"name":"PHP Request: fpm-fcgi","server":"10.0.0.167","sid":"1718730853","stp":"1500","tid":"php-1^1713171066709^0","uri":"/gnuboard/bbs/board.php?bo_table=qa"} [2024-04-15 17:51:14.645708234] WARN no FT [2024-04-15 17:51:14.645762668] WARN dispather packet with an exception: no FT [2024-04-15 17:51:14.645790138] WARN parseInComePacket catches error:no FT,client:10.0.0.167:60632 [2024-04-15 17:51:14.645831342] INFO connection:10.0.0.167:60632 is shutdown

Try the latest collector-agent .
docker pull ghcr.io/pinpoint-apm/pinpoint-c-agent/collector-agent:0.5.0

killen9 commented 5 months ago

define PHP_PINPOINT_PHP_VERSION "0.2.1"

eeliu commented 5 months ago

please update the collector-agent

killen9 commented 5 months ago

don't go build

[pin@Zenius collector-agent]$ go build common/config.go:9:2: no required module provides package github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1; to add it: go get github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1

killen9 commented 5 months ago

make error

[pin@Zenius collector-agent]$ make protoc --go_out=pinpoint-grpc-idl/proto/ --go-grpc_out=pinpoint-grpc-idl/proto --proto_path=pinpoint-grpc-idl/proto/ --go-grpc_opt=paths=source_relative v1/Annotation.proto v1/Cmd.proto v1/CustomMetric.proto v1/Service.proto v1/Span.proto v1/Stat.proto v1/ThreadDump.proto google/protobuf/wrappers.proto: File not found. v1/Annotation.proto: Import "google/protobuf/wrappers.proto" was not found or had errors. v1/Annotation.proto:15:5: "google.protobuf.StringValue" is not defined. v1/Annotation.proto:20:5: "google.protobuf.StringValue" is not defined. v1/Annotation.proto:21:5: "google.protobuf.StringValue" is not defined. v1/Annotation.proto:26:5: "google.protobuf.StringValue" is not defined. v1/Annotation.proto:27:5: "google.protobuf.StringValue" is not defined. v1/Annotation.proto:36:5: "google.protobuf.StringValue" is not defined. v1/Annotation.proto:47:5: "google.protobuf.StringValue" is not defined. v1/Annotation.proto:48:5: "google.protobuf.StringValue" is not defined. make: *** [makefile:8: protoc] Error 1

eeliu commented 5 months ago

you missed the submodule

git clone --recurse-submodules https://github.com/pinpoint-apm/pinpoint-c-agent.git

killen9 commented 5 months ago

fail

사용자 지정 1

eeliu commented 5 months ago

please check the dockerfile of collector-agent https://github.com/pinpoint-apm/pinpoint-c-agent/blob/dev/collector-agent/Dockerfile

Script for compile collector-agent

...
apk add make protobuf-dev
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
...
killen9 commented 5 months ago

what's mean?

i'm not use docker.

killen9 commented 5 months ago

[root@Zenius collector-agent]# go build common/config.go:9:2: no required module provides package github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1; to add it: go get github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1

1

eeliu commented 5 months ago

please check this https://github.com/pinpoint-apm/pinpoint-c-agent/issues/596#issuecomment-2058263607

killen9 commented 5 months ago

image

Dockerfile?

apk?

[root@Zenius collector-agent]# apk add --no-cache make protobuf-dev bash: apk: command not found...

????

killen9 commented 5 months ago

I want to install it as server, not as docker

CentOS Linux release 8.5.2111

eeliu commented 5 months ago

I tried by docker of centos 8 ,while it's EOL.

image

Here is checklist:

image

killen9 commented 5 months ago

[root@Zenius pin]# go version go version go1.22.0 linux/amd64 [root@Zenius pin]# protoc --version libprotoc 3.5.0

eeliu commented 5 months ago

how about "go install" ?

(venv) pinpoint@pinpoint:/workspace/collector-agent$ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest go: downloading google.golang.org/protobuf v1.33.0 go: downloading google.golang.org/grpc v1.63.2

killen9 commented 5 months ago

[root@Zenius app]# go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest go: downloading google.golang.org/protobuf v1.33.0 go: downloading google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 go: downloading google.golang.org/grpc v1.63.2 go: downloading google.golang.org/protobuf v1.28.1

killen9 commented 5 months ago

image

i think this link is problem.

image

no required module provides package github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1

eeliu commented 5 months ago

hmm, how about this command ?

protoc --go_out=pinpoint-grpc-idl/proto/ --go-grpc_out=pinpoint-grpc-idl/proto --proto_path=pinpoint-grpc-idl/proto/ --go-grpc_opt=paths=source_relative v1/Annotation.proto v1/Cmd.proto v1/CustomMetric.proto v1/Service.proto v1/Span.proto v1/Stat.proto v1/ThreadDump.proto

killen9 commented 5 months ago

[root@Zenius collector-agent]# protoc --go_out=pinpoint-grpc-idl/proto/ --go-grpc_out=pinpoint-grpc-idl/proto --proto_path=pinpoint-grpc-idl/proto/ --go-grpc_opt=paths=source_relative v1/Annotation.proto v1/Cmd.proto v1/CustomMetric.proto v1/Service.proto v1/Span.proto v1/Stat.proto v1/ThreadDump.proto google/protobuf/wrappers.proto: File not found. v1/Annotation.proto: Import "google/protobuf/wrappers.proto" was not found or had errors. v1/Annotation.proto:15:5: "google.protobuf.StringValue" is not defined. v1/Annotation.proto:20:5: "google.protobuf.StringValue" is not defined. v1/Annotation.proto:21:5: "google.protobuf.StringValue" is not defined. v1/Annotation.proto:26:5: "google.protobuf.StringValue" is not defined. v1/Annotation.proto:27:5: "google.protobuf.StringValue" is not defined. v1/Annotation.proto:36:5: "google.protobuf.StringValue" is not defined. v1/Annotation.proto:47:5: "google.protobuf.StringValue" is not defined. v1/Annotation.proto:48:5: "google.protobuf.StringValue" is not defined.

eeliu commented 5 months ago

try https://gist.github.com/olivoil/a2e0e4f3427db8b6ef4a6374f9c4cb32

backup the old one, if you need

killen9 commented 5 months ago

[root@Zenius collector-agent]# make protoc --go_out=pinpoint-grpc-idl/proto/ --go-grpc_out=pinpoint-grpc-idl/proto --proto_path=pinpoint-grpc-idl/proto/ --go-grpc_opt=paths=source_relative v1/Annotation.proto v1/Cmd.proto v1/CustomMetric.proto v1/Service.proto v1/Span.proto v1/Stat.proto v1/ThreadDump.proto protoc-gen-go: program not found or is not executable --go_out: protoc-gen-go: Plugin failed with status code 1. make: *** [makefile:8: protoc] Error 1 [root@Zenius collector-agent]# go build common/config.go:9:2: no required module provides package github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1; to add it: go get github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1 [root@Zenius collector-agent]# protoc --version libprotoc 3.5.0 [root@Zenius collector-agent]#

killen9 commented 5 months ago

.bash_profile add

export GOROOT=/usr/local/go export GOPATH=$HOME/go export GOBIN=$GOPATH/bin export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN

and compile success

killen9 commented 5 months ago

image

image

DB information cannot be retrieved.

eeliu commented 5 months ago

which php framework you used ?

killen9 commented 5 months ago

i'm not used framework.

eeliu commented 5 months ago

by the way, which mysql client used? just pdo ?

php-agent does not support c-level plugins yet, if used yii, \yii\db\Connection is JoinPoint

killen9 commented 5 months ago

[root@Zenius lib]# pwd /app/mysql/lib [root@Zenius lib]# ls libmariadbclient.a libmariadb.so libmariadb.so.3 libmysqlclient.a libmysqlclient_r.a libmysqlclient_r.so libmysqlclient.so libmysqlservices.a pkgconfig plugin

killen9 commented 5 months ago

why not call tree?

killen9 commented 5 months ago

my project html.zip

eeliu commented 5 months ago

As c-level function does not support yet, I will re-implement all plugins to support c-level in future.

sorry

killen9 commented 5 months ago

I don't know how to create a custom plugin. I'm just an operator, not a developer. Can you tell me how to set it up?

eeliu commented 5 months ago

@killen9

I find your project does not follow the psr-4, that means you can't use this version, even the custom plugin.

Ref

eeliu commented 5 months ago

I tag this issue into next major version.

killen9 commented 5 months ago

In addition to db information, I also want to display call-tree (trace) information and mem information. I would appreciate your help.

killen9 commented 5 months ago

image

image

image