Problem Statement
No distributed tracing exists. When a request flows through the backend (HTTP → Validation → GeoService → IPFS → Soroban → Database → Response), there is no way to trace the full request lifecycle across service boundaries.
Evidence
- No tracing instrumentation in NestJS application
- OpenTelemetry collector config referenced but missing (
monitoring/otel-collector.yml — FILE_DOES_NOT_EXIST)
Impact
Cannot trace requests across service boundaries (HTTP, database, Soroban, IPFS). Hard to debug latency issues in production.
Proposed Solution
- Install @opentelemetry/instrumentation-express, @opentelemetry/instrumentation-http, @opentelemetry/instrumentation-typeorm
- Configure NestJS OpenTelemetry module
- Create correlation ID middleware for request tracing
- Add span attributes for key operations (geohash encoding, IPFS pin, Soroban post)
- Export traces to OpenTelemetry collector
- Create otel-collector.yml configuration
Technical Requirements
- Must not significantly impact performance
- Must propagate trace context across async boundaries
- Must include database query spans
- Must sample traces (not trace every request in production)
Acceptance Criteria
- HTTP requests create trace spans
- Database queries appear as child spans
- External service calls (IPFS, Soroban) appear as child spans
- Trace context propagates across async operations
- Traces reach OpenTelemetry collector
- Sampling rate configurable via environment variable
- All existing tests pass
File Inventory
Backend/src/main.ts
Backend/src/common/interceptors/tracing.interceptor.ts (new)
Backend/package.json
monitoring/otel-collector.yml
Dependencies
Issue #10 (monitoring config) — otel-collector.yml must be created.
Testing Strategy
- Unit test: verify spans are created and propagated
- Integration test: verify traces reach collector
- Performance test: verify overhead is minimal
Security Considerations
Traces should not contain sensitive data (passwords, tokens, PII). Use span attribute filtering.
Definition of Done
Problem Statement
No distributed tracing exists. When a request flows through the backend (HTTP → Validation → GeoService → IPFS → Soroban → Database → Response), there is no way to trace the full request lifecycle across service boundaries.
Evidence
monitoring/otel-collector.yml— FILE_DOES_NOT_EXIST)Impact
Cannot trace requests across service boundaries (HTTP, database, Soroban, IPFS). Hard to debug latency issues in production.
Proposed Solution
Technical Requirements
Acceptance Criteria
File Inventory
Backend/src/main.tsBackend/src/common/interceptors/tracing.interceptor.ts(new)Backend/package.jsonmonitoring/otel-collector.ymlDependencies
Issue #10 (monitoring config) — otel-collector.yml must be created.
Testing Strategy
Security Considerations
Traces should not contain sensitive data (passwords, tokens, PII). Use span attribute filtering.
Definition of Done