C.W.K.
Stream
Lesson 01 of 06 · published

밤에 도는 파이프라인 모니터링

~12 min · monitoring, production, alerting

Level 0구경꾼
0 XP0/47 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

첫 규칙: 내부 아니라 결과에 알림

나쁜 모니터링은 CPU spike 에 on-call 호출. 좋은 모니터링은 데이터가 틀리거나 늦었을 때 on-call 호출. 둘은 매우 달라. CPU 는 내부 증상이고 freshness + correctness 가 consumer 가 진짜 신경 쓰는 SLA.

모든 파이프라인이 emit 해야 하는 4가지 신호

  • Freshness. 이 테이블 마지막 업데이트 언제? SLA ("매일 오전 9시") 와 비교. 임계 이상 오래되면 알림.
  • Volume. 이번 run 에 row 몇 개 land 했어? 후행 7일 band (예: ±3σ) 밖이면 알림.
  • Schema. Column 모양 바뀌었어? 검증 실패는 page; soft drift 는 warn.
  • 분포. 값 shift 했어? Mean / median / null-rate / cardinality 를 지난주와 비교.

Escalation ladder

모든 신호가 page 아니야. 알림 튜닝:

  • Page 깨진 contract 에: schema 변경, SLA 지난 데이터 missing, 검증 hard-fail.
  • Slack 경고 신호에: row count band 밖, 분포 drift.
  • 대시보드 모든 거에: 모든 run 의 metric, 시간 plot.

Code

단순한 freshness/volume 모니터 — 모든 파이프라인 후 실행·python
import pandas as pd
from datetime import datetime, timedelta

def check_table_health(table_path: str, sla_hours: int = 24, volume_band: tuple = (0.7, 1.3)) -> list[str]:
    '''사람 읽을 수 있는 문제 list 반환. 빈 list = 건강.'''
    df = pd.read_parquet(table_path)
    issues = []

    # Freshness — max(ingested_at) column 가정
    last_update = df['ingested_at'].max()
    age = datetime.utcnow() - pd.Timestamp(last_update).to_pydatetime()
    if age > timedelta(hours=sla_hours):
        issues.append(f'stale: 마지막 업데이트 {last_update} ({age.total_seconds() / 3600:.1f}h 전)')

    # Volume — 오늘과 어제 비교
    today = df.loc[df['ingested_at'].dt.date == datetime.utcnow().date()]
    yesterday = df.loc[df['ingested_at'].dt.date == (datetime.utcnow() - timedelta(days=1)).date()]
    if len(yesterday) > 0:
        ratio = len(today) / len(yesterday)
        if ratio < volume_band[0] or ratio > volume_band[1]:
            issues.append(f'volume band 밖: 오늘/어제 = {ratio:.2f}')

    return issues

External links

Exercise

본인 테이블 하나에 대해 4가지 신호 (freshness, volume, schema, 분포) 마다 적어: (a) SLA, (b) metric emit 할 곳, (c) 알림 임계, (d) page 또는 Slack. 대부분 팀이 이 연습 안 했어 — production-grade 모니터링 진짜 시작하는 곳.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.