Project Contents

╔════════════════════════════════════════════════════════════════════════════╗ ║ PROJECT COMPLETE CONTENTS ║ ║ OpenTelemetry + Rust + K6 Load Testing Tutorial ║ ╚════════════════════════════════════════════════════════════════════════════╝

PROJECT LOCATION: /Users/shion/workspace/otel-tutorial-rust

═══════════════════════════════════════════════════════════════════════════════

📁 SOURCE CODE (4 files) ──────────────────────────────────────────────────────────────────────────── src/main.rs • Application entry point • HTTP server setup with Actix-web • Telemetry initialization • Route definitions

src/observability.rs • OTEL & Jaeger configuration • Tracing subscriber setup • JSON logging configuration • Instrumentation utilities

src/handlers.rs • 5 API endpoints (health, users CRUD, fibonacci) • Span-based instrumentation with #[tracing::instrument] • Error handling with proper logging • Request parameter validation

src/custom_middleware.rs • Request ID middleware • HTTP request span creation • Timing measurement and recording • Request/response tracking

═══════════════════════════════════════════════════════════════════════════════

⚙️ CONFIGURATION (5 files) ──────────────────────────────────────────────────────────────────────────── docker-compose.yml • 5 service orchestration (Loki, Promtail, Jaeger, Prometheus, Grafana) • Network setup and volume management • Port mapping and environment configuration

config/loki-config.yml • Loki server and storage configuration • BoltDB shipper settings • Retention and chunk policies

config/prometheus.yml • Prometheus scrape targets • Metrics collection intervals • Job configuration

config/promtail-config.yml • Log collector configuration • Docker container discovery • Loki client settings

config/grafana/datasources/datasources.yml • Loki data source configuration • Prometheus data source setup • Jaeger integration

═══════════════════════════════════════════════════════════════════════════════

📊 LOAD TESTING (4 files) ──────────────────────────────────────────────────────────────────────────── k6-stress-test.js • Comprehensive load testing script • 6 test groups (health, CRUD, fibonacci, errors) • Custom metrics and checks • Built-in load profile (ramp up/down) • ~400 lines of commented JavaScript

START_K6_TEST.sh • Interactive load test launcher • Environment verification • Health checks before test • User-friendly prompts

RUN_K6_TEST.md • Detailed k6 usage guide • Multiple test scenarios • Metrics explanation • Troubleshooting guide • Advanced customization examples

K6_SUMMARY.md • K6 integration overview • Quick reference guide • Performance expectations • Learning exercises

═══════════════════════════════════════════════════════════════════════════════

📚 DOCUMENTATION (8 files, ~50,000 words total) ──────────────────────────────────────────────────────────────────────────── Getting Started Index • Main entry point • 3-step quick start • Learning path overview • File navigation guide

Quick Start • 5-minute setup guide • Step-by-step instructions • Troubleshooting section • Common issues & solutions

Tech Stack • Architecture deep dive • Traces, spans, logs, metrics explained • Component descriptions • Data flow diagrams • Performance characteristics

Onboarding Guide • Structured learning journey • 4-phase learning path • Hands-on exercises • Key concepts explained

Architecture Guide • Complete reference documentation • Architecture overview • Project structure explanation • API endpoint documentation • Advanced topics & patterns

Commands Reference • Quick lookup guide • URLs and ports table • API commands (curl examples) • Docker and k6 commands • LogQL and PromQL examples • Common issues table

K6 Testing Guide (see Load Testing section)

K6 Summary (see Load Testing section)

═══════════════════════════════════════════════════════════════════════════════

📦 BUILD & DEPENDENCY FILES ──────────────────────────────────────────────────────────────────────────── Cargo.toml • 13 dependencies configured • Rust edition 2024 • Build profiles (debug/release)

Cargo.lock • Locked dependency versions • Reproducible builds

.env.example • Environment variable template • Jaeger configuration example • Log level settings

═══════════════════════════════════════════════════════════════════════════════

🏗️ BUILD ARTIFACTS ──────────────────────────────────────────────────────────────────────────── target/release/otel-tutorial • Compiled Rust binary (~30MB) • Ready to run on port 8080

═══════════════════════════════════════════════════════════════════════════════

📊 ADDITIONAL REFERENCE FILES ──────────────────────────────────────────────────────────────────────────── PROJECT_SUMMARY.txt • Detailed project overview • Features and capabilities • Statistics and metrics • Learning resources

PROJECT_CONTENTS.txt • This file • Complete contents listing • File descriptions

═══════════════════════════════════════════════════════════════════════════════

