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

/sentry-observability

@0d57af8
Run it yourself

Integrate Sentry with your observability stack — logging, metrics, APM, and dashboards. Use when connecting Sentry to winston/pino/structlog, correlating errors with business metrics, deciding between Sentry performance and Datadog/New Relic, building Sentry Discover dashboards, or linking events to external tools via extra context. Trigger: "sentry observability", "sentry logging", "sentry metrics", "sentry grafana", "sentry datadog correlation", "sentry discover dashboard".

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

Nothing lands on disk. Nothing to clean up.

Fork this Skill

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

referenceslogging-integration.md

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

Logging Integration Reference

Winston Transport Pattern

The recommended pattern wraps a custom Winston transport that both forwards errors to Sentry and stamps the Sentry event ID back into the log object:

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

class SentryTransport extends winston.Transport {
  log(info: any, callback: () => void) {
    setImmediate(callback);
    if (info.level === 'error' || info.level === 'fatal') {
      Sentry.withScope((scope) => {
        scope.setTag('logger', 'winston');
        scope.setContext('log_entry', {
          level: info.level,
          service: info.service,
        });
        const eventId = Sentry.captureException(
          info.error instanceof Error ? info.error : new Error(info.message)
        );
        info.sentry_event_id = eventId;
      });
    }
  }
}

Pino Hook Pattern

Pino uses the hooks.logMethod callback for interception. The hook fires before serialization, so injected fields appear in the final JSON output:

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

const logger = pino({
  hooks: {
    logMethod(inputArgs, method, level) {
      if (level >= 50) { // 50 = error, 60 = fatal
        const [obj, msg] = typeof inputArgs[0] === 'object'
          ? [inputArgs[0], inputArgs[1]]
          : [{}, inputArgs[0]];

        Sentry.withScope((scope) => {
          scope.setTag('logger', 'pino');
          const eventId = Sentry.captureException(
            obj.err instanceof Error ? obj.err : new Error(String(msg))
          );
          if (typeof inputArgs[0] === 'object') {
            inputArgs[0].sentry_event_id = eventId;
          }
        });
      }
      return method.apply(this, inputArgs);
    },
  },
});

structlog Processor (Python)

import structlog
import sentry_sdk

def sentry_processor(logger, method_name, event_dict):
    if method_name in ('error', 'critical', 'fatal'):
        exc_info = event_dict.get('exc_info')
        with sentry_sdk.push_scope() as scope:
            scope.set_tag('logger', 'structlog')
            scope.set_context('log_entry', {
                k: str(v) for k, v in event_dict.items()
                if k not in ('exc_info', 'event')
            })
            if exc_info and isinstance(exc_info, BaseException):
                event_id = sentry_sdk.capture_exception(exc_info)
            else:
                event_id = sentry_sdk.capture_message(
                    event_dict.get('event', ''), level=method_name
                )
            event_dict['sentry_event_id'] = event_id
    return event_dict

Request ID Correlation

Every request should carry a request ID through logs, Sentry tags, and response headers:

import { randomUUID } from 'crypto';
import * as Sentry from '@sentry/node';

app.use((req, res, next) => {
  const requestId = (req.headers['x-request-id'] as string) || randomUUID();
  res.setHeader('x-request-id', requestId);
  Sentry.setTag('request_id', requestId);
  req.log = logger.child({ requestId });
  next();
});

Tons of Skills by Intent Solutions | jeremylongshore.com

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

    The sentry-observability skill provides legitimate integration patterns for connecting Sentry with logging stacks, metrics engines, and APM tools. It follows security best practices for credential management using environment variables and links only to reputable services or verified author resources.

  • 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(npx:*)Bash(pip:*)
Other metadata
tags
[
  "saas",
  "sentry",
  "observability",
  "logging",
  "metrics",
  "apm",
  "grafana",
  "opentelemetry"
]

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/sentry-observability