Skip to content
Back to skills

2314 High Volume Sampling Strategies 6005bba3

ASecurity

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

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
developmenttypescriptnodeapi

Works with

  • api

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 2314-high-volume-sampling-strategies_6005bba3 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2314 High Volume Sampling Strategies 6005bba3?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2314 High Volume Sampling Strategies 6005bba3
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2314-high-volume-sampling-strategies-6005bba3/badge)](https://www.skillsdirectory.com/skills/tools-only-2314-high-volume-sampling-strategies-6005bba3)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
# High-Volume Sampling Strategies

## High-Volume Sampling Strategies

### Adaptive Sampling
```typescript
import * as Sentry from '@sentry/node';

// Track recent error counts
const errorCounts = new Map<string, number>();
const WINDOW_MS = 60000; // 1 minute window

function getAdaptiveSampleRate(errorType: string): number {
  const count = errorCounts.get(errorType) || 0;

  // High volume = low sample rate
  if (count > 1000) return 0.001; // 0.1%
  if (count > 100) return 0.01;   // 1%
  if (count > 10) return 0.1;     // 10%
  return 1.0;                      // 100%
}

Sentry.init({
  dsn: process.env.SENTRY_DSN,

  beforeSend(event) {
    const errorType = event.exception?.values?.[0]?.type || 'unknown';

    // Update counter
    errorCounts.set(errorType, (errorCounts.get(errorType) || 0) + 1);

    // Sample based on frequency
    const sampleRate = getAdaptiveSampleRate(errorType);
    if (Math.random() > sampleRate) {
      return null; // Drop event
    }

    return event;
  },
});

// Reset counters periodically
setInterval(() => errorCounts.clear(), WINDOW_MS);
```

### Tiered Transaction Sampling
```typescript
Sentry.init({
  dsn: process.env.SENTRY_DSN,

  tracesSampler: (ctx) => {
    const name = ctx.transactionContext.name;

    // Critical paths: higher sampling
    if (name.includes('/checkout')) return 0.1;
    if (name.includes('/payment')) return 0.1;

    // High-volume endpoints: very low sampling
    if (name.includes('/api/events')) return 0.0001; // 0.01%
    if (name.includes('/health')) return 0;

    // Default: low sampling
    return 0.001; // 0.1%
  },
});
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.