Skip to content

Commit dba2d81

Browse files
authored
refactor(pinpointpy): pinpointpy libs (#551)
- add httpbin - refactoring : logger ,pinpointpy/libs - mongo - db/mysql ... - request* - framework: Bottle,Django,pyramid,pyweb,pyweb2 - testcase
1 parent 5f6439d commit dba2d81

File tree

107 files changed

+2522
-1261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+2522
-1261
lines changed

.devcontainer/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ RUN groupadd --gid $USER_GID $USERNAME \
2828

2929

3030
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
31-
RUN apt update && apt install -y apt-utils gcc g++ gdb pkg-config libxml2-dev libsqlite3-dev libcurl4-openssl-dev zlib1g-dev make cmake wget autoconf git clangd iputils-ping python3 python3.8-venv python3-pip clang-format protobuf-compiler vim locales curl libssl-dev
31+
RUN apt update && apt install -y apt-utils gcc g++ gdb pkg-config libxml2-dev libsqlite3-dev libcurl4-openssl-dev zlib1g-dev make cmake wget autoconf git clangd iputils-ping python3 python3.8-venv python3-pip clang-format protobuf-compiler vim locales curl libssl-dev libmysqlclient-dev
3232
# https://github.com/git-lfs/git-lfs/blob/main/INSTALLING.md
3333
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
3434
RUN apt-get install git-lfs
3535
USER pinpoint
3636
# enable php-7.4
3737
ENV PHP_VESION=php-7.4.33
3838
ENV PHP_HOME=/home/pinpoint/local/
39-
COPY ${PHP_VESION}.tar.gz /home/pinpoint/${PHP_VESION}.tar.gz
39+
RUN wget https://github.com/eeliu/pinpoint-c-agent/files/13371519/${PHP_VESION}.tar.gz -O /home/pinpoint/${PHP_VESION}.tar.gz
4040
RUN cd /home/pinpoint/ && tar xvf ${PHP_VESION}.tar.gz && cd ${PHP_VESION} && ./configure --prefix=${PHP_HOME}/${PHP_VESION} --with-curl=shared --with-mysqli=shared --with-openssl=shared --with-pdo-sqlite=shared --enable-pdo=shared --with-zlib=shared --enable-fpm --enable-opcache --enable-debug && make -j && make install
4141

4242
ENV PATH="$PATH:${PHP_HOME}/php/bin/:${PHP_HOME}/php/sbin/"
43-
COPY php.ini ${PHP_HOME}/php/lib
43+
# COPY php.ini ${PHP_HOME}/php/lib
4444

4545
### Build php module
4646
### curl
@@ -69,9 +69,8 @@ COPY php.ini ${PHP_HOME}/php/lib
6969

7070
# install golang 1.18
7171
USER root
72-
COPY go1.18.10.linux-amd64.tar.gz /home/pinpoint/go1.18.10.linux-amd64.tar.gz
72+
RUN wget https://go.dev/dl/go1.18.10.linux-amd64.tar.gz -O /home/pinpoint/go1.18.10.linux-amd64.tar.gz
7373
RUN rm -rf /usr/local/go && cd /home/pinpoint/ && tar -C /usr/local -xzf go1.18.10.linux-amd64.tar.gz
7474
ENV PATH=$PATH:/usr/local/go/bin
75-
ENV
7675
ENV PATH=$PATH:/home/pinpoint/go/bin
7776
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2

.devcontainer/docker-compose.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ services:
1414
- '3306'
1515
volumes:
1616
- ..:/workspace:cached
17+
1718
redis:
1819
image: redis:alpine
1920
command: redis-server --port 6379
@@ -24,6 +25,26 @@ services:
2425
- "mode=standalone"
2526
ports:
2627
- 6379:6379
28+
volumes:
29+
- ..:/workspace:cached
30+
mongodb:
31+
image: 'mongo'
32+
restart: always
33+
hostname: mongodb
34+
# environment:
35+
# MONGO_INITDB_ROOT_USERNAME: root
36+
# MONGO_INITDB_ROOT_PASSWORD: password
37+
ports:
38+
- 27017:27017
39+
40+
httpbin:
41+
image: kennethreitz/httpbin:latest
42+
container_name: httpbin
43+
hostname: httpbin
44+
ports:
45+
- 8999:80
46+
volumes:
47+
- ..:/workspace:cached
2748

2849
pinpoint:
2950
container_name: pinpoint
@@ -44,6 +65,5 @@ services:
4465
- NET_RAW
4566
- NET_ADMIN
4667
user: pinpoint
47-
4868

4969

.devcontainer/go1.18.10.linux-amd64.tar.gz

Lines changed: 0 additions & 3 deletions
This file was deleted.

.devcontainer/php-7.4.33.tar.gz

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ jobs:
104104
runs-on: ${{ matrix.os }}
105105
steps:
106106
- uses: actions/checkout@v2
107-
- uses: jwlawson/actions-setup-cmake@v1.6
108-
with:
109-
cmake-version: "3.16.x"
110107
- uses: actions/setup-python@v2
111108
with:
112109
python-version: ${{ matrix.python-version }}
@@ -115,10 +112,21 @@ jobs:
115112
# ref https://github.com/pypa/setuptools/issues/3198
116113
pip install -e .
117114
python -m unittest discover -s src/PY/test
118-
- if: matrix.python-version == '3.8'
119-
run : |
120-
pip install -r plugins/PY/requirements.txt
121-
python -m unittest discover -s plugins/PY/pinpointPy
115+
python-plugins:
116+
# timeout-minutes: 20
117+
needs: Python
118+
runs-on: ubuntu-latest
119+
steps:
120+
- uses: actions/checkout@v2
121+
with:
122+
submodules: 'true'
123+
# - name: build python-plugins
124+
# run: docker-compose -f "testapps/compose.yaml" build python-plugins
125+
- name: start test environment
126+
run: docker-compose -f "testapps/compose.yaml" up python-plugins
127+
- name: Stop containers
128+
if: always()
129+
run: docker-compose -f "testapps/compose.yaml" down
122130
Collector-agent:
123131
strategy:
124132
matrix:

README.md

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,39 +58,13 @@ python3|[English](DOC/PY/Readme.md) [中文](DOC/PY/Readme-CN.md) [한국어](DO
5858
c/cpp|[English](DOC/C-CPP/Readme.md)
5959
golang|[go-aop-agent](https://github.com/pinpoint-apm/go-aop-agent)
6060

61-
#### How to use testapps(playground)
62-
63-
##### Requirement
64-
65-
- [ ] [docker compose plugin](https://docs.docker.com/compose/install/linux/)
66-
- [ ] pinpoint platform [Quick-start guide](https://pinpoint-apm.gitbook.io/pinpoint/getting-started/quickstart)
67-
- [ ] map `dev-pinpoint` host to your pinpoint-collector address
68-
```
69-
pinpoint@pinpoint:~$ cat /etc/hosts
70-
# 192.168.10.11 is the address of pinpoint-collector
71-
192.168.10.11 dev-pinpoint
72-
```
73-
##### Playground
74-
75-
```
76-
$ git clone --recurse-submodules https://github.com/pinpoint-apm/pinpoint-c-agent.git
77-
$ git checkout dev
78-
$ cd pinpoint-c-agent/testapps && docker compose up --build
79-
$ ## testapp-fastapi
80-
$ curl http://localhost:8186/docs#/
81-
$ ## testapp-php yii2 framework
82-
$ curl http://localhost:8185/index.php
83-
$ ## testapp-flask
84-
$ curl http://localhost:8184/index.php
85-
```
86-
87-
88-
61+
> [Try playground](/testapps/readme.md)
8962
9063
## Contact Us
9164

9265
* Submit an [issue](https://github.com/pinpoint-apm/pinpoint-c-agent/issues)
9366
* [Gitter char room](https://gitter.im/naver/pinpoint-c-agent)
67+
* dl_cd_pinpoint@navercorp.com
9468
* Chinese Community (QQ Group: 882020485)
9569
<details>
9670
<summary> show more

collector-agent/agent/GrpcAgent.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func (agent *GrpcAgent) collectorActiveThreadCount(conn *grpc.ClientConn, respon
321321
if activeThreadCountClient, err := client.CommandStreamActiveThreadCount(ctx); err == nil {
322322
sequenceId := int32(1)
323323
for {
324-
agent.log.Debugf("ResponseId %d", responseId)
324+
// agent.log.Debugf("ResponseId %d", responseId)
325325
response := v1.PCmdStreamResponse{
326326
ResponseId: responseId,
327327
SequenceId: sequenceId,
@@ -342,7 +342,7 @@ func (agent *GrpcAgent) collectorActiveThreadCount(conn *grpc.ClientConn, respon
342342
res.TimeStamp = time.Now().Unix()
343343
res.HistogramSchemaType = 2
344344

345-
agent.log.Debugf("try to send PCmdActiveThreadCountRes:%v", res)
345+
// agent.log.Debugf("try to send PCmdActiveThreadCountRes:%v", res)
346346

347347
if err := activeThreadCountClient.Send(&res); err != nil {
348348
agent.log.Warnf("collectorActiveThreadCount:responseId:%d end with:%s", responseId, err)

common/src/NodePool/TraceNode.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ void TraceNode::addChild(WrapperTraceNode& child) {
6464
child->mParentId = this->mPoolIndex;
6565
child->mRootIndex = this->mRootIndex;
6666
child->root_start_time = this->root_start_time;
67+
child->parent_start_time = this->start_time;
6768
}
6869

6970
void TraceNode::endTimer() {
@@ -83,7 +84,7 @@ void TraceNode::convertToSpan() {
8384

8485
void TraceNode::convertToSpanEvent() {
8586
this->AddTraceDetail(":E", this->cumulative_time);
86-
this->AddTraceDetail(":S", this->start_time - this->root_start_time);
87+
this->AddTraceDetail(":S", this->start_time - this->parent_start_time);
8788
}
8889

8990
// void TraceNode::setTraceParent(WrapperTraceNode &parent, WrapperTraceNode &root)

0 commit comments

Comments
 (0)