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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

.claude/settings.local.json
.serena
55 changes: 55 additions & 0 deletions test-aiohttp/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import os

import sentry_sdk
from aiohttp import web
from sentry_sdk.integrations.aiohttp import AioHttpIntegration


sentry_sdk.init(
dsn=os.environ.get("SENTRY_DSN"),
environment=os.environ.get("ENV", "test"),
_experiments={"trace_lifecycle": "stream"},
Comment thread
ericapisani marked this conversation as resolved.
traces_sample_rate=1.0,
profiles_sample_rate=1.0,
debug=True,
integrations=[
AioHttpIntegration(),
],
)


async def index(request):
return web.json_response(
{
"hello": "world!",
"error": "http://localhost:5000/error",
"http-error": "http://localhost:5000/http-error",
}
)


async def error(request):
sentry_sdk.set_user({"id": "testuser"})
raise ValueError("help! an error!")


async def http_error(request):
raise web.HTTPInternalServerError(reason="something went wrong")


@web.middleware
async def test_middleware(request, handler):
print("middleware")
return await handler(request)


def make_app():
app = web.Application(middlewares=[test_middleware])
app.router.add_get("/", index)
app.router.add_get("/error", error)
app.router.add_get("/http-error", http_error)
return app


if __name__ == "__main__":
web.run_app(make_app(), port=5000)
13 changes: 13 additions & 0 deletions test-aiohttp/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[project]
name = "test-aiohttp"
version = "0"
requires-python = ">=3.12"

dependencies = [
"aiohttp>=3.9",
"ipdb>=0.13.13",
"sentry-sdk[aiohttp]",
]

[tool.uv.sources]
sentry-sdk = { path = "../../sentry-python", editable = true }
12 changes: 12 additions & 0 deletions test-aiohttp/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# exit on first error
set -euo pipefail

# Install uv if it's not installed
if ! command -v uv &> /dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
fi

# Run the script
uv run python main.py
Loading