Skip to content

Commit

Permalink
uncomment setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Verhoog committed Jun 6, 2020
1 parent 7a0f346 commit ac34dfd
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 24 deletions.
28 changes: 28 additions & 0 deletions ddtrace/internal/buff_converter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "Python.h"

/* cython does not support this preprocessor check => write it in raw C */
#if PY_MAJOR_VERSION == 2
static PyObject *
buff_to_buff(char *buff, Py_ssize_t size)
{
return PyBuffer_FromMemory(buff, size);
}

#elif (PY_MAJOR_VERSION == 3) && (PY_MINOR_VERSION >= 3)
static PyObject *
buff_to_buff(char *buff, Py_ssize_t size)
{
return PyMemoryView_FromMemory(buff, size, PyBUF_READ);
}
#else
static PyObject *
buff_to_buff(char *buff, Py_ssize_t size)
{
Py_buffer pybuf;
if (PyBuffer_FillInfo(&pybuf, NULL, buff, size, 1, PyBUF_FULL_RO) == -1) {
return NULL;
}

return PyMemoryView_FromBuffer(&pybuf);
}
#endif
38 changes: 19 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,26 +150,26 @@ def get_exts_for(name):
setup_requires=["setuptools_scm", "cython"],
ext_modules=cythonize(
[
# Cython.Distutils.Extension(
# "ddtrace.internal._rand", sources=["ddtrace/internal/_rand.pyx"], language="c",
# ),
Cython.Distutils.Extension(
"ddtrace.internal._rand", sources=["ddtrace/internal/_rand.pyx"], language="c",
),
Cython.Distutils.Extension(
"ddtrace.internal._encoding", sources=["ddtrace/internal/_encoding.pyx"], language="c",
),
# Cython.Distutils.Extension(
# "ddtrace.profiling.collector.stack",
# sources=["ddtrace/profiling/collector/stack.pyx"],
# language="c",
# extra_compile_args=["-DPy_BUILD_CORE"],
# ),
# Cython.Distutils.Extension(
# "ddtrace.profiling.collector._traceback",
# sources=["ddtrace/profiling/collector/_traceback.pyx"],
# language="c",
# ),
# Cython.Distutils.Extension(
# "ddtrace.profiling._build", sources=["ddtrace/profiling/_build.pyx"], language="c",
# ),
Cython.Distutils.Extension(
"ddtrace.profiling.collector.stack",
sources=["ddtrace/profiling/collector/stack.pyx"],
language="c",
extra_compile_args=["-DPy_BUILD_CORE"],
),
Cython.Distutils.Extension(
"ddtrace.profiling.collector._traceback",
sources=["ddtrace/profiling/collector/_traceback.pyx"],
language="c",
),
Cython.Distutils.Extension(
"ddtrace.profiling._build", sources=["ddtrace/profiling/_build.pyx"], language="c",
),
],
compile_time_env={
"PY_MAJOR_VERSION": sys.version_info.major,
Expand All @@ -178,7 +178,7 @@ def get_exts_for(name):
},
force=True,
)
# + get_exts_for("wrapt")
# + get_exts_for("psutil"),
+ get_exts_for("wrapt")
+ get_exts_for("psutil"),
)
)
6 changes: 1 addition & 5 deletions tests/benchmarks/test_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ def gen_trace(nspans=1000, ntags=50, key_size=15, value_size=20, nmetrics=10):
for i in range(0, nspans):
parent_id = root.span_id if root else None
with Span(
t,
"span_name",
resource="/fsdlajfdlaj/afdasd%s" % i,
service="myservice",
parent_id=parent_id,
t, "span_name", resource="/fsdlajfdlaj/afdasd%s" % i, service="myservice", parent_id=parent_id,
) as span:
span._parent = root
span.set_tags({rands(key_size): rands(value_size) for _ in range(0, ntags)})
Expand Down

0 comments on commit ac34dfd

Please sign in to comment.