Skip to content

Commit 61fd5c8

Browse files
olivermeyerclaude
andcommitted
feat(sentry): add configurable sentry_initialize and SentrySettings
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 parent b45d99c commit 61fd5c8

File tree

6 files changed

+525
-1
lines changed

6 files changed

+525
-1
lines changed

ATTRIBUTIONS.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
252252
253253
```
254254

255-
## aignostics-foundry-core (0.0.0) - MIT License
255+
## aignostics-foundry-core (0.1.0) - MIT License
256256

257257
🏭 Foundational infrastructure for Foundry components.
258258

@@ -7176,6 +7176,40 @@ are:
71767176
71777177
```
71787178

7179+
## sentry-sdk (2.56.0) - BSD License
7180+
7181+
Python client for Sentry (https://sentry.io)
7182+
7183+
* URL: https://github.com/getsentry/sentry-python
7184+
* Author(s): Sentry Team and Contributors
7185+
7186+
### License Text
7187+
7188+
```
7189+
MIT License
7190+
7191+
Copyright (c) 2018 Functional Software, Inc. dba Sentry
7192+
7193+
Permission is hereby granted, free of charge, to any person obtaining a copy
7194+
of this software and associated documentation files (the "Software"), to deal
7195+
in the Software without restriction, including without limitation the rights
7196+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7197+
copies of the Software, and to permit persons to whom the Software is
7198+
furnished to do so, subject to the following conditions:
7199+
7200+
The above copyright notice and this permission notice shall be included in all
7201+
copies or substantial portions of the Software.
7202+
7203+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
7204+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7205+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7206+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
7207+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
7208+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
7209+
SOFTWARE.
7210+
7211+
```
7212+
71797213
## setuptools (82.0.1) - UNKNOWN
71807214

71817215
Most extensible Python build backend with support for C/C++ extension modules

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ dependencies = [
5656
"pydantic>=2,<3",
5757
"pydantic-settings>=2,<3",
5858
"rich>=14,<15",
59+
"sentry-sdk>=2,<3",
5960
]
6061

6162
[dependency-groups]

src/aignostics_foundry_core/AGENTS.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This file provides an overview of all modules in `aignostics_foundry_core`, thei
1212
| **process** | Current process introspection | `ProcessInfo`, `ParentProcessInfo` Pydantic models and `get_process_info()` for runtime process metadata; `SUBPROCESS_CREATION_FLAGS` for subprocess creation |
1313
| **api.exceptions** | API exception hierarchy and FastAPI handlers | `ApiException` (500), `NotFoundException` (404), `AccessDeniedException` (401); `api_exception_handler`, `unhandled_exception_handler`, `validation_exception_handler` for FastAPI registration |
1414
| **log** | Configurable loguru logging initialisation | `logging_initialize(project_name, version, env_file, filter_func)`, `LogSettings` (env-prefix configurable), `InterceptHandler` for stdlib-to-loguru bridging |
15+
| **sentry** | Configurable Sentry integration | `sentry_initialize(project_name, version, environment, integrations, …)`, `SentrySettings` (env-prefix configurable), `set_sentry_user(user, role_claim)` for Auth0 user context |
1516
| **console** | Themed terminal output | Module-level `console` object (Rich `Console`) with colour theme and `_get_console()` factory |
1617
| **di** | Dependency injection | `locate_subclasses`, `locate_implementations`, `load_modules`, `discover_plugin_packages`, `clear_caches`, `PLUGIN_ENTRY_POINT_GROUP` for plugin and subclass discovery |
1718
| **health** | Service health checks | `Health` model and `HealthStatus` enum for tree-structured health status |
@@ -50,6 +51,19 @@ This file provides an overview of all modules in `aignostics_foundry_core`, thei
5051
- **Dependencies**: `loguru>=0.7,<1`, `platformdirs>=4,<5` (mandatory)
5152
- **Import**: `from aignostics_foundry_core.log import logging_initialize, LogSettings, InterceptHandler`
5253

54+
### sentry
55+
56+
**Configurable Sentry integration for error tracking and performance monitoring**
57+
58+
- **Purpose**: Bootstraps Sentry SDK with all project-specific metadata supplied as explicit parameters, making the initialisation reusable across any project without hard-coded constants.
59+
- **Key Features**:
60+
- `SentrySettings(OpaqueSettings)` — reads from `FOUNDRY_SENTRY_*` env vars by default; override prefix and env file via constructor kwargs (e.g. `SentrySettings(_env_prefix="BRIDGE_SENTRY_", _env_file=".env")`). Fields: `enabled`, `dsn` (validated HTTPS Sentry URL), `debug`, `send_default_pii`, `max_breadcrumbs`, `sample_rate`, `traces_sample_rate`, `profiles_sample_rate`, `profile_session_sample_rate`, `profile_lifecycle`, `enable_logs`
61+
- `sentry_initialize(project_name, version, environment, integrations, repository_url, documentation_url, is_container, is_test, is_cli, is_library, env_prefix, env_file)` — initialises Sentry SDK when enabled and DSN present; sets `aignx/base` context; suppresses noisy loggers; returns `True` on success, `False` otherwise
62+
- `set_sentry_user(user, role_claim)` — maps Auth0 user claims (`sub``id`, `email`, `name`, …) into Sentry scope; pass `None` to clear context; no-op when `sentry_sdk` is absent
63+
- **Location**: `aignostics_foundry_core/sentry.py`
64+
- **Dependencies**: `sentry-sdk>=2,<3` (mandatory); `loguru>=0.7,<1`
65+
- **Import**: `from aignostics_foundry_core.sentry import SentrySettings, sentry_initialize, set_sentry_user`
66+
5367
### models
5468

5569
**Shared output format enum for CLI and API responses**

0 commit comments

Comments
 (0)