Skip to content
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
6 changes: 5 additions & 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.2", # don't forget update __version__ in pinpointPy/__init__.py
version="1.3.3", # don't forget update __version__ in pinpointPy/__init__.py
author="cd_pinpoint members",
author_email='[email protected]',
license='Apache License 2.0',
Expand All @@ -61,6 +61,10 @@

"""
# Changed
## 1.3.3
- fix `str(xxx)` #716
## 1.3.2
- update mysql-connector-python in #695
## 1.3.1
- fix bug https://github.com/pinpoint-apm/pinpoint-c-agent/issues/626
## 1.3.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.7", # don't forget update __version__ in pinpointPy/__init__.py
version="1.3.8", # don't forget update __version__ in pinpointPy/__init__.py
author="cd_pinpoint members",
author_email='[email protected]',
license='Apache License 2.0',
Expand Down
19 changes: 14 additions & 5 deletions src/PY/_pinpoint_py.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,24 @@ static PyObject *py_pinpoint_add_clues(PyObject *self, PyObject *args) {
*/
static PyObject *py_pinpoint_add_clue(PyObject *self, PyObject *args) {
char *key = NULL;
char *value = NULL;
// char *value = NULL;
PyObject *value = NULL;
int id = -1;
int loc = 0;
if (PyArg_ParseTuple(args, "ss|ii", &key, &value, &id, &loc)) {
if (PyArg_ParseTuple(args, "sO|ii", &key, &value, &id, &loc)) {
if (id == -1) {
id = pinpoint_get_per_thread_id();
}

pinpoint_add_clue(id, key, value, loc);
PyObject *str_obj = PyObject_Str(value);
if (str_obj) {
// patch for https://github.com/pinpoint-apm/pinpoint-c-agent/issues/716
// it likes str(value)
const char *c_str = PyUnicode_AsUTF8(str_obj);
if (c_str) {
pinpoint_add_clue(id, key, c_str, loc);
}
Py_DECREF(str_obj);
}
}
return Py_BuildValue("O", Py_True);
}
Expand Down Expand Up @@ -265,7 +274,7 @@ static PyObject *py_pinpoint_enable_debug(PyObject *, PyObject *) {
static PyObject *py_set_agent(PyObject *self, PyObject *args,
PyObject *keywds) {
// PyObject* setting;
bool ret = false;
// bool ret = false;
char default_host[] = "collector_host";
char default_tracelimit[] = "trace_limit";
char default_timeout[] = "time_out_ms";
Expand Down
2 changes: 1 addition & 1 deletion src/PY/test/testCoroutines.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def pinpoint_trace(*args, **kwargs):
self.assertEqual(value, '12345')

ret = await func(*args, **kwargs)
_pinpointPy.add_clue('end', '3434', id)
_pinpointPy.add_clue('end', b'3434', id)
id = _pinpointPy.end_trace(id)
return pinpoint_trace

Expand Down
6 changes: 6 additions & 0 deletions src/PY/test/testPinpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def test_invalid_input(self):

def test_encode(self):
_pinpointPy.start_trace()
_pinpointPy.add_clue("key", bytes("value3", 'utf-8'))
_pinpointPy.add_clues("CN", "测试中文编码")
_pinpointPy.add_clues("KR", "한국어 인코딩 테스트 ")
_pinpointPy.add_clues("JP", "日本語エンコーディングをテストする ")
Expand All @@ -39,6 +40,11 @@ def test_trace_life(self):

_pinpointPy.add_clue("key", "value")
_pinpointPy.add_clue("key", "value3")
_pinpointPy.add_clue('end', b'3434')
_pinpointPy.add_clue('end', ('3434', '23'))
_pinpointPy.add_clue('end', ['3434', '23'])
_pinpointPy.add_clue('end', {'3434': 23, '23': 23})
_pinpointPy.add_clue('end', 1314)
_pinpointPy.set_context_key('sid', '12345')
value = _pinpointPy.get_context_key('sid')
self.assertEqual(value, '12345')
Expand Down
10 changes: 8 additions & 2 deletions src/PY/test/testUnderProcessMode.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ def _test_api_flow(self):
_pinpointPy.start_trace()
_pinpointPy.set_context_key('sid', id)
_pinpointPy.add_clue("key", "value3")
_pinpointPy.add_clue("key", bytes("value3", 'utf-8'))
_pinpointPy.add_clue('end', b'3434')
_pinpointPy.add_clue('end', ('3434', '23'))
_pinpointPy.add_clue('end', ['3434', '23'])
_pinpointPy.add_clue('end', {'3434': 23, '23': 23})
_pinpointPy.add_clue('end', 1314)
_pinpointPy.add_clues("key", "value3")
value = _pinpointPy.get_context_key('sid')
self.assertEqual(value, id)
Expand All @@ -30,8 +36,8 @@ def _test_api_flow(self):
_pinpointPy.force_flush_trace()
_pinpointPy.drop_trace()

@unittest.skipIf(platform.system() == "Darwin", "skip Darwin")
@unittest.skipIf(platform.system() == "Windows", "skip Windows")
@ unittest.skipIf(platform.system() == "Darwin", "skip Darwin")
@ unittest.skipIf(platform.system() == "Windows", "skip Windows")
def test_process(self):
p1 = Process(target=self._test_api_flow)
p1.start()
Expand Down
5 changes: 5 additions & 0 deletions src/PY/test/testUnderThreadMode.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ def _test_api_flow(self):
self.assertTrue(_pinpointPy.trace_has_root())
_pinpointPy.set_context_key('sid', '12345678')
_pinpointPy.add_clue("key", "value3")
_pinpointPy.add_clue('end', b'3434')
_pinpointPy.add_clue('end', ('3434', '23'))
_pinpointPy.add_clue('end', ['3434', '23'])
_pinpointPy.add_clue('end', {'3434': 23, '23': 23})
_pinpointPy.add_clue('end', 1314)
_pinpointPy.add_clues("key", "value3")
value = _pinpointPy.get_context_key('sid')
self.assertEqual(value, '12345678')
Expand Down
Loading