Skip to content

Commit

Permalink
update mysql-connector-python (#695)
Browse files Browse the repository at this point in the history
* [py] python version

> https://devguide.python.org/versions/

- remove python3.8

* [#693]  update mysql-connector-python

> #693
  • Loading branch information
eeliu authored Oct 28, 2024
1 parent ad5bda5 commit c4daa3a
Show file tree
Hide file tree
Showing 17 changed files with 107 additions and 31 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-13]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11","3.12","3.13"]
runs-on: ${{ matrix.os }}
needs: [cpp, cpp-windows]
steps:
Expand Down Expand Up @@ -276,10 +276,13 @@ jobs:
# run: docker-compose -f "testapps/compose.yaml" build python-plugins
# - name: build python-plugins
- name: start test environment
run: ./docker-compose-linux-x86_64 -f "testapps/compose.yaml" up python-plugins --exit-code-from python-plugins
run: |
./docker-compose-linux-x86_64 -f "testapps/compose.yaml" up py3.9-plugins --exit-code-from py3.9-plugins
./docker-compose-linux-x86_64 -f "testapps/compose.yaml" up py-plugins --exit-code-from py-plugins
./docker-compose-linux-x86_64 -f "testapps/compose.yaml" up py3.11-plugins --exit-code-from py3.11-plugins
- name: Stop containers
# if: always()
run: ./docker-compose-linux-x86_64 -f "testapps/compose.yaml" down python-plugins
run: ./docker-compose-linux-x86_64 -f "testapps/compose.yaml" down py3.11-plugins py-plugins py3.9-plugins

Collector-agent:
strategy:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Our advantage:

## Python Agent

> py 3.8+
> py 3.9+
`pip install pinpointPy`

Expand Down
2 changes: 1 addition & 1 deletion Readme-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Pinpoint-c-agent 帮助您接入 [pinpoint-apm](https://github.com/pinpoint-apm/

## Python Agent

> py 3.8+
> py 3.9+
`pip install pinpointPy`

Expand Down
2 changes: 1 addition & 1 deletion Readme-KR.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Pinpoint-c-agent는 [pinpoint-apm](https://github.com/pinpoint-apm/pinpoint) 모

## Python Agent

> py 3.8+
> py 3.9+
`pip install pinpointPy`

Expand Down
9 changes: 8 additions & 1 deletion plugins/PY/pinpointPy/libs/_MysqlConnector/CMysqlPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@
# ------------------------------------------------------------------------------

from pinpointPy import Common, Defines, pinpoint
import mysql
import warnings

#


class CMysqlPlugin(Common.PinTrace):

def __init__(self, name):
warnings.warn(
"CMysqlPlugin is deprecated, please use MysqlPlugin instead", DeprecationWarning)
super().__init__(name)

# -> tuple[Any, tuple[Any, ...], dict[str, Any]]:
Expand Down Expand Up @@ -48,4 +54,5 @@ def onException(self, traceId, e):
pinpoint.add_exception(f'{e}', traceId)

def get_cursor_host(self, cursor):
return f'{cursor._cnx.server_host}:{cursor._cnx.server_port}'
# https://github.com/mysql/mysql-connector-python/blob/4fbf521f1c6c71621f882f89c0c4946c10ee13ac/mysql-connector-python/lib/mysql/connector/abstracts.py#L692
return f'{cursor._connection._host}:{cursor._connection._host}'
6 changes: 5 additions & 1 deletion plugins/PY/pinpointPy/libs/_MysqlConnector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,9 @@ def monkey_patch():


__all__ = ['monkey_patch']
__version__ = '0.0.5'
__version__ = '0.0.6'
__author__ = '[email protected]'

# Changes
# ## 0.0.6
# - remove `CMySQLCursor` and `CMySQLCursorPrepared`
26 changes: 13 additions & 13 deletions plugins/PY/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
bottle==0.12.25
fastapi==0.111.0
flask==3.0.0
httpx==0.25.1
mysql-connector-python==8.0.31
pymongo==4.6.3
PyMySQL==1.1.1
redis==5.0.1
requests==2.31.0
SQLAlchemy==2.0.23
starlette-context==0.3.6
mysqlclient==2.2.0
bottle
fastapi
flask
httpx
mysql-connector-python
pymongo
PyMySQL
redis
requests
SQLAlchemy
starlette-context
mysqlclient
grpcio
grpc-interceptor==0.15.4
grpc-interceptor
psycopg2
pinpointPy
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
Path(cwd, './common/src')]

setup(name='pinpointPy',
version="1.3.1", # don't forget update __version__ in pinpointPy/__init__.py
version="1.3.2", # don't forget update __version__ in pinpointPy/__init__.py
author="cd_pinpoint members",
author_email='[email protected]',
license='Apache License 2.0',
Expand Down
2 changes: 1 addition & 1 deletion setup_pypi_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
Path(cwd, './common/src')]

setup(name='pinpointPy',
version="1.3.6", # don't forget update __version__ in pinpointPy/__init__.py
version="1.3.7", # don't forget update __version__ in pinpointPy/__init__.py
author="cd_pinpoint members",
author_email='[email protected]',
license='Apache License 2.0',
Expand Down
36 changes: 34 additions & 2 deletions testapps/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,41 @@ services:
ports:
- 27017:27017

python-plugins:
py3.9-plugins:
build:
dockerfile: testapps/python-plugins.dockerfile
dockerfile: testapps/python-plugins/py3.9-plugins.dockerfile
context: ../
profiles:
- testing
depends_on:
redis:
condition: service_healthy
httpbin:
condition: service_healthy
mongodb:
condition: service_healthy
postgres:
condition: service_healthy

py3.11-plugins:
build:
dockerfile: testapps/python-plugins/py3.11-plugins.dockerfile
context: ../
profiles:
- testing
depends_on:
redis:
condition: service_healthy
httpbin:
condition: service_healthy
mongodb:
condition: service_healthy
postgres:
condition: service_healthy

py-plugins:
build:
dockerfile: testapps/python-plugins/py-plugins.dockerfile
context: ../
profiles:
- testing
Expand Down
2 changes: 1 addition & 1 deletion testapps/django.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8
FROM python:3.12
WORKDIR /app/

COPY testapps/django/mysite/ /app/
Expand Down
2 changes: 1 addition & 1 deletion testapps/fastapi.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8
FROM python:3.12
WORKDIR /app/

COPY testapps/fastapi/ /app/
Expand Down
2 changes: 1 addition & 1 deletion testapps/grpc_py.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8
FROM python:3.12
WORKDIR /app/

COPY testapps/grpc-py/ /app/
Expand Down
2 changes: 1 addition & 1 deletion testapps/grpc_py_client.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8
FROM python:3.12
WORKDIR /app/

COPY testapps/grpc-py/ /app/
Expand Down
15 changes: 15 additions & 0 deletions testapps/python-plugins/py-plugins.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:latest

COPY setup.py /pinpoint-c-agent/setup.py
COPY common/ /pinpoint-c-agent/common
COPY README /pinpoint-c-agent/README
COPY plugins/PY /pinpoint-c-agent/plugins/PY
COPY src/PY /pinpoint-c-agent/src/PY


RUN pip install -r /pinpoint-c-agent/plugins/PY/requirements.txt
RUN cd /pinpoint-c-agent && pip install -e .
CMD ["python","-m","unittest","discover","-s","/pinpoint-c-agent/plugins/PY/pinpointPy/"]
# CMD [ "python","-m","unittest","pinpointPy.libs._MysqlConnector.test_case.Test_Case" ]
# CMD [ "sleep","infinity" ]
# python -m unittest discover -s /pinpoint-c-agent/plugins/PY/pinpointPy/
15 changes: 15 additions & 0 deletions testapps/python-plugins/py3.11-plugins.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:latest

COPY setup.py /pinpoint-c-agent/setup.py
COPY common/ /pinpoint-c-agent/common
COPY README /pinpoint-c-agent/README
COPY plugins/PY /pinpoint-c-agent/plugins/PY
COPY src/PY /pinpoint-c-agent/src/PY


RUN pip install -r /pinpoint-c-agent/plugins/PY/requirements.txt
RUN cd /pinpoint-c-agent && pip install -e .
CMD ["python","-m","unittest","discover","-s","/pinpoint-c-agent/plugins/PY/pinpointPy/"]
# CMD [ "python","-m","unittest","pinpointPy.libs._MysqlConnector.test_case.Test_Case" ]
# CMD [ "sleep","infinity" ]
# python -m unittest discover -s /pinpoint-c-agent/plugins/PY/pinpointPy/
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.13
FROM python:3.9

COPY setup.py /pinpoint-c-agent/setup.py
COPY common/ /pinpoint-c-agent/common
Expand All @@ -11,5 +11,5 @@ RUN pip install -r /pinpoint-c-agent/plugins/PY/requirements.txt
RUN cd /pinpoint-c-agent && pip install -e .
CMD ["python","-m","unittest","discover","-s","/pinpoint-c-agent/plugins/PY/pinpointPy/"]
# CMD [ "python","-m","unittest","pinpointPy.libs._MysqlConnector.test_case.Test_Case" ]
# CMD [ "bash" ]
# CMD [ "sleep","infinity" ]
# python -m unittest discover -s /pinpoint-c-agent/plugins/PY/pinpointPy/

0 comments on commit c4daa3a

Please sign in to comment.