Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,18 @@ VITE_API_TARGET=http://localhost:18080 npm run dev

ํ˜„์žฌ ์ง€์› ๋ฒ”์œ„๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

- Java ๊ธฐ๋ฐ˜ Spring Boot์™€ ๋กœ์ปฌ ๋‹จ์ผ JVM ๋˜๋Š” 2๊ฐœ ์„œ๋น„์Šค ๋ฐ๋ชจ
- Java ๊ธฐ๋ฐ˜ Spring Boot ๋‹จ์ผ ํ”„๋กœ์ ํŠธ์™€ ์ตœ๋Œ€ 10๊ฐœ ํ”„๋กœ์ ํŠธ์˜ ๋กœ์ปฌ Workspace ๋ถ„์„
- ๋‹จ์ผ JVM Trace์™€ ๋™๊ธฐ HTTP๋กœ ์—ฐ๊ฒฐ๋œ 2๊ฐœ Spring Boot JVM ๋ถ„์‚ฐ Trace ๋ฐ๋ชจ
- ์„œ๋น„์Šค๋ณ„ Agent profileยท์‹คํ–‰ ๋ช…๋ น๊ณผ ์‹ค์ œ `service.name` ๊ธฐ๋ฐ˜ Waterfallยท๊ทธ๋ž˜ํ”„ ๊ฒฝ๊ณ„
- Spring MVC, JDBC, Lettuce ๋“ฑ Java Agent๊ฐ€ ์ง€์›ํ•˜๋Š” ์ž๋™ ๊ณ„์ธก
- Gradle, Maven, ์‹คํ–‰ JAR์šฉ Agent ๋ช…๋ น ์ƒ์„ฑ
- ๋ฉ”๋ชจ๋ฆฌ ๊ธฐ๋ฐ˜ Trace ์ €์žฅ๊ณผ 15์ดˆ ์ˆ˜์ง‘ timeout

ํ˜„์žฌ ์ œ์™ธ ๋ฒ”์œ„:

- Kotlin๊ณผ ํ•ฉ์„ฑ annotation์˜ ์ถ”์ธก ๋ถ„์„
- ๋ฉ”์‹œ์ง€ ํ์™€ ๋น„๋™๊ธฐ consumer๋ฅผ ํฌํ•จํ•œ ๋ถ„์‚ฐ Trace
- KafkaยทRabbitMQ ๊ฐ™์€ ๋ฉ”์‹œ์ง€ ํ์™€ ๋น„๋™๊ธฐ consumer Trace
- ์„ธ ๊ฐœ ์ด์ƒ ์„œ๋น„์Šค์˜ ๊ณต๊ฐœ ๋ฐ๋ชจ์™€ production ๊ทœ๋ชจ ๋ถ„์‚ฐ Trace ์šด์˜
- ์‹คํ–‰ ์ค‘ JVM ๋™์  attach
- ์ธ์ฆ, ์˜๊ตฌ ์ €์žฅ, sampling ๊ด€๋ฆฌ
- production APM ์šด์˜๊ณผ AI ์›์ธ ๋ถ„์„
Expand All @@ -192,10 +195,12 @@ cd backend && ./gradlew test --rerun-tasks
cd ../examples/distributed-trace-lab/order-service && ./gradlew test
cd ../product-service && ./gradlew test
cd ../../../frontend && npm run test && npm run lint && npm run build
cd .. && docker compose up --build --wait
cd frontend && npx playwright install chromium && npm run test:e2e
cd .. && docker compose config && ./scripts/verify-demo.sh
```

GitHub Actions๋Š” backend, Trace Lab, frontend, ์‹ค์ œ Docker Compose E2E๋ฅผ PR๋งˆ๋‹ค ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
GitHub Actions๋Š” backend, ๋‘ Trace Lab, frontend ๋‹จ์œ„ ๊ฒ€์‚ฌ, ์‹ค์ œ Chromium UI E2E์™€ Docker API ์‹œ๋‚˜๋ฆฌ์˜ค๋ฅผ PR๋งˆ๋‹ค ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. ๋ธŒ๋ผ์šฐ์ € E2E๋Š” ์ •์ƒ Orderโ†’Product ํ˜ธ์ถœ๊ณผ Product PostgreSQL timeout ์ „ํŒŒ๋ฅผ ๊ฒ€์ฆํ•˜๊ณ , `verify-demo.sh`๋Š” cacheยทRedis ์žฅ์• ๋ฅผ ํฌํ•จํ•œ 6๊ฐœ ์‹œ๋‚˜๋ฆฌ์˜ค๋ฅผ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค.

๋น„๋ฐ๋ชจ Spring Boot 3.4.1 ํ”„๋กœ์ ํŠธ์—์„œ๋„ Java 224๊ฐœ, Controller 15๊ฐœ, REST endpoint 42๊ฐœ๋ฅผ ๋ถ„์„ํ•˜๊ณ  `Controller โ†’ Redis PING` ์‹ค์ œ Trace๋ฅผ ์ˆ˜์ง‘ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๊ทผ๊ฑฐ๋Š” [v0.1.1 ์™ธ๋ถ€ ํ”„๋กœ์ ํŠธ ๊ฒ€์ฆ](docs/v0.1.1-external-project-validation.md)์— ๊ธฐ๋กํ–ˆ์Šต๋‹ˆ๋‹ค.

Expand Down
11 changes: 10 additions & 1 deletion docs/external-runtime-tracing-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,17 @@ Sample traces retain the fixed StackFlow component graph. OpenTelemetry traces u
## Current Limits

- Workspace analysis and Agent profile generation support up to ten local Spring Boot projects; the bundled demo runs Order and Product as two local JVMs.
- The validated distributed path is synchronous HTTP propagation from Order to Product. The collector can merge all participating `service.name` values, but three-or-more-service operation is not a published demo guarantee yet.
- JVM restart is required; dynamic attach is not supported.
- Cross-service spans are collected, but service-grouped Waterfall and graph presentation is not implemented yet.
- Waterfall rows display the emitting service and explicit parent-child service boundaries. The graph groups span nodes by service and labels cross-service edges from runtime context only.
- Message brokers and asynchronous consumers are not covered by the current HTTP response plus two-second quiet-period completion rule.
- No OTLP Logs ingestion. Exception details are collected only from exception events attached to OTLP spans.
- No authentication, durable storage, sampling administration, or production retention.
- Libraries outside Java Agent support may produce partial traces.

## Automated Acceptance

The Docker Compose job validates both contracts against real Java Agent spans:

- Playwright drives the UI through a normal Order-to-Product request and a Product PostgreSQL timeout propagated as Order HTTP 504. It checks workspace selection, service boundaries, graph grouping, failure cause, Inspector detail, and mobile horizontal overflow.
- `scripts/verify-demo.sh` validates cache miss, cache hit, Redis fallback, direct PostgreSQL timeout, distributed success, and distributed timeout through the backend APIs.
63 changes: 22 additions & 41 deletions docs/product-direction-and-implementation-plan.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# StackFlow Product Direction and Implementation Plan

Date: 2026-07-29
Status: Draft
Branch context: `feat/9-external-api-target-base-url`
Date: 2026-08-28
Status: Active

## Purpose

Expand Down Expand Up @@ -33,46 +32,26 @@ The initial target should not be:

- Production incident response.
- Full APM replacement.
- Distributed tracing across microservices.
- Production-scale trace ingestion across arbitrary services.
- Security-sensitive production monitoring.

## Current State

The repository already has the first runtime trace slice:
The repository now provides an end-to-end local tracing workbench:

- Spring Boot backend.
- React + Vite frontend.
- Sample product APIs.
- SSE-based live trace streaming.
- Request flow graph.
- Node detail panel.
- Response body panel.
- Recent trace history.

The repository also has early static project analysis:

- Analyze a Spring Boot project path.
- Detect REST controllers.
- Extract API mappings.
- Group APIs into domains.
- Summarize layers such as Controller, Service, Repository, Cache, Store, DTO, and Domain.

The repository is adding external target execution:

- Configure a target base URL for an analyzed Spring Boot project.
- Call the selected external endpoint through the StackFlow backend proxy.
- Compose query parameters, headers, and JSON request body for external endpoint execution.
- Show HTTP status, duration, content type, response body, and transport error message.
- Show the request summary next to the response so users can compare what was sent and what came back.
- Keep external execution results separate from runtime trace evidence.
- Preview a browser-selected local folder, while keeping explicit project path input for backend analysis because browser mode cannot reliably expose the absolute local path.
- Analyze one Spring Boot project or a workspace containing up to ten independent Gradle or Maven services.
- Detect controllers, mappings, domains, layers, infrastructure evidence, and analysis coverage warnings.
- Generate service-specific OpenTelemetry Java Agent profiles without changing target source or build files.
- Execute selected APIs through the backend proxy with a StackFlow-owned W3C `traceparent`.
- Receive OTLP HTTP/protobuf spans and render Waterfall, graph, events, failure propagation, exception detail, and response preview.
- Correlate synchronous HTTP spans across the bundled Order and Product JVMs by actual `spanId`, `parentSpanId`, and `service.name`.
- Verify the representative distributed UI flows with Playwright and the six infrastructure scenarios with Docker Compose.

Current limitation:

- External project analysis and StackFlow sample runtime tracing are still separate concepts.
- Selecting an analyzed external API does not automatically mean StackFlow can trace that external app internally.
- Without instrumentation inside the external app, StackFlow can only show structure and estimated flow.
- External API execution confirms the endpoint response, but it still cannot prove the internal Controller -> Service -> Repository path.
- Runtime tracing still requires restarting each target JVM with the generated Agent command.
- The validated distributed demo is two local Spring Boot JVMs connected by synchronous HTTP.
- Message brokers, asynchronous consumers, authentication, durable storage, and production retention are not supported.

## Product Information Architecture

Expand Down Expand Up @@ -266,7 +245,7 @@ Reason:
Scope:

- Turn static analysis into an instrumentation profile for a local external Spring Boot application.
- Trace one Spring Boot JVM with the OpenTelemetry Java Agent and OTLP HTTP/protobuf.
- Trace one JVM or a local workspace of synchronously connected Spring Boot JVMs with the OpenTelemetry Java Agent and OTLP HTTP/protobuf.
- Keep the target project's source and Gradle/Maven files unchanged.

Implementation:
Expand All @@ -276,6 +255,8 @@ Implementation:
- Receive standard OTLP traces through `POST /v1/traces`.
- Inject a StackFlow-owned W3C `traceparent` when `POST /api/external/request` runs with trace capture enabled.
- Join received spans by trace ID and build the actual graph from `spanId -> parentSpanId`.
- Analyze workspace services separately, generate one Agent profile per service, and preserve entry and participating service names.
- Complete distributed collection after the entry SERVER span, HTTP response, and a two-second quiet period, with a 15-second hard timeout.
- Keep sample traces on the existing fixed graph and use a dynamic graph only for `source=OPENTELEMETRY`.
- Distinguish HTTP execution failure from `TRACE_COLLECTION_TIMEOUT` when no spans arrive for 15 seconds.

Expand All @@ -286,9 +267,9 @@ Reason:

Limits:

- First support is local development and one Spring Boot JVM.
- Supported operation is local development; the bundled and automated distributed acceptance path uses two Spring Boot JVMs connected by synchronous HTTP.
- The target JVM must be restarted with the Agent; dynamic attach is not supported.
- Distributed services, authentication, persistence, sampling controls, and production APM operation remain later phases.
- Message queues, asynchronous consumers, authentication, persistence, sampling controls, and production APM operation remain later phases.
- See `docs/external-runtime-tracing-design.md` for the executable contract and metadata policy.

## Implementation Rules Going Forward
Expand All @@ -306,8 +287,8 @@ The UI now separates the workflow into three evidence stages:

- `Project`: static Spring structure and analysis coverage.
- `Request`: API input, execution target, and HTTP response.
- `Trace`: actual OTLP Waterfall, failure propagation, response preview, and exception detail.
- `Trace`: actual OTLP Waterfall, service boundaries, failure propagation, response preview, and exception detail.

The next compatibility task is to normalize both legacy and current OpenTelemetry code semantic keys. In particular, the Java Agent can emit `code.function` while the current Inspector also expects `code.function.name`. Supporting both keys will keep class and method location summaries accurate across Agent versions.
Legacy and current OpenTelemetry code semantic keys are normalized in the frontend display layer. A non-demo Spring Boot 3.4.1 project and the two-service OrderยทProduct workspace are both recorded acceptance paths.

After that compatibility fix, validate one non-demo Spring Boot project end to end and publish the verified state as `v0.1.1`.
The next delivery task is portfolio packaging: align public screenshots and demo media with the distributed Trace flow, document the verified limits, and publish a release from a clean, green `main`.
23 changes: 22 additions & 1 deletion examples/distributed-trace-lab/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ docker compose up --build --wait

StackFlow UI๋Š” [http://localhost:5173](http://localhost:5173), backend๋Š” `http://localhost:18080`์—์„œ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.

UI๋Š” `/workspace/distributed-trace-lab`์„ ์ž๋™ ๋ถ„์„ํ•ฉ๋‹ˆ๋‹ค.

1. ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ์—์„œ `order-service`๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.
2. API ์š”์ฒญ์—์„œ `GET /lab/orders/{orderId}` ๋˜๋Š” timeout endpoint๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.
3. ๊ธฐ๋ณธ `orderId`์ธ `2001`๋กœ `์š”์ฒญ ๋ณด๋‚ด๊ณ  Trace ๋ณด๊ธฐ`๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
4. Trace์˜ Waterfall๊ณผ ๊ทธ๋ž˜ํ”„์—์„œ `order-service โ†’ product-service` ๊ฒฝ๊ณ„๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

## ๋ถ„์‚ฐ Trace API

```bash
Expand Down Expand Up @@ -51,7 +58,21 @@ curl http://localhost:8092/lab/orders/2001/product-timeout
- `order-service`: ์ฃผ๋ฌธ ๋งคํ•‘๊ณผ Product HTTP Client ํ˜ธ์ถœ
- `product-service`: Redis cache, PostgreSQL ์กฐํšŒ์™€ ์‹ค์ œ query timeout

PR 2 ๋‹จ๊ณ„์˜ StackFlow ๊ธฐ๋ณธ ํ™”๋ฉด์€ Order Service๋ฅผ ๋ถ„์„ํ•ฉ๋‹ˆ๋‹ค. Workspace ์ „์ฒด ์„œ๋น„์Šค ์„ ํƒ UI๋Š” ํ›„์† ์ž‘์—…์—์„œ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ์ •์  workspace API๋Š” `/workspace/distributed-trace-lab` ์•„๋ž˜ ๋‘ ์„œ๋น„์Šค๋ฅผ ๊ฐ๊ฐ ๋ถ„์„ํ•ฉ๋‹ˆ๋‹ค.
StackFlow๋Š” Workspace ์•„๋ž˜ ๋‘ ์„œ๋น„์Šค๋ฅผ ๊ฐ๊ฐ ๋ถ„์„ํ•˜๊ณ  ์„œ๋น„์Šค ์„ ํƒ์„ ๋„๋ฉ”์ธยทAPI ์„ ํƒ๋ณด๋‹ค ๋จผ์ € ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค. ๊ฐ ์„œ๋น„์Šค์˜ Java Agent๋Š” ๋™์ผํ•œ W3C Trace Context๋ฅผ ์ด์–ด๋ฐ›์œผ๋ฉฐ, ์„œ๋น„์Šค ๊ด€๊ณ„๋Š” ์ •์  ์ถ”์ธก์ด ์•„๋‹ˆ๋ผ ์‹ค์ œ span ๋ถ€๋ชจยท์ž์‹ ๊ด€๊ณ„๋กœ๋งŒ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.

## ์ž๋™ ๊ฒ€์ฆ

```bash
# 6๊ฐœ APIยท์ธํ”„๋ผ ์‹œ๋‚˜๋ฆฌ์˜ค
./scripts/verify-demo.sh

# ์ •์ƒ ๋ถ„์‚ฐ ์š”์ฒญ๊ณผ timeout UI ์‹œ๋‚˜๋ฆฌ์˜ค
cd frontend
npx playwright install chromium
npm run test:e2e
```

Playwright๋Š” ์ •์ƒ ์š”์ฒญ์˜ Waterfallยท๊ทธ๋ž˜ํ”„ ์„œ๋น„์Šค ๊ฒฝ๊ณ„์™€ timeout ์š”์ฒญ์˜ PostgreSQL ์›์ธยทOrder ์ „ํŒŒ ๊ฒฝ๋กœ, 390ร—844 ํ™”๋ฉด overflow๋ฅผ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค.

์ข…๋ฃŒ:

Expand Down
Loading