Skip to content

4.7.1 — 2026-05-03

← 4.7.0 | ↑ 4.x series

Added

Helpers - Tracing

  • TracingUtils Class - Introduced a new TracingUtils utility class in archipy/helpers/utils/tracing_utils.py to centralise all tracing initialisation and gRPC metadata helpers.
    • is_tracing_enabled(config) — checks whether any tracing backend (Sentry or Elastic APM) is active
    • init_tracing_if_needed(config) — lazily initialises the appropriate tracing backend once per process
    • grpc_status_indicates_success(status_code) — maps gRPC status codes to a boolean success/failure outcome
    • inject_outbound_metadata(metadata, carrier) — propagates W3C trace context into outbound gRPC metadata
    • extract_inbound_trace(metadata_dict) — extracts and activates an inbound trace context from gRPC metadata

Configs - Sentry

  • Extended SentryConfig - Added nine new optional fields to SentryConfig in ConfigTemplate for fine-grained Sentry SDK control.
    • SEND_DEFAULT_PII (bool, default False) — controls whether personally identifiable information (IP address, user) is sent
    • MAX_BREADCRUMBS (int, default 100) — limits the number of breadcrumbs stored per event
    • ATTACH_STACKTRACE (bool, default False) — attaches a stack trace to every captured message, not only exceptions
    • SERVER_NAME (str | None, default None) — overrides the hostname reported to Sentry
    • IN_APP_INCLUDE (list[str]) — module path prefixes that Sentry marks as in-app in stack traces
    • IN_APP_EXCLUDE (list[str]) — module path prefixes excluded from in-app marking
    • PROFILES_SAMPLE_RATE (float, default 0.0) — continuous profiling sample rate between 0.0 and 1.0
    • IGNORE_ERRORS (list[str]) — fully qualified or short exception type names that Sentry should silence
    • SHUTDOWN_TIMEOUT (int, default 2) — seconds the SDK waits to flush pending events on process exit
    • DEFAULT_INTEGRATIONS (bool, default True) — toggles Sentry's automatic default integrations

Changed

Helpers - Tracing

  • gRPC Client Interceptor Refactor - Rewrote archipy/helpers/interceptors/grpc/trace/client_interceptor.py to delegate tracing setup and metadata injection to TracingUtils, removing ~200 lines of inline logic.
  • gRPC Server Interceptor Refactor - Rewrote archipy/helpers/interceptors/grpc/trace/server_interceptor.py to use TracingUtils.extract_inbound_trace and TracingUtils.grpc_status_indicates_success for consistent span outcome reporting.
  • Tracing Decorator Refactor - Updated archipy/helpers/decorators/tracing.py to call TracingUtils.init_tracing_if_needed instead of duplicating Sentry and Elastic APM bootstrap logic inline.

Helpers - App Utils

  • Sentry Initialisation Delegated - AppUtils.init_sentry is now a no-op placeholder; Sentry initialisation is performed exclusively via TracingUtils inside create_fastapi_app, preventing double-initialisation.
  • Elastic APM Client Reuse - AppUtils.init_elastic_apm now calls elasticapm.get_client() first and only creates a new client when none exists, avoiding duplicate APM client instances.

Environment

  • .env.example Extended - Documented the ten new SENTRY_* environment variables introduced by the expanded SentryConfig.

Tests

Tests - Error Handling

  • Consolidated Error Handling Feature - Merged four separate BDD feature files (custom_errors.feature, error_utils.feature, fastapi_error_handling.feature, grpc_error_handling.feature) into a single error_handling.feature for easier maintenance and execution.
    • Removed features/custom_errors.feature, features/error_utils.feature, features/fastapi_error_handling.feature, and features/grpc_error_handling.feature
    • Removed matching step modules steps/custom_errors_steps.py, steps/error_utils_steps.py, steps/fastapi_error_handling_steps.py, and steps/grpc_error_handling_steps.py
    • Created unified features/error_handling.feature with all 238 scenario lines
    • Created unified features/steps/error_handling_steps.py consolidating all step definitions
  • Tagged Scenarios - Added descriptive tags to error handling scenarios for selective test execution.

Chore

  • Elasticsearch Test Image - Updated the Elasticsearch container image version in .env.test to align with CI test dependencies.