diff --git a/CHANGELOG.md b/CHANGELOG.md
index c277c34..5ea5780 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,8 @@
   ([PR #283](https://github.com/scoutapp/scout_apm_python/pull/283)).
 - Improve warning message for deprecated `log_level` configuration option
   ([PR #288](https://github.com/scoutapp/scout_apm_python/pull/288)).
+- Track errors on Pyramid
+  ([PR #298](https://github.com/scoutapp/scout_apm_python/pull/298)).
 
 ## [2.6.0] 2019-10-22
 
diff --git a/src/scout_apm/pyramid.py b/src/scout_apm/pyramid.py
index 73ade4e..b4d7f97 100644
--- a/src/scout_apm/pyramid.py
+++ b/src/scout_apm/pyramid.py
@@ -77,17 +77,18 @@ def instruments(handler, registry):
                     track_amazon_request_queue_time(amazon_queue_time, tracked_request)
 
             try:
-                response = handler(request)
+                try:
+                    response = handler(request)
+                finally:
+                    # Routing further down the call chain. So time it starting
+                    # above, but only name it if it gets a name
+                    if request.matched_route is not None:
+                        tracked_request.mark_real_request()
+                        span.operation = "Controller/" + request.matched_route.name
             except Exception:
                 tracked_request.tag("error", "true")
                 raise
 
-            # This happens further down the call chain. So time it starting
-            # above, but only name it if it gets to here.
-            if request.matched_route is not None:
-                tracked_request.mark_real_request()
-                span.operation = "Controller/" + request.matched_route.name
-
         finally:
             tracked_request.stop_span()
 

Report error requests on Pyramid
Currently if an error occurs in a Pyramid request, we don't report it. Error cases can be just as useful to see so we should try and do this. It looks like it's possible by rearranging the existing code.
diff --git a/tests/integration/test_pyramid.py b/tests/integration/test_pyramid.py
index fb4df40..2606691 100644
--- a/tests/integration/test_pyramid.py
+++ b/tests/integration/test_pyramid.py
@@ -217,7 +217,13 @@ def test_server_error(tracked_requests):
     with app_with_scout() as app, pytest.raises(ValueError):
         TestApp(app).get("/crash/", expect_errors=True)
 
-    assert tracked_requests == []
+    assert len(tracked_requests) == 1
+    tracked_request = tracked_requests[0]
+    assert tracked_request.tags["path"] == "/crash/"
+    assert tracked_request.tags["error"] == "true"
+    assert len(tracked_request.complete_spans) == 1
+    span = tracked_request.complete_spans[0]
+    assert span.operation == "Controller/crash"
 
 
 def test_no_monitor(tracked_requests):

pip install -e .[dev]
parse_log_pytest
requirements.txt
black flake8 isort tox bottle celery Django elasticsearch flask flask-sqlalchemy jinja2 mock pymongo pyramid pytest pytest-travis-fold pytest-cov redis six sqlalchemy starlette urllib3 webtest
apt-get update apt-get install -y gcc
3.7
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
amqp==5.3.1
anyio==3.7.1
asgiref==3.7.2
async-timeout==4.0.3
beautifulsoup4==4.13.3
billiard==3.6.4.0
black==23.3.0
bottle==0.13.2
cached-property==1.5.2
celery==5.2.7
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
click==8.1.8
click-didyoumean==0.3.1
click-plugins==1.1.1
click-repl==0.3.0
coverage==7.2.7
distlib==0.3.9
Django==3.2.25
dnspython==2.3.0
elastic-transport==8.13.1
elasticsearch==8.14.0
exceptiongroup==1.2.2
filelock==3.12.2
flake8==5.0.4
Flask==2.2.5
Flask-SQLAlchemy==3.0.5
greenlet==3.1.1
hupper==1.12.1
idna==3.10
importlib-metadata==4.2.0
iniconfig==2.0.0
isort==5.11.5
itsdangerous==2.1.2
Jinja2==3.1.6
kombu==5.2.4
MarkupSafe==2.1.5
mccabe==0.7.0
mock==5.2.0
mypy-extensions==1.0.0
packaging==24.0
PasteDeploy==3.1.0
pathspec==0.11.2
plaster==1.1.2
plaster-pastedeploy==1.0.1
platformdirs==2.6.2
pluggy==1.2.0
prompt_toolkit==3.0.48
psutil==5.9.8
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
pymongo==4.7.3
pyramid==2.0.2
pytest==7.4.4
pytest-cov==4.1.0
pytest-travis-fold==1.3.0
pytz==2025.2
redis==5.0.8
requests==2.31.0
-e git+https://github.com/scoutapp/scout_apm_python.git@6d62cf25e2d749359307b5b51df6236f5d387329#egg=scout_apm
six==1.17.0
sniffio==1.3.1
soupsieve==2.4.1
SQLAlchemy==2.0.40
sqlparse==0.4.4
starlette==0.29.0
tomli==2.0.1
tox==3.28.0
translationstring==1.4
typed-ast==1.5.5
typing_extensions==4.7.1
urllib3==2.0.7
venusian==3.1.1
vine==5.1.0
virtualenv==20.16.2
waitress==2.1.2
wcwidth==0.2.13
WebOb==1.8.9
WebTest==3.0.1
Werkzeug==2.2.3
zipp==3.15.0
zope.deprecation==5.0
zope.interface==6.4.post2

name: scout_apm_python
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - amqp==5.3.1
      - anyio==3.7.1
      - asgiref==3.7.2
      - async-timeout==4.0.3
      - beautifulsoup4==4.13.3
      - billiard==3.6.4.0
      - black==23.3.0
      - bottle==0.13.2
      - cached-property==1.5.2
      - celery==5.2.7
      - charset-normalizer==3.4.1
      - click==8.1.8
      - click-didyoumean==0.3.1
      - click-plugins==1.1.1
      - click-repl==0.3.0
      - coverage==7.2.7
      - distlib==0.3.9
      - django==3.2.25
      - dnspython==2.3.0
      - elastic-transport==8.13.1
      - elasticsearch==8.14.0
      - exceptiongroup==1.2.2
      - filelock==3.12.2
      - flake8==5.0.4
      - flask==2.2.5
      - flask-sqlalchemy==3.0.5
      - greenlet==3.1.1
      - hupper==1.12.1
      - idna==3.10
      - importlib-metadata==4.2.0
      - iniconfig==2.0.0
      - isort==5.11.5
      - itsdangerous==2.1.2
      - jinja2==3.1.6
      - kombu==5.2.4
      - markupsafe==2.1.5
      - mccabe==0.7.0
      - mock==5.2.0
      - mypy-extensions==1.0.0
      - packaging==24.0
      - pastedeploy==3.1.0
      - pathspec==0.11.2
      - plaster==1.1.2
      - plaster-pastedeploy==1.0.1
      - platformdirs==2.6.2
      - pluggy==1.2.0
      - prompt-toolkit==3.0.48
      - psutil==5.9.8
      - py==1.11.0
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
      - pymongo==4.7.3
      - pyramid==2.0.2
      - pytest==7.4.4
      - pytest-cov==4.1.0
      - pytest-travis-fold==1.3.0
      - pytz==2025.2
      - redis==5.0.8
      - requests==2.31.0
      - six==1.17.0
      - sniffio==1.3.1
      - soupsieve==2.4.1
      - sqlalchemy==2.0.40
      - sqlparse==0.4.4
      - starlette==0.29.0
      - tomli==2.0.1
      - tox==3.28.0
      - translationstring==1.4
      - typed-ast==1.5.5
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - venusian==3.1.1
      - vine==5.1.0
      - virtualenv==20.16.2
      - waitress==2.1.2
      - wcwidth==0.2.13
      - webob==1.8.9
      - webtest==3.0.1
      - werkzeug==2.2.3
      - zipp==3.15.0
      - zope-deprecation==5.0
      - zope-interface==6.4.post2
prefix: /opt/conda/envs/scout_apm_python

tests/integration/test_pyramid.py::test_server_error
tests/integration/test_pyramid.py::test_home tests/integration/test_pyramid.py::test_filtered_params[params0-/?foo=bar] tests/integration/test_pyramid.py::test_filtered_params[params1-/?foo=bar&foo=bar2] tests/integration/test_pyramid.py::test_filtered_params[params2-/?password=%5BFILTERED%5D] tests/integration/test_pyramid.py::test_filtered_params[params3-/?password=%5BFILTERED%5D&password=%5BFILTERED%5D] tests/integration/test_pyramid.py::test_user_ip[headers0-extra_environ0-None] tests/integration/test_pyramid.py::test_user_ip[headers1-extra_environ1-1.1.1.1] tests/integration/test_pyramid.py::test_user_ip[headers2-extra_environ2-1.1.1.1] tests/integration/test_pyramid.py::test_user_ip[headers3-extra_environ3-1.1.1.1] tests/integration/test_pyramid.py::test_user_ip[headers4-extra_environ4-1.1.1.1] tests/integration/test_pyramid.py::test_user_ip[headers5-extra_environ5-1.1.1.1] tests/integration/test_pyramid.py::test_user_ip[headers6-extra_environ6-1.1.1.1] tests/integration/test_pyramid.py::test_user_ip[headers7-extra_environ7-1.1.1.1] tests/integration/test_pyramid.py::test_user_ip[headers8-extra_environ8-1.1.1.1] tests/integration/test_pyramid.py::test_user_ip[headers9-extra_environ9-1.1.1.1] tests/integration/test_pyramid.py::test_user_ip_error tests/integration/test_pyramid.py::test_queue_time[X-Queue-Start] tests/integration/test_pyramid.py::test_queue_time[X-Request-Start] tests/integration/test_pyramid.py::test_queue_time_error tests/integration/test_pyramid.py::test_amazon_queue_time tests/integration/test_pyramid.py::test_home_ignored tests/integration/test_pyramid.py::test_hello tests/integration/test_pyramid.py::test_not_found tests/integration/test_pyramid.py::test_no_monitor
src/scout_apm/pyramid.py CHANGELOG.md
src/scout_apm/pyramid.py CHANGELOG.md