Skip to content
Open
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
78 changes: 77 additions & 1 deletion .ci/.matrix_exclude.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ exclude:
FRAMEWORK: flask-2.3
- VERSION: python-3.7
FRAMEWORK: flask-3.0
- VERSION: python-3.14
FRAMEWORK: flask-1.0
# Python 3.10 removed a bunch of classes from collections, now in collections.abc
- VERSION: python-3.10
FRAMEWORK: django-1.11
Expand All @@ -80,6 +82,12 @@ exclude:
FRAMEWORK: celery-5-django-3
- VERSION: python-3.13 # https://github.com/celery/billiard/issues/377
FRAMEWORK: celery-5-django-4
- VERSION: python-3.14 # https://github.com/celery/billiard/issues/377
FRAMEWORK: celery-5-flask-2
- VERSION: python-3.14 # https://github.com/celery/billiard/issues/377
FRAMEWORK: celery-5-django-3
- VERSION: python-3.14 # https://github.com/celery/billiard/issues/377
FRAMEWORK: celery-5-django-4
- VERSION: python-3.10
FRAMEWORK: graphene-2
- VERSION: python-3.10
Expand Down Expand Up @@ -146,7 +154,35 @@ exclude:
FRAMEWORK: aiohttp-4.0
- VERSION: python-3.13
FRAMEWORK: cassandra-3.4
- VERSION: python-3.13
- VERSION: python-3.14
FRAMEWORK: django-1.11
- VERSION: python-3.14
FRAMEWORK: django-2.0
- VERSION: python-3.14
FRAMEWORK: django-2.1
- VERSION: python-3.14
FRAMEWORK: django-2.2
- VERSION: python-3.14
FRAMEWORK: django-3.0
- VERSION: python-3.14
FRAMEWORK: django-3.1
- VERSION: python-3.14
FRAMEWORK: django-3.2
- VERSION: python-3.14
FRAMEWORK: django-4.0
- VERSION: python-3.14
FRAMEWORK: django-4.2
- VERSION: python-3.14
FRAMEWORK: django-5.0
- VERSION: python-3.14
FRAMEWORK: graphene-2
- VERSION: python-3.14
FRAMEWORK: aiohttp-3.0
- VERSION: python-3.14
FRAMEWORK: aiohttp-4.0
- VERSION: python-3.14
FRAMEWORK: cassandra-3.4
- VERSION: python-3.14
FRAMEWORK: pymongo-3.5
# pymongo
- VERSION: python-3.10
Expand All @@ -157,6 +193,8 @@ exclude:
FRAMEWORK: pymongo-3.1
- VERSION: python-3.13
FRAMEWORK: pymongo-3.1
- VERSION: python-3.14
FRAMEWORK: pymongo-3.1
- VERSION: python-3.10
FRAMEWORK: pymongo-3.2
- VERSION: python-3.11
Expand All @@ -165,6 +203,8 @@ exclude:
FRAMEWORK: pymongo-3.2
- VERSION: python-3.13
FRAMEWORK: pymongo-3.2
- VERSION: python-3.14
FRAMEWORK: pymongo-3.2
- VERSION: python-3.10
FRAMEWORK: pymongo-3.3
- VERSION: python-3.11
Expand All @@ -173,6 +213,8 @@ exclude:
FRAMEWORK: pymongo-3.3
- VERSION: python-3.13
FRAMEWORK: pymongo-3.3
- VERSION: python-3.14
FRAMEWORK: pymongo-3.3
- VERSION: python-3.8
FRAMEWORK: pymongo-3.4
- VERSION: python-3.9
Expand All @@ -185,6 +227,12 @@ exclude:
FRAMEWORK: pymongo-3.4
- VERSION: python-3.13
FRAMEWORK: pymongo-3.4
- VERSION: python-3.13
FRAMEWORK: pymongo-3.5
- VERSION: python-3.14
FRAMEWORK: pymongo-3.4
- VERSION: python-3.14
FRAMEWORK: pymongo-3.5
- VERSION: pypy-3
FRAMEWORK: pymongo-3.0
# pymssql
Expand Down Expand Up @@ -212,6 +260,10 @@ exclude:
FRAMEWORK: boto3-1.5
- VERSION: python-3.13
FRAMEWORK: boto3-1.6
- VERSION: python-3.14
FRAMEWORK: boto3-1.5
- VERSION: python-3.14
FRAMEWORK: boto3-1.6
# aiohttp client, only supported in Python 3.7+
- VERSION: pypy-3
FRAMEWORK: aiohttp-3.0
Expand Down Expand Up @@ -259,6 +311,8 @@ exclude:
FRAMEWORK: asyncpg-0.28
- VERSION: python-3.13
FRAMEWORK: asyncpg-0.28
- VERSION: python-3.14
FRAMEWORK: asyncpg-0.28
# sanic
- VERSION: pypy-3
FRAMEWORK: sanic-newest
Expand All @@ -272,6 +326,8 @@ exclude:
FRAMEWORK: sanic-newest
- VERSION: python-3.13
FRAMEWORK: sanic-20.12
- VERSION: python-3.14
FRAMEWORK: sanic-20.12
# aioredis
- VERSION: pypy-3
FRAMEWORK: aioredis-newest
Expand Down Expand Up @@ -315,13 +371,23 @@ exclude:
FRAMEWORK: twisted-16
- VERSION: python-3.13
FRAMEWORK: twisted-15
- VERSION: python-3.14
FRAMEWORK: twisted-18
- VERSION: python-3.14
FRAMEWORK: twisted-17
- VERSION: python-3.14
FRAMEWORK: twisted-16
- VERSION: python-3.14
FRAMEWORK: twisted-15
# pylibmc
- VERSION: python-3.11
FRAMEWORK: pylibmc-1.4
- VERSION: python-3.12
FRAMEWORK: pylibmc-1.4
- VERSION: python-3.13
FRAMEWORK: pylibmc-1.4
- VERSION: python-3.14
FRAMEWORK: pylibmc-1.4
# grpc
- VERSION: python-3.6
FRAMEWORK: grpc-newest
Expand All @@ -339,6 +405,8 @@ exclude:
FRAMEWORK: grpc-1.24
- VERSION: python-3.13
FRAMEWORK: grpc-1.24
- VERSION: python-3.14
FRAMEWORK: grpc-1.24
- VERSION: python-3.7
FRAMEWORK: flask-1.0
- VERSION: python-3.7
Expand All @@ -350,10 +418,18 @@ exclude:
FRAMEWORK: sanic-20.12 # no wheels available yet
- VERSION: python-3.13
FRAMEWORK: cassandra-newest # c extension issue
- VERSION: python-3.14
FRAMEWORK: cassandra-newest # c extension issue
# httpx
- VERSION: python-3.13
FRAMEWORK: httpx-0.13
- VERSION: python-3.13
FRAMEWORK: httpx-0.14
- VERSION: python-3.13
FRAMEWORK: httpx-0.21
- VERSION: python-3.14
FRAMEWORK: httpx-0.13
- VERSION: python-3.14
FRAMEWORK: httpx-0.14
- VERSION: python-3.14
FRAMEWORK: httpx-0.21
1 change: 1 addition & 0 deletions .ci/.matrix_python_full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ VERSION:
- python-3.11
- python-3.12
- python-3.13
- python-3.14
# - pypy-3 # excluded due to build issues with SQLite/Django
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test:
# delete any __pycache__ folders to avoid hard-to-debug caching issues
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
# pypy3 should be added to the first `if` once it supports py3.7
if [[ "$$PYTHON_VERSION" =~ ^(3.7|3.8|3.9|3.10|3.11|3.12|3.13|nightly)$$ ]] ; then \
if [[ "$$PYTHON_VERSION" =~ ^(3.7|3.8|3.9|3.10|3.11|3.12|3.13|3.14|nightly)$$ ]] ; then \
echo "Python 3.7+, with asyncio"; \
pytest -v $(PYTEST_ARGS) --showlocals $(PYTEST_MARKER) $(PYTEST_JUNIT); \
else \
Expand Down
10 changes: 6 additions & 4 deletions elasticapm/contrib/django/middleware/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ def process_request_wrapper(wrapped, instance, args, kwargs):
elasticapm.set_transaction_name(
build_name_with_http_method_prefix(get_name_from_middleware(wrapped, instance), request)
)
finally:
return response
except Exception:
pass
return response


