Skip to content

Add Bugsnag instrumentation module#230

Open
morgan-wowk wants to merge 1 commit intographite-base/230from
bugsnag/instrumentation-module
Open

Add Bugsnag instrumentation module#230
morgan-wowk wants to merge 1 commit intographite-base/230from
bugsnag/instrumentation-module

Conversation

@morgan-wowk
Copy link
Copy Markdown
Collaborator

@morgan-wowk morgan-wowk commented May 8, 2026

TL;DR

Adds a Bugsnag error reporting integration that is a no-op when the required environment variables are not set.

What changed?

A new bugsnag instrumentation module was introduced with three entry points:

  • setup(service_name) — configures the Bugsnag client using environment variables (TANGLE_BUGSNAG_API_KEY, TANGLE_ENV, TANGLE_SERVICE_VERSION, TANGLE_BUGSNAG_NOTIFY_ENDPOINT, TANGLE_BUGSNAG_SESSIONS_ENDPOINT).
  • notify(exception, **metadata) — reports an exception to Bugsnag with optional extra metadata attached.
  • _before_notify(event) — a Bugsnag callback that automatically attaches contextual logging metadata (e.g. request_id, user_id) to every reported event under a tangle_context tab.

Both setup and notify are no-ops when TANGLE_BUGSNAG_API_KEY or TANGLE_ENV are missing. Failures within setup and notify are caught and logged rather than propagated.

How to test?

  • Set TANGLE_BUGSNAG_API_KEY and TANGLE_ENV in your environment and call setup() followed by notify() with a test exception to verify events appear in Bugsnag.
  • Run the unit tests: pytest tests/instrumentation/test_bugsnag.py

Why make this change?

To provide structured, centralized error reporting to Bugsnag across backend services, with automatic enrichment from contextual logging metadata and safe fallback behaviour when Bugsnag is not configured.

Copy link
Copy Markdown
Collaborator Author

morgan-wowk commented May 8, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@morgan-wowk morgan-wowk marked this pull request as ready for review May 8, 2026 20:40
@morgan-wowk morgan-wowk force-pushed the bugsnag/add-dependency branch from adc82a2 to d7bdc24 Compare May 8, 2026 21:05
@morgan-wowk morgan-wowk force-pushed the bugsnag/instrumentation-module branch from cf06f0c to 248ce56 Compare May 8, 2026 21:05
@morgan-wowk morgan-wowk force-pushed the bugsnag/add-dependency branch from d7bdc24 to c504f6a Compare May 8, 2026 22:38
@morgan-wowk morgan-wowk force-pushed the bugsnag/instrumentation-module branch 4 times, most recently from 4a6f0bc to 7a7696e Compare May 8, 2026 23:25
@morgan-wowk morgan-wowk changed the base branch from bugsnag/add-dependency to graphite-base/230 May 8, 2026 23:27
@morgan-wowk morgan-wowk force-pushed the bugsnag/instrumentation-module branch from 7a7696e to 6842b69 Compare May 8, 2026 23:32
@morgan-wowk morgan-wowk changed the base branch from graphite-base/230 to bugsnag/add-dependency May 8, 2026 23:32
@morgan-wowk morgan-wowk force-pushed the bugsnag/instrumentation-module branch from 6842b69 to 936d216 Compare May 8, 2026 23:38
@morgan-wowk morgan-wowk force-pushed the bugsnag/add-dependency branch from c504f6a to 2cba7e9 Compare May 8, 2026 23:38
@morgan-wowk morgan-wowk force-pushed the bugsnag/instrumentation-module branch from 936d216 to 514d0f0 Compare May 8, 2026 23:40
@morgan-wowk morgan-wowk force-pushed the bugsnag/add-dependency branch from 2cba7e9 to 50ed65a Compare May 8, 2026 23:40
@morgan-wowk morgan-wowk force-pushed the bugsnag/instrumentation-module branch from 514d0f0 to 365eab5 Compare May 8, 2026 23:41
@morgan-wowk morgan-wowk force-pushed the bugsnag/add-dependency branch from 50ed65a to af2ab2d Compare May 8, 2026 23:41
@morgan-wowk morgan-wowk changed the base branch from bugsnag/add-dependency to graphite-base/230 May 9, 2026 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant