Skip to content

Commit 490830d

Browse files
committed
[#693] update mysql-connector-python
> #693
1 parent f50ab19 commit 490830d

File tree

10 files changed

+99
-23
lines changed

10 files changed

+99
-23
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,13 @@ jobs:
276276
# run: docker-compose -f "testapps/compose.yaml" build python-plugins
277277
# - name: build python-plugins
278278
- name: start test environment
279-
run: ./docker-compose-linux-x86_64 -f "testapps/compose.yaml" up python-plugins --exit-code-from python-plugins
279+
run: |
280+
./docker-compose-linux-x86_64 -f "testapps/compose.yaml" up py3.9-plugins --exit-code-from py3.9-plugins
281+
./docker-compose-linux-x86_64 -f "testapps/compose.yaml" up py-plugins --exit-code-from py-plugins
282+
./docker-compose-linux-x86_64 -f "testapps/compose.yaml" up py3.11-plugins --exit-code-from py3.11-plugins
280283
- name: Stop containers
281284
# if: always()
282-
run: ./docker-compose-linux-x86_64 -f "testapps/compose.yaml" down python-plugins
285+
run: ./docker-compose-linux-x86_64 -f "testapps/compose.yaml" down py3.11-plugins py-plugins py3.9-plugins
283286

284287
Collector-agent:
285288
strategy:

plugins/PY/pinpointPy/libs/_MysqlConnector/CMysqlPlugin.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@
1515
# ------------------------------------------------------------------------------
1616

1717
from pinpointPy import Common, Defines, pinpoint
18+
import mysql
19+
import warnings
20+
21+
#
1822

1923

2024
class CMysqlPlugin(Common.PinTrace):
2125

2226
def __init__(self, name):
27+
warnings.warn(
28+
"CMysqlPlugin is deprecated, please use MysqlPlugin instead", DeprecationWarning)
2329
super().__init__(name)
2430

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

5056
def get_cursor_host(self, cursor):
51-
return f'{cursor._cnx.server_host}:{cursor._cnx.server_port}'
57+
# https://github.com/mysql/mysql-connector-python/blob/4fbf521f1c6c71621f882f89c0c4946c10ee13ac/mysql-connector-python/lib/mysql/connector/abstracts.py#L692
58+
return f'{cursor._connection._host}:{cursor._connection._host}'

plugins/PY/pinpointPy/libs/_MysqlConnector/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,9 @@ def monkey_patch():
5555

5656

5757
__all__ = ['monkey_patch']
58-
__version__ = '0.0.5'
58+
__version__ = '0.0.6'
5959
__author__ = '[email protected]'
60+
61+
# Changes
62+
# ## 0.0.6
63+
# - remove `CMySQLCursor` and `CMySQLCursorPrepared`

plugins/PY/requirements.txt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
bottle==0.12.25
2-
fastapi==0.111.0
3-
flask==3.0.0
4-
httpx==0.25.1
5-
mysql-connector-python==9.1.0
6-
pymongo==4.6.3
7-
PyMySQL==1.1.1
8-
redis==5.0.1
9-
requests==2.31.0
10-
SQLAlchemy==2.0.23
11-
starlette-context==0.3.6
12-
mysqlclient==2.2.0
1+
bottle
2+
fastapi
3+
flask
4+
httpx
5+
mysql-connector-python
6+
pymongo
7+
PyMySQL
8+
redis
9+
requests
10+
SQLAlchemy
11+
starlette-context
12+
mysqlclient
1313
grpcio
14-
grpc-interceptor==0.15.4
14+
grpc-interceptor
1515
psycopg2
1616
pinpointPy

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
Path(cwd, './common/src')]
4040

4141
setup(name='pinpointPy',
42-
version="1.3.1", # don't forget update __version__ in pinpointPy/__init__.py
42+
version="1.3.2", # don't forget update __version__ in pinpointPy/__init__.py
4343
author="cd_pinpoint members",
4444
author_email='[email protected]',
4545
license='Apache License 2.0',

setup_pypi_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
Path(cwd, './common/src')]
3838

3939
setup(name='pinpointPy',
40-
version="1.3.6", # don't forget update __version__ in pinpointPy/__init__.py
40+
version="1.3.7", # don't forget update __version__ in pinpointPy/__init__.py
4141
author="cd_pinpoint members",
4242
author_email='[email protected]',
4343
license='Apache License 2.0',

testapps/compose.yaml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,41 @@ services:
224224
ports:
225225
- 27017:27017
226226

227-
python-plugins:
227+
py3.9-plugins:
228228
build:
229-
dockerfile: testapps/python-plugins.dockerfile
229+
dockerfile: testapps/python-plugins/py3.9-plugins.dockerfile
230+
context: ../
231+
profiles:
232+
- testing
233+
depends_on:
234+
redis:
235+
condition: service_healthy
236+
httpbin:
237+
condition: service_healthy
238+
mongodb:
239+
condition: service_healthy
240+
postgres:
241+
condition: service_healthy
242+
243+
py3.11-plugins:
244+
build:
245+
dockerfile: testapps/python-plugins/py3.11-plugins.dockerfile
246+
context: ../
247+
profiles:
248+
- testing
249+
depends_on:
250+
redis:
251+
condition: service_healthy
252+
httpbin:
253+
condition: service_healthy
254+
mongodb:
255+
condition: service_healthy
256+
postgres:
257+
condition: service_healthy
258+
259+
py-plugins:
260+
build:
261+
dockerfile: testapps/python-plugins/py-plugins.dockerfile
230262
context: ../
231263
profiles:
232264
- testing
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM python:latest
2+
3+
COPY setup.py /pinpoint-c-agent/setup.py
4+
COPY common/ /pinpoint-c-agent/common
5+
COPY README /pinpoint-c-agent/README
6+
COPY plugins/PY /pinpoint-c-agent/plugins/PY
7+
COPY src/PY /pinpoint-c-agent/src/PY
8+
9+
10+
RUN pip install -r /pinpoint-c-agent/plugins/PY/requirements.txt
11+
RUN cd /pinpoint-c-agent && pip install -e .
12+
CMD ["python","-m","unittest","discover","-s","/pinpoint-c-agent/plugins/PY/pinpointPy/"]
13+
# CMD [ "python","-m","unittest","pinpointPy.libs._MysqlConnector.test_case.Test_Case" ]
14+
# CMD [ "sleep","infinity" ]
15+
# python -m unittest discover -s /pinpoint-c-agent/plugins/PY/pinpointPy/
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM python:latest
2+
3+
COPY setup.py /pinpoint-c-agent/setup.py
4+
COPY common/ /pinpoint-c-agent/common
5+
COPY README /pinpoint-c-agent/README
6+
COPY plugins/PY /pinpoint-c-agent/plugins/PY
7+
COPY src/PY /pinpoint-c-agent/src/PY
8+
9+
10+
RUN pip install -r /pinpoint-c-agent/plugins/PY/requirements.txt
11+
RUN cd /pinpoint-c-agent && pip install -e .
12+
CMD ["python","-m","unittest","discover","-s","/pinpoint-c-agent/plugins/PY/pinpointPy/"]
13+
# CMD [ "python","-m","unittest","pinpointPy.libs._MysqlConnector.test_case.Test_Case" ]
14+
# CMD [ "sleep","infinity" ]
15+
# python -m unittest discover -s /pinpoint-c-agent/plugins/PY/pinpointPy/

testapps/python-plugins.dockerfile renamed to testapps/python-plugins/py3.9-plugins.dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.13
1+
FROM python:3.9
22

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

0 commit comments

Comments
 (0)