STATISTICS ────────── Total Files: 20+ Total Lines of Code: ~2,500 (Rust) + ~400 (JavaScript) Total Documentation: ~50,000 words across 8 files Total Configuration: 5 YAML/YML files Docker Services: 5 (Loki, Promtail, Jaeger, Prometheus, Grafana) API Endpoints: 5 (health, users CRUD, fibonacci) K6 Test Groups: 6 (health, CRUD, fibonacci, errors) Test Scenarios: Light, Medium, Heavy, Custom Project Size: ~1.3GB (includes compiled binary and dependencies)

═══════════════════════════════════════════════════════════════════════════════

CORE TECHNOLOGIES ───────────────── Language: Rust 1.70+ (Edition 2024) Web Framework: Actix-web 4.4 Tracing: OpenTelemetry 0.20 Logging: Tracing 0.1 Distributed Log: Loki 3.5.7 Log Collector: Promtail 3.5.7 Distributed Tracing: Jaeger 1.41 Metrics: Prometheus 2.48.0 Visualization: Grafana 10.2.0 Load Testing: k6 (latest) Orchestration: Docker & Docker Compose

═══════════════════════════════════════════════════════════════════════════════

QUICK REFERENCE - HOW TO USE ──────────────────────────── 1. Read: Getting Started 2. Setup: docker-compose up -d 3. Run: RUST_LOG=info ./target/release/otel-tutorial 4. Test: ./START_K6_TEST.sh 5. Monitor: Open http://localhost:3000 (Grafana)

═══════════════════════════════════════════════════════════════════════════════

API ENDPOINTS ───────────── GET /api/health Health check (baseline) POST /api/users Create new user GET /api/users List all users GET /api/users/{id} Get specific user POST /api/compute Compute fibonacci (CPU-intensive)

═══════════════════════════════════════════════════════════════════════════════

MONITORING DASHBOARDS ───────────────────── Logs: http://localhost:3000 (Grafana + Loki) Traces: http://localhost:16686 (Jaeger) Metrics: http://localhost:9090 (Prometheus)

═══════════════════════════════════════════════════════════════════════════════

KEY LEARNING OUTCOMES ───────────────────── ✓ OpenTelemetry instrumentation patterns ✓ Distributed tracing architecture ✓ Structured logging with Loki ✓ Metrics collection with Prometheus ✓ Unified observability visualization ✓ K6 load testing and stress scenarios ✓ Performance analysis under load ✓ Production observability patterns

═══════════════════════════════════════════════════════════════════════════════

WHAT'S INCLUDED ─────────────── ✅ Working Rust application with OTEL instrumentation ✅ Complete observability stack (5 Docker services) ✅ Comprehensive load testing suite (k6 + 6 scenarios) ✅ Detailed documentation (8 files, ~50K words) ✅ Interactive launch scripts ✅ Configuration templates ✅ Example queries and commands ✅ Troubleshooting guides ✅ Learning exercises

═══════════════════════════════════════════════════════════════════════════════

WHAT'S NOT INCLUDED ──────────────────── • Production-grade security (TLS, auth not configured) • Persistent storage backend (local filesystem only) • High availability setup (single instance) • Advanced alerting rules • Custom dashboards (template provided, not pre-built)

═══════════════════════════════════════════════════════════════════════════════

MODIFICATIONS MADE FROM INITIAL SETUP ────────────────────────────────────── 1. Fixed Loki configuration (deprecated field removal) 2. Fixed Promtail networking (Docker socket access) 3. Added comprehensive k6 load testing script 4. Added k6 launch and guide documentation 5. Verified all services are running and connected

═══════════════════════════════════════════════════════════════════════════════

FOR PRODUCTION USE ────────────────── Recommended additions: • TLS/HTTPS for all services • Authentication/authorization • Persistent volume mounts • Backup and recovery strategy • Resource limits and monitoring • Alerting rules and notifications • Log retention policies • High availability setup

═══════════════════════════════════════════════════════════════════════════════

NEXT STEPS ────────── 1. Read Getting Started (main guide) 2. Follow Quick Start (5-minute setup) 3. Run docker-compose up -d 4. Start the application 5. Execute ./START_K6_TEST.sh 6. Monitor data in Grafana/Jaeger/Prometheus 7. Read K6 Testing for detailed analysis 8. Explore Tech Stack for deep understanding 9. Modify and extend for your use cases 10. Apply patterns to your own projects

═══════════════════════════════════════════════════════════════════════════════

PROJECT GOAL ACHIEVED ───────────────────── ✓ Complete observability tutorial for Rust developers ✓ Demonstrates OTEL + Loki + Grafana integration ✓ Includes realistic load testing capabilities ✓ Production-ready code patterns ✓ Comprehensive learning materials ✓ Interactive and hands-on examples ✓ Ready to run immediately ✓ Fully documented and explained

═══════════════════════════════════════════════════════════════════════════════

Your complete observability learning platform is ready!

Start with: Getting Started Then: Quick Start Next: ./START_K6_TEST.sh

Happy observability learning! 🚀

═══════════════════════════════════════════════════════════════════════════════