def process_response_wrapper(wrapped, instance, args, kwargs):
Expand All @@ -125,8 +126,9 @@ def process_response_wrapper(wrapped, instance, args, kwargs):
elasticapm.set_transaction_name(
build_name_with_http_method_prefix(get_name_from_middleware(wrapped, instance), request)
)
finally:
return response
except Exception:
pass
return response


class TracingMiddleware(MiddlewareMixin, ElasticAPMClientMiddlewareMixin):
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import ast
import codecs
import os

from setuptools import setup
Expand All @@ -68,7 +67,7 @@ def get_version():

:return: a string, indicating the version
"""
version_file = codecs.open(os.path.join("elasticapm", "version.py"), encoding="utf-8")
version_file = open(os.path.join("elasticapm", "version.py"), encoding="utf-8")
for line in version_file:
if line.startswith("__version__"):
version_tuple = ast.literal_eval(line.split(" = ")[1])
Expand Down
2 changes: 0 additions & 2 deletions tests/contrib/asyncio/starlette_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from shutil import ExecError

from tests.fixtures import TempStoreClient

import pytest # isort:skip
Expand Down
7 changes: 3 additions & 4 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import codecs
import gzip
import io
import itertools
Expand Down Expand Up @@ -75,11 +74,11 @@
SPAN_TYPES = json.load(f)


with codecs.open(ERRORS_SCHEMA, encoding="utf8") as errors_json, codecs.open(
with open(ERRORS_SCHEMA, encoding="utf8") as errors_json, open(
TRANSACTIONS_SCHEMA, encoding="utf8"
) as transactions_json, codecs.open(SPAN_SCHEMA, encoding="utf8") as span_json, codecs.open(
) as transactions_json, open(SPAN_SCHEMA, encoding="utf8") as span_json, open(
METRICSET_SCHEMA, encoding="utf8"
) as metricset_json, codecs.open(
) as metricset_json, open(
METADATA_SCHEMA, encoding="utf8"
) as metadata_json:
VALIDATORS = {
Expand Down
5 changes: 3 additions & 2 deletions tests/utils/stacks/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

from __future__ import absolute_import

import importlib
import os
import pkgutil

import pytest
from mock import Mock
Expand Down Expand Up @@ -240,7 +240,8 @@ def test_get_lines_from_file(lineno, context, expected):
def test_get_lines_from_loader(lineno, context, expected):
stacks.get_lines_from_file.cache_clear()
module = "tests.utils.stacks.linenos"
loader = pkgutil.get_loader(module)
spec = importlib.util.find_spec(module)
loader = spec.loader if spec is not None else None
fname = os.path.join(os.path.dirname(__file__), "linenos.py")
result = stacks.get_lines_from_file(fname, lineno, context, loader=loader, module_name=module)
assert result == expected
3 changes: 1 addition & 2 deletions tests/utils/test_wildcard_matcher_cases/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import codecs
import json
import os

Expand All @@ -40,7 +39,7 @@ def pytest_generate_tests(metafunc):
json_cases = os.path.join(
os.path.dirname(__file__), "..", "..", "upstream", "json-specs", "wildcard_matcher_tests.json"
)
with codecs.open(json_cases, encoding="utf8") as test_cases_file:
with open(json_cases, encoding="utf8") as test_cases_file:
test_cases = json.load(test_cases_file)
for test_case, pattern_sets in test_cases.items():
for pattern, texts in pattern_sets.items():
Expand Down
Loading