Skip to content

Commit

Permalink
Merge pull request #6 from letsbuilda/sentry
Browse files Browse the repository at this point in the history
Add Sentry.io
  • Loading branch information
shenanigansd authored Feb 21, 2023
2 parents 48fcdc1 + 1fb4958 commit d2fe43b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
Changelog
=========

- :release:`1.2.0 <20th February 2023>`
- :feature:`5` Add Sentry.io

- :release:`1.1.0 <13th February 2023>`
- :feature:`2` Bump fastapi from 0.90.1 to 0.91.0

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "api.letsbuilda.dev"
description = "Public API for our projects"
version = "1.1.0"
version = "1.2.0"
authors = [
{ name = "Bradley Reynolds", email = "[email protected]" },
]
Expand All @@ -12,6 +12,7 @@ dependencies = [
"fastapi==0.92.0",
"uvicorn[standard]==0.20.0",
"imsosorry==1.2.0",
"sentry-sdk[fastapi]==1.15.0",
]

[project.urls]
Expand Down
16 changes: 16 additions & 0 deletions src/api/server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""API server definition"""

from os import getenv

import sentry_sdk
from fastapi import APIRouter, FastAPI
from imsosorry import uwuify

Expand All @@ -8,6 +11,19 @@

from . import __version__

release_prefix = getenv("API_SENTRY_RELEASE_PREFIX", "api")
git_sha = getenv("GIT_SHA", "development")
sentry_sdk.init(
dsn=getenv("API_SENTRY_DSN"),
environment=getenv("API_SENTRY_ENV"),
send_default_pii=True,
traces_sample_rate=1.0,
_experiments={
"profiles_sample_rate": 1.0,
},
release=f"{release_prefix}@{git_sha}",
)


class TextModel(BaseModel):
"""Generic model for accepting arbitrary plain-text input"""
Expand Down

0 comments on commit d2fe43b

Please sign in to comment.