Skip to content

Commit fa6e4c5

Browse files
authored
Merge pull request #1325 from trheyi/main
Enhance trace package functionality and improve concurrency handling
2 parents a8b6f64 + a7210f0 commit fa6e4c5

15 files changed

+3137
-113
lines changed

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ unit-test:
4646
benchmark:
4747
@echo ""
4848
@echo "============================================="
49-
@echo "Running Benchmark Tests (agent only)..."
49+
@echo "Running Benchmark Tests (agent & trace)..."
5050
@echo "============================================="
51-
@for d in $$($(GO) list ./agent/...); do \
51+
@for d in $$($(GO) list ./agent/... ./trace/...); do \
5252
if $(GO) test -list=Benchmark $$d 2>/dev/null | grep -q "^Benchmark"; then \
5353
echo ""; \
5454
echo "📊 Benchmarking: $$d"; \
@@ -66,14 +66,14 @@ benchmark:
6666
memory-leak:
6767
@echo ""
6868
@echo "============================================="
69-
@echo "Running Memory Leak Detection (agent only)..."
69+
@echo "Running Memory Leak Detection (agent & trace)..."
7070
@echo "============================================="
71-
@for d in $$($(GO) list ./agent/...); do \
72-
if $(GO) test -list='TestMemoryLeak|TestIsolateDisposal' $$d 2>/dev/null | grep -qE "^Test(MemoryLeak|IsolateDisposal)"; then \
71+
@for d in $$($(GO) list ./agent/... ./trace/...); do \
72+
if $(GO) test -list='TestMemoryLeak|TestIsolateDisposal|TestGoroutineLeak' $$d 2>/dev/null | grep -qE "^Test(MemoryLeak|IsolateDisposal|GoroutineLeak)"; then \
7373
echo ""; \
7474
echo "🔍 Memory Leak Detection: $$d"; \
7575
echo "---------------------------------------------"; \
76-
$(GO) test -run='TestMemoryLeak|TestIsolateDisposal' -v $$d || exit 1; \
76+
$(GO) test -run='TestMemoryLeak|TestIsolateDisposal|TestGoroutineLeak' -v -timeout=60s $$d || exit 1; \
7777
fi; \
7878
done
7979
@echo ""

trace/README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,17 +323,26 @@ Create a new trace or load existing one from storage.
323323

324324
**Drivers:**
325325

326-
- `trace.Local` - Local disk storage (default path: `./traces`)
327-
- `trace.Store` - Gou store backend
326+
- `trace.Local` - Local disk storage (default: uses log directory from config, fallback to `./traces`)
327+
- `trace.Store` - Gou store backend (default store: `__yao.store`, default prefix: `__trace`)
328328

329329
**Example:**
330330

331331
```go
332+
// Local with default path (uses log directory from config)
333+
traceID, manager, _ := trace.New(ctx, trace.Local, nil)
334+
332335
// Local with custom path
333336
traceID, manager, _ := trace.New(ctx, trace.Local, nil, "/data/traces")
334337

335-
// Store with custom name
336-
traceID, manager, _ := trace.New(ctx, trace.Store, nil, "my_traces")
338+
// Store with default settings (uses __yao.store with __trace prefix)
339+
traceID, manager, _ := trace.New(ctx, trace.Store, nil)
340+
341+
// Store with custom store name
342+
traceID, manager, _ := trace.New(ctx, trace.Store, nil, "my_store")
343+
344+
// Store with custom store name and prefix
345+
traceID, manager, _ := trace.New(ctx, trace.Store, nil, "my_store", "my_prefix")
337346

338347
// With trace options
339348
option := &types.TraceOption{

0 commit comments

Comments
 (0)