Index of every page on this site: llms.txt
All skills
jeremylongshore avatar

/sentry-reliability-patterns

@0d57af8
Run it yourself

Build reliable Sentry integrations with graceful degradation, circuit breakers, and offline queuing. Use when implementing fault-tolerant error tracking, handling SDK initialization failures, building retry logic for Sentry transports, or ensuring apps survive Sentry outages. Trigger with "sentry reliability", "sentry circuit breaker", "sentry offline queue", "sentry graceful degradation", "sentry failover", or "resilient sentry setup".

Use this Skill: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/sentry-reliability-patterns

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesexamples.md

≈833 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Examples

TypeScript — Full Integration

Complete production entrypoint wiring all three reliability patterns together.

// app.ts — production entrypoint with all reliability patterns
import { initSentrySafe } from './lib/sentry-safe';
import { sentryBreaker } from './lib/sentry-circuit-breaker';
import { drainQueue } from './lib/sentry-offline-queue';
import { registerShutdownHandlers } from './lib/sentry-shutdown';
import { makeRetryTransport } from './lib/sentry-transport';
import express from 'express';

// 1. Initialize Sentry with resilient transport
initSentrySafe(process.env.SENTRY_DSN ?? '', {
  environment: process.env.NODE_ENV ?? 'production',
  release: process.env.RELEASE_SHA,
  tracesSampleRate: 0.2,
  transport: makeRetryTransport,
});

// 2. Drain any events queued from a previous crash or outage
drainQueue().then((count) => {
  if (count > 0) console.log(`Replayed ${count} offline events`);
}).catch(console.error);

// 3. Register shutdown handlers
const app = express();
const server = app.listen(3000);

registerShutdownHandlers(async () => {
  server.close();
  // Close DB connections, etc.
});

// 4. Use circuit breaker for all error capture
app.use((err: Error, req: express.Request, res: express.Response, _next: express.NextFunction) => {
  sentryBreaker.captureException(err, {
    url: req.originalUrl,
    method: req.method,
  });
  res.status(500).json({ error: 'Internal server error' });
});

Python — Full Integration

Complete Python application with all three patterns.

# main.py — production entrypoint
import os
from sentry_reliable import (
    init_sentry_safe,
    breaker,
    drain_queue,
)

# 1. Initialize with graceful degradation
init_sentry_safe(os.getenv("SENTRY_DSN", ""))

# 2. Drain offline queue from previous crash
drained = drain_queue()
if drained:
    print(f"Replayed {drained} offline events")

# 3. Use circuit breaker for all error capture
def handle_request(request):
    try:
        return process(request)
    except Exception as e:
        breaker.capture_exception(e, {"path": request.path})
        raise

Example: Verifying Circuit Breaker Behavior

// test/circuit-breaker.test.ts
import { sentryBreaker } from '../lib/sentry-circuit-breaker';

// Simulate 5 failures to trip the circuit open
for (let i = 0; i < 5; i++) {
  sentryBreaker.captureException(new Error(`Failure ${i + 1}`));
}

console.log(sentryBreaker.getStatus());
// { state: 'open', failures: 5, lastFailureAt: 1711100400000 }

// After cooldown period, circuit enters half-open and probes
// A successful probe resets to closed

Example: Request-Level Error Handling

import { captureError } from './lib/sentry-safe';

app.get('/api/data', async (req, res) => {
  try {
    const data = await fetchData(req.query.id);
    res.json(data);
  } catch (error) {
    // captureError handles fallback automatically
    const eventId = captureError(error as Error, {
      endpoint: '/api/data',
      query: req.query,
      userId: req.user?.id,
    });

    res.status(500).json({
      error: 'Internal server error',
      eventId, // undefined if Sentry was unavailable
    });
  }
});

Tons of Skills by Intent Solutions

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    This skill provides production-ready code patterns for building resilient Sentry integrations with features like circuit breakers and offline queuing. No security issues were detected.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 0d57af8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 3 months ago
What it can do
Reads files Edits files Runs commands
version
1.51.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
compatibility
Designed for Claude Code
All 7 allowed tools
ReadWriteEditGrepBash(node:*)Bash(pip:*)Bash(python*:*)
Other metadata
tags
[
  "saas",
  "sentry",
  "reliability",
  "resilience",
  "circuit-breaker",
  "offline-queue",
  "graceful-degradation"
]

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/sentry-reliability-patterns