docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,164 @@
|
||||
---
|
||||
id: wiki-2026-0508-스택-트레이스-stack-trace
|
||||
title: 스택 트레이스 (Stack Trace)
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Stack Trace, Call Stack, Backtrace, 콜스택]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [debugging, observability, error-handling, runtime]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: Python/Go/JS
|
||||
framework: Sentry/OpenTelemetry
|
||||
---
|
||||
|
||||
# 스택 트레이스 (Stack Trace)
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 error 의 발생 시점 의 call chain 의 snapshot."**. 매 runtime 의 active frame 의 list — function name · file · line · 매 local variable (optional). 2026 modern observability 는 매 stack trace 의 distributed trace · source map · symbolication · 매 LLM-assisted root cause 의 통합.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 구성 요소
|
||||
- **Frame**: 매 each function call 의 record (caller info).
|
||||
- **Top of stack**: 매 error 의 throw 한 가장 안쪽 frame.
|
||||
- **Bottom**: 매 program entry (main, event loop).
|
||||
- **Symbolication**: 매 minified/compiled binary 의 readable name 의 resolve.
|
||||
|
||||
### 매 종류
|
||||
- **Native**: 매 Go panic, C++ SIGSEGV — debug symbols 의 필요.
|
||||
- **Managed**: JVM, .NET, Python — runtime 의 자동 capture.
|
||||
- **Async**: 매 promise/coroutine — 매 await chain 의 reconstruct (Python 3.11+ exception groups, V8 async stack).
|
||||
- **Distributed**: 매 trace_id + span 의 across-service stack.
|
||||
|
||||
### 매 응용
|
||||
1. 매 production error 의 root cause 의 빠르게 locate.
|
||||
2. 매 performance profiling — 매 sample-based stack 의 hot path 의 reveal.
|
||||
3. 매 security forensics — 매 exploit 의 entry point 의 identify.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Python — full traceback with locals
|
||||
```python
|
||||
import traceback, sys
|
||||
|
||||
try:
|
||||
risky_op()
|
||||
except Exception:
|
||||
tb = traceback.TracebackException.from_exception(
|
||||
sys.exc_info()[1], capture_locals=True
|
||||
)
|
||||
print("".join(tb.format()))
|
||||
```
|
||||
|
||||
### Go — runtime stack
|
||||
```go
|
||||
import "runtime/debug"
|
||||
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
log.Printf("panic: %v\n%s", r, debug.Stack())
|
||||
}
|
||||
}()
|
||||
```
|
||||
|
||||
### Node.js — async stack 의 enable
|
||||
```js
|
||||
// Node 22+ 매 default
|
||||
Error.stackTraceLimit = 50;
|
||||
process.on("unhandledRejection", (reason) => {
|
||||
console.error(reason instanceof Error ? reason.stack : reason);
|
||||
});
|
||||
```
|
||||
|
||||
### Source map symbolication (browser)
|
||||
```js
|
||||
import { SourceMapConsumer } from "source-map";
|
||||
const raw = await fetch("app.js.map").then(r => r.json());
|
||||
await SourceMapConsumer.with(raw, null, consumer => {
|
||||
const orig = consumer.originalPositionFor({ line: 42, column: 13 });
|
||||
console.log(orig); // { source: "src/app.tsx", line: 117, name: "handleClick" }
|
||||
});
|
||||
```
|
||||
|
||||
### Sentry SDK with breadcrumbs
|
||||
```python
|
||||
import sentry_sdk
|
||||
sentry_sdk.init(dsn="https://...", traces_sample_rate=0.1)
|
||||
|
||||
sentry_sdk.add_breadcrumb(category="auth", message="user login", level="info")
|
||||
# 매 exception 의 자동 capture + breadcrumb chain
|
||||
```
|
||||
|
||||
### OpenTelemetry — stack 의 distributed trace 의 attach
|
||||
```python
|
||||
from opentelemetry import trace
|
||||
span = trace.get_current_span()
|
||||
span.record_exception(exc, attributes={"stack": traceback.format_exc()})
|
||||
```
|
||||
|
||||
### Java — Throwable.getStackTrace
|
||||
```java
|
||||
try { ... } catch (Exception e) {
|
||||
for (StackTraceElement el : e.getStackTrace()) {
|
||||
log.error("{}.{} ({}:{})",
|
||||
el.getClassName(), el.getMethodName(),
|
||||
el.getFileName(), el.getLineNumber());
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### LLM-assisted analysis (Claude Opus 4.7)
|
||||
```python
|
||||
prompt = f"""Stack trace:
|
||||
{stack}
|
||||
|
||||
Recent commits:
|
||||
{git_log}
|
||||
|
||||
매 root cause + 매 fix candidate 의 propose."""
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Production unhandled error | Sentry/Datadog 매 자동 capture |
|
||||
| Local dev | Native debugger (gdb, dlv, pdb) |
|
||||
| Async/promise chain | Runtime async stack 의 enable |
|
||||
| Minified prod JS | Source map upload + symbolication |
|
||||
| Distributed call | OTel trace + span exception |
|
||||
|
||||
**기본값**: 매 OTel + Sentry 의 combine — 매 single trace 에서 매 service-crossing stack 의 see.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Debugging]] · [[Observability]]
|
||||
- 변형: [[Distributed Tracing]]
|
||||
- 응용: [[Profiling]]
|
||||
- Adjacent: [[Source_Maps]] · [[Logging]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 long stack trace 의 summarize, 매 framework noise 의 filter, 매 likely culprit frame 의 highlight.
|
||||
**언제 X**: 매 sensitive PII 의 local variable 의 포함 — sanitize first.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Swallow exception**: `except: pass` — 매 stack 의 lose.
|
||||
- **Re-raise wrong**: 매 `raise e` (Python) 매 traceback 의 truncate — `raise` bare 의 use.
|
||||
- **No source map**: 매 prod minified — stack 의 unreadable.
|
||||
- **Stack 의 user 의 expose**: 매 5xx response 에 raw stack 의 dump — info leak.
|
||||
- **Limit too low**: `Error.stackTraceLimit = 10` 매 root frame 의 cut off.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Python docs traceback module, V8 async stack RFC, Sentry symbolication guide 2026).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — async stacks, symbolication, OTel integration |
|
||||
Reference in New Issue
Block a user