본문 바로가기
2026년 5월 24일1분 읽기

Sentry 25에서 OTel migration 후 비용이 3배 — error 이벤트는 그대로인데

김
김영삼
조회 586댓글 3

Sentry 25에서 추천하는 OTel 기반 instrumentation으로 옮겼습니다. 에러 이벤트 수는 그대로인데 청구서가 $620 → $1,840으로 3배 됐습니다.

Sentry 대시보드 보면:

  • Errors: 12,400/일 (변화 없음)
  • Transactions: 1.2M/일 (그대로)
  • Spans: 14M/일 → 92M/일 (6.5배 증가)

OTel auto-instrumentation이 spans를 너무 많이 생성하는 것 같습니다. 정상 패턴인지, sampling을 어떻게 조절해야 하는지 알고 싶습니다.

저희 스택: Node 22, Express, MongoDB, Redis, Kafka, gRPC

댓글 3

김김영삼6개월 전

OTel auto-instrumentation의 가장 흔한 함정입니다. 저희도 똑같이 비용 폭증 겪었어요.


원인 — 모든 layer가 span을 만든다


OTel auto-instrumentation은 HTTP, DB, Redis, gRPC 등 모든 라이브러리에서 span 자동 생성. Express middleware마다 span, Mongo driver의 내부 retry까지 span. 결과적으로 1 HTTP 요청 = 80~120 span. 기존 Sentry SDK는 30~50 span 정도였습니다.


해결 1 — instrumentation 선별


auto-instrumentation 다 켜기 대신 필요한 것만:


import { NodeSDK } from '@opentelemetry/sdk-node'
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http'
import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express'
import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb'

const sdk = new NodeSDK({
instrumentations: [
new HttpInstrumentation({ ignoreIncomingRequestHook: (req) => req.url?.startsWith('/health') }),
new ExpressInstrumentation(),
new MongoDBInstrumentation({ enhancedDatabaseReporting: false }),
// Redis, gRPC, Kafka 자동 instrumentation 제외 → 필요한 곳만 manual span
],
})

이것만 해도 보통 -40~50%.


해결 2 — Sentry tracesSampleRate 조정


OTel은 모든 span을 sampling하지 않으므로 Sentry SDK에서 sample rate 별도 설정:


Sentry.init({
tracesSampleRate: 0.05, // 5%만 Sentry로 전송
// 에러는 100% 유지
beforeSendTransaction(event) {
if (event.transaction === 'GET /health') return null
return event
},
})

해결 3 — Tail-based sampling


OTel collector를 중간에 두고 tail-based sampling 적용. 정상 trace는 5%, 에러나 느린 trace(p99 초과)만 100%:


processors:
tail_sampling:
decision_wait: 10s
policies:
- name: errors
type: status_code
status_code: { status_codes: [ERROR] }
- name: slow
type: latency
latency: { threshold_ms: 1000 }
- name: 5_percent
type: probabilistic
probabilistic: { sampling_percentage: 5 }

이거 도입 후 저희는 $1,800 → $480로 떨어졌습니다.


해결 4 — span attribute cardinality 제한


span attribute에 user_id, request_id 같은 high-cardinality 값을 넣으면 Sentry가 별도 시리즈로 인식해서 비용 추가. 이런 값은 tag가 아닌 description으로 옮기세요.


1~4 적용 순서로 단계별 측정 권장합니다.

oobserver(guest)6개월 전
저희는 Sentry는 에러용으로만 남기고 trace는 Honeycomb로 옮겼습니다. Sentry는 trace 비용이 비싸요. trace 분석은 Honeycomb의 BubbleUp 같은 도구가 압도적이고, 같은 트래픽 비용 1/4입니다.
풀풀스택지훈6개월 전

OTel collector를 self-hosted로 두면 sampling 외에도 redaction(PII 제거)도 같이 처리 가능합니다. SDK 단계가 아닌 collector 단계에서 일괄 처리하면 코드 변경 없이 운영 가능.

Ctrl+Enter로 등록