मुख्य सामग्री पर जाएँ
Skillpedia
डिप्लॉय और क्लाउड (DevOps)10k · #12032

error-tracking

यह क्या करती है

यह स्किल कोड में Sentry, एक ऑनलाइन त्रुटि ट्रैकिंग सेवा, सेट करती है, ताकि त्रुटियाँ समीक्षा के लिए वहाँ भेजी जाएँ। यह उन डेवलपरों के लिए है जो वेब सेवाएँ चलाते हैं और विफलताएँ व धीमी कॉल देखना चाहते हैं।

कब इस्तेमाल करें

  • ✓जब आप किसी सेवा में त्रुटि संभालना जोड़ते हैं या नया controller बनाते हैं।
  • ✓जब आप ऐसा निर्धारित job सेट करते हैं जिसकी विफलताएँ रिपोर्ट होनी चाहिए।
  • ✓जब आप धीमी database कॉल ट्रैक करना या प्रदर्शन spans जोड़ना चाहते हैं।

Skill का लिंक

https://github.com/diet103/claude-code-infrastructure-showcase/blob/main/.agents/skills/error-tracking/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/diet103/claude-code-infrastructure-showcase/blob/main/.agents/skills/error-tracking/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरे नए controller में Sentry त्रुटि ट्रैकिंग जोड़िए, ताकि हर त्रुटि Sentry पर भेजी जाए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

स्किल त्रुटियाँ और प्रदर्शन डेटा Sentry पर भेजने के मानक पैटर्न दिखाती है। वह AI को याद दिलाती है कि हर त्रुटि सिर्फ़ लॉग न हो, बल्कि रिपोर्ट हो, और controllers, routes व background jobs को कवर करती है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Sentry Integration Skill

Purpose

This skill enforces comprehensive Sentry error tracking and performance monitoring across all services following Sentry v8 patterns.

When to Use This Skill

  • Adding error handling to any code
  • Creating new controllers or routes
  • Instrumenting cron jobs
  • Tracking database performance
  • Adding performance spans
  • Handling workflow errors

🚨 CRITICAL RULE

ALL ERRORS MUST BE CAPTURED TO SENTRY - No exceptions. Never use console.error alone.

Current Status

Example: API Service ✅ Complete

  • Sentry v8 fully integrated
  • All workflow errors tracked
  • Background job processors instrumented
  • Test endpoints available

Sentry Integration Patterns

1. Controller Error Handling

// ✅ CORRECT - Use BaseController
import { BaseController } from '../controllers/BaseController';

export class MyController extends BaseController {
    async myMethod() {
        try {
            // ... your code
        } catch (error) {
            this.handleError(error, 'myMethod'); // Automatically sends to Sentry
        }
    }
}

2. Route Error Handling (Without BaseController)

import * as Sentry from '@sentry/node';

router.get('/route', async (req, res) => {
    try {
        // ... your code
    } catch (error) {
        Sentry.captureException(error, {
            tags: { route: '/route', method: 'GET' },
            extra: { userId: req.user?.id }
        });
        res.status(500).json({ error: 'Internal server error' });
    }
});

3. Workflow Error Handling

Example of a domain-specific Sentry helper from the original production project. If you build a helper like this for your domain, the call site looks like:

import { WorkflowSentryHelper } from '../workflow/utils/sentryHelper';

WorkflowSentryHelper.captureWorkflowError(error, {
    workflowCode: 'INVOICE_APPROVAL',
    instanceId: 123,
    stepId: 456,
    userId: 'user-123',
    operation: 'stepCompletion',
    metadata: { additionalInfo: 'value' }
});

Without a helper, plain Sentry works everywhere:

Sentry.captureException(error, {
    tags: { operation: 'stepCompletion' },
    extra: { workflowCode: 'INVOICE_APPROVAL', instanceId: 123, userId: 'user-123' }
});

4. Cron Jobs (MANDATORY Pattern)

#!/usr/bin/env node
// FIRST LINE after shebang - CRITICAL!
import '../instrument';
import * as Sentry from '@sentry/node';

async function main() {
    return await Sentry.startSpan({
        name: 'cron.job-name',
        op: 'cron',
        attributes: {
            'cron.job': 'job-name',
            'cron.startTime': new Date().toISOString(),
        }
    }, async () => {
        try {
            // Your cron job logic
        } catch (error) {
            Sentry.captureException(error, {
                tags: {
                    'cron.job': 'job-name',
                    'error.type': 'execution_error'
                }
            });
            console.error('[Job] Error:', error);
            process.exit(1);
        }
    });
}

main()
    .then(() => {
        console.log('[Job] Completed successfully');
        process.exit(0);
    })
    .catch((error) => {
        console.error('[Job] Fatal error:', error);
        process.exit(1);
    });

5. Database Performance Monitoring

Example from the original production project - a small helper that wraps DB calls in Sentry spans. Adapt to your codebase:

import { DatabasePerformanceMonitor } from '../utils/databasePerformance';

const result = await DatabasePerformanceMonitor.withPerformanceTracking(
    'findMany',
    'UserProfile',
    async () => {
        return await PrismaService.main.userProfile.findMany({
            take: 5,
        });
    }
);

The universally-available equivalent is a direct Sentry span:

const result = await Sentry.startSpan({
    name: 'db.userProfile.findMany',
    op: 'db.query',
    attributes: { 'db.model': 'UserProfile', 'db.operation': 'findMany' }
}, async () => {
    return await prisma.userProfile.findMany({ take: 5 });
});

6. Async Operations with Spans

import * as Sentry from '@sentry/node';

const result = await Sentry.startSpan({
    name: 'operation.name',
    op: 'operation.type',
    attributes: {
        'custom.attribute': 'value'
    }
}, async () => {
    // Your async operation
    return await someAsyncOperation();
});

Error Levels

अक्सर पूछे जाने वाले सवाल

Sentry क्या है?

Sentry एक ऑनलाइन सेवा है जो सॉफ़्टवेयर की त्रुटियाँ इकट्ठा करके डेवलपरों को दिखाती है।

क्या यह त्रुटियाँ सिर्फ़ console में लॉग करती है?

नहीं। स्किल कहती है कि त्रुटियाँ Sentry पर भेजी जानी चाहिए, सिर्फ़ console में लिखी नहीं।

क्या यह background jobs कवर करती है?

हाँ। इसमें निर्धारित jobs और background processors के लिए मार्गदर्शन है।

जानकारी

लेखक का मूल विवरण

Add Sentry v8 error tracking and performance monitoring to your services. Use this skill when adding error handling, creating new controllers, instrumenting cron jobs, or tracking database performance. ALL ERRORS MUST BE CAPTURED TO SENTRY - no exceptions.

repo: diet103/claude-code-infrastructure-showcase

लोकप्रियता

GitHub स्टार
10k
रैंकिंग में स्थान
#12032
लाइसेंस
MIT
अपडेट की गई
13/7/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

मिलती-जुलती skills