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

feat(py): flask plugins #538 #539

Merged
merged 4 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ USER root
## install developmental env
ENV TZ=Asia/Shanghai
ENV LC_CTYPE=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
# ENV LC_ALL=en_US.UTF-8
# referr from https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user
ARG USERNAME=pinpoint
ARG USER_UID=1000
Expand All @@ -28,10 +28,11 @@ RUN groupadd --gid $USER_GID $USERNAME \


RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt install -y gcc g++ gdb pkg-config libxml2-dev libsqlite3-dev libcurl4-openssl-dev zlib1g-dev make cmake wget autoconf git clangd python3-pip clang-format protobuf-compiler vim
## enable php-7.4
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
# enable php-7.4
ENV PHP_VESION=php-7.4.33
RUN cd ~ && wget https://www.php.net/distributions/${PHP_VESION}.tar.gz && tar xvf ${PHP_VESION}.tar.gz && cd ${PHP_VESION} && ./configure --prefix=/opt/${PHP_VESION} --enable-fpm --enable-opcache --enable-debug && make -j && make install
COPY ${PHP_VESION}.tar.gz /repo/${PHP_VESION}.tar.gz
RUN cd /repo && tar xvf ${PHP_VESION}.tar.gz && cd ${PHP_VESION} && ./configure --prefix=/opt/${PHP_VESION} --enable-fpm --enable-opcache --enable-debug && make -j && make install
ENV PATH="$PATH:/opt/php/bin/:/opt/php/sbin/"
COPY php.ini /opt/$PHP_VESION/lib

Expand Down Expand Up @@ -61,9 +62,9 @@ COPY php.ini /opt/$PHP_VESION/lib


# install golang 1.18

RUN wget https://go.dev/dl/go1.18.10.linux-amd64.tar.gz && rm -rf /usr/local/go && tar -C /usr/local -xzf go1.18.10.linux-amd64.tar.gz
COPY go1.18.10.linux-amd64.tar.gz /repo/go1.18.10.linux-amd64.tar.gz
RUN rm -rf /usr/local/go && cd /repo/ && tar -C /usr/local -xzf go1.18.10.linux-amd64.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
ENV GO_PATH=~/go
ENV PATH=$PATH:/$GO_PATH/bin
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
56 changes: 23 additions & 33 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
{
"name": "PINPOINT php Dev",
"dockerFile": "Dockerfile",
"runArgs": [
"--user=pinpoint",
"--cap-add=SYS_PTRACE",
"--cap-add=NET_RAW",
"--cap-add=NET_ADMIN",
"--security-opt=seccomp=unconfined",
"--volume=${env:HOME}:${env:HOME}",
"--volume=/var/run/docker.sock:/var/run/docker.sock",
// "--volume=envoy-build:/build",
"--network=host",
// Uncomment next line if you have devcontainer.env
// "--env-file=.devcontainer/devcontainer.env"
"service": "pinpoint",
"dockerComposeFile": [
"docker-compose.yaml"
],
"containerEnv": {
"ENVOY_SRCDIR": "${containerWorkspaceFolder}",
},
"workspaceFolder": "/workspace",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"bazel.buildifierFixOnFormat": true,
Expand All @@ -33,22 +21,24 @@
},
"remoteUser": "pinpoint",
"containerUser": "pinpoint",
"postCreateCommand": ".devcontainer/setup.sh",
// "postCreateCommand": ".devcontainer/setup.sh",
"extensions": [
"zxh404.vscode-proto3",
"llvm-vs-code-extensions.vscode-clangd",
"vadimcn.vscode-lldb",
"webfreak.debug",
"ms-python.python",
"xaver.clang-format",
"zxh404.vscode-proto3",
"Gruntfuggly.todo-tree",
"msyrus.go-doc",
"golang.go",
"bierner.github-markdown-preview",
"bierner.markdown-emoji",
"ms-vscode.cmake-tools",
"matepek.vscode-catch2-test-adapter",
"adam-bender.commit-message-editor"
]
"zxh404.vscode-proto3",
"llvm-vs-code-extensions.vscode-clangd",
"vadimcn.vscode-lldb",
"webfreak.debug",
"ms-python.python",
"xaver.clang-format",
"zxh404.vscode-proto3",
"Gruntfuggly.todo-tree",
"msyrus.go-doc",
"golang.go",
"bierner.github-markdown-preview",
"bierner.markdown-emoji",
"ms-vscode.cmake-tools",
"matepek.vscode-catch2-test-adapter",
"adam-bender.commit-message-editor",
"formulahendry.vscode-mysql",
"ms-python.autopep8"
]
}
49 changes: 49 additions & 0 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
version: '3.9'

services:
dev-mysql:
image: mysql:5.7
restart: always
container_name: dev-mysql
hostname: dev-mysql
environment:
MYSQL_ROOT_PASSWORD: 'password'
ports:
- '3306:3306'
expose:
- '3306'
volumes:
- ..:/workspace:cached
redis:
image: redis:alpine
command: redis-server --port 6379
container_name: redis_boot
hostname: redis_boot
labels:
- "name=redis"
- "mode=standalone"
ports:
- 6379:6379

pinpoint:
container_name: pinpoint
command: sleep infinity
hostname: pinpoint
build:
context: ./
dockerfile: Dockerfile
# args:
volumes:
- ..:/workspace:cached
- /var/run/docker.sock:/var/run/docker.sock
# - ${env:HOME}:/workspace
security_opt:
- seccomp=unconfined
cap_add:
- SYS_PTRACE
- NET_RAW
- NET_ADMIN
user: pinpoint



3 changes: 3 additions & 0 deletions .devcontainer/go1.18.10.linux-amd64.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions .devcontainer/php-7.4.33.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.devcontainer/*.gz filter=lfs diff=lfs merge=lfs -text
.devcontainer/go1.18.10.linux-amd64.tar.gz filter=lfs diff=lfs merge=lfs -text
.devcontainer/php-7.4.33.tar.gz filter=lfs diff=lfs merge=lfs -text
10 changes: 7 additions & 3 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ name: build-wheels
on:
workflow_dispatch:
inputs:
release-testpypi:
description: Do you want to release to test-pypi
required: true
default: "true"
release:
description: Do you want to release to pipy
description: Do you want to release to pypi
required: true
default: "false"

jobs:
build_wheels_pypitest:
if: ${{ github.event.inputs.release-testpypi }} == "true"
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -58,7 +63,6 @@ jobs:
publish-pypitest:
needs: build_wheels_pypitest
runs-on: ubuntu-latest
if: ${{ github.event.inputs.release }} == "true"
steps:
- uses: actions/download-artifact@v3
with:
Expand All @@ -78,6 +82,7 @@ jobs:
repository_url: https://test.pypi.org/legacy/

build_wheels:
if: ${{ github.event.inputs.release }} == "true"
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -121,7 +126,6 @@ jobs:
publish:
needs: build_wheels
runs-on: ubuntu-latest
if: ${{ github.event.inputs.release }} == "true"
steps:
- uses: actions/download-artifact@v3
with:
Expand Down
25 changes: 7 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ jobs:
php-versions: ["7.0"]
steps:
- uses: actions/checkout@v2
# - name: set mysql
# run: |
# sudo service mysql start
# sudo mysql --host='127.0.0.1' --user='root' --password='root' < '/home/runner/work/pinpoint-c-agent/pinpoint-c-agent/testapps/PHP/tests/script.sql'
# - name: set redis
# run: |
# sudo apt-get install redis-server
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
Expand Down Expand Up @@ -117,13 +110,13 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- run: |
pip install -r requirements.txt
python setup.py install || echo "failed, but ignore"
# nosetests does not support python3 anymore
# nosetests src/PY/test --ignore-files="TestCoroutines.*"
python -m unittest discover -s src/PY/test -p 'Test*.py'

- name: run unittest
run: |
# ref https://github.com/pypa/setuptools/issues/3198
pip install -e .
python -m unittest discover -s src/PY/test
pip install -r plugins/PY/requirements.txt
python -m unittest discover -s plugins/PY/pinpointPy
Collector-agent:
strategy:
matrix:
Expand All @@ -145,8 +138,4 @@ jobs:

- run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
# cd collector-agent
# go mod download
# go build
# go test ./... -v
cd collector-agent && make && go test ./... -v
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ aclocal.m4
src/PHP/pinpoint_php.dep
testapps/PHP/composer.phar
collector-agent/collector-agent
common/include/common.h
.cache
compile_commands.json
wheelhouse/
Expand Down
Loading