feat: microservice architecture
This commit is contained in:
72
docs/content/stories/phase6/6.1-enhanced-observability.md
Normal file
72
docs/content/stories/phase6/6.1-enhanced-observability.md
Normal file
@@ -0,0 +1,72 @@
|
||||
# Story 6.1: Enhanced Observability
|
||||
|
||||
## Metadata
|
||||
- **Story ID**: 6.1
|
||||
- **Title**: Enhanced Observability
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: 6-8 hours
|
||||
- **Dependencies**: 1.6, 5.2, 5.1
|
||||
|
||||
## Goal
|
||||
Enhance observability with full OpenTelemetry integration, comprehensive Prometheus metrics expansion, and improved logging with request correlation.
|
||||
|
||||
## Description
|
||||
This story enhances the observability system by completing OpenTelemetry integration with all infrastructure components, expanding Prometheus metrics, and improving logging with better correlation and structured fields.
|
||||
|
||||
## Deliverables
|
||||
|
||||
### 1. Complete OpenTelemetry Integration
|
||||
- Export traces to Jaeger/OTLP collector
|
||||
- Add database instrumentation (Ent interceptor)
|
||||
- Add Kafka instrumentation
|
||||
- Add Redis instrumentation
|
||||
- Create custom spans:
|
||||
- Module initialization spans
|
||||
- Background job spans
|
||||
- Event publishing spans
|
||||
- Trace context propagation:
|
||||
- Include trace ID in logs
|
||||
- Propagate across HTTP calls
|
||||
- Include in error reports
|
||||
|
||||
### 2. Prometheus Metrics Expansion
|
||||
- Add more metrics:
|
||||
- Database connection pool stats
|
||||
- Cache hit/miss ratio
|
||||
- Event bus publish/consume rates
|
||||
- Background job execution times
|
||||
- Module-specific metrics (via module interface)
|
||||
- Create metric labels:
|
||||
- `module` label for module metrics
|
||||
- `tenant_id` label (if multi-tenant)
|
||||
- `status` label for error rates
|
||||
|
||||
### 3. Enhanced Logging
|
||||
- Add structured fields:
|
||||
- `user_id` from context
|
||||
- `tenant_id` from context
|
||||
- `module` name for module logs
|
||||
- `trace_id` from OpenTelemetry
|
||||
- Create log aggregation config:
|
||||
- JSON format for production
|
||||
- Human-readable for development
|
||||
- Support for Loki/CloudWatch/ELK
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Traces are exported and visible in Jaeger
|
||||
- [ ] All infrastructure components are instrumented
|
||||
- [ ] Trace IDs are included in logs
|
||||
- [ ] Metrics are expanded with new dimensions
|
||||
- [ ] Logs include all correlation fields
|
||||
- [ ] Log aggregation works correctly
|
||||
|
||||
## Files to Create/Modify
|
||||
- `internal/observability/tracer.go` - Enhanced tracing
|
||||
- `internal/infra/database/client.go` - Add tracing
|
||||
- `internal/infra/cache/redis_cache.go` - Add tracing
|
||||
- `internal/infra/bus/kafka_bus.go` - Add tracing
|
||||
- `internal/metrics/metrics.go` - Expanded metrics
|
||||
- `internal/logger/zap_logger.go` - Enhanced logging
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.1.1: Complete OpenTelemetry setup:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.1.1
|
||||
- **Title**: Complete OpenTelemetry setup:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.1
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Complete OpenTelemetry setup:
|
||||
|
||||
## Requirements
|
||||
- Complete OpenTelemetry setup:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.1.1 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.1.2: Create custom spans:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.1.2
|
||||
- **Title**: Create custom spans:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.1
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Create custom spans:
|
||||
|
||||
## Requirements
|
||||
- Create custom spans:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.1.2 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.1.3: Add trace context propagation:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.1.3
|
||||
- **Title**: Add trace context propagation:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.1
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Add trace context propagation:
|
||||
|
||||
## Requirements
|
||||
- Add trace context propagation:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.1.3 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
53
docs/content/stories/phase6/6.2-error-reporting.md
Normal file
53
docs/content/stories/phase6/6.2-error-reporting.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# Story 6.2: Error Reporting (Sentry)
|
||||
|
||||
## Metadata
|
||||
- **Story ID**: 6.2
|
||||
- **Title**: Error Reporting (Sentry)
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: 4-5 hours
|
||||
- **Dependencies**: 1.4
|
||||
|
||||
## Goal
|
||||
Add comprehensive error reporting with Sentry integration that captures errors with full context.
|
||||
|
||||
## Description
|
||||
This story integrates Sentry for error reporting, sending all errors from the error bus to Sentry with complete context including trace IDs, user information, and module context.
|
||||
|
||||
## Deliverables
|
||||
|
||||
### 1. Sentry Integration
|
||||
- Install and configure Sentry SDK
|
||||
- Integrate with error bus:
|
||||
- Send errors to Sentry
|
||||
- Include trace ID in Sentry events
|
||||
- Add user context (user ID, email)
|
||||
- Add module context (module name)
|
||||
- Sentry middleware:
|
||||
- Capture panics
|
||||
- Capture HTTP errors (4xx, 5xx)
|
||||
- Configure Sentry DSN via config
|
||||
|
||||
### 2. Error Context Enhancement
|
||||
- Enrich errors with:
|
||||
- Request context
|
||||
- User information
|
||||
- Module information
|
||||
- Stack traces
|
||||
- Environment information
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Errors are reported to Sentry with context
|
||||
- [ ] Panics are captured and reported
|
||||
- [ ] HTTP errors are captured
|
||||
- [ ] Trace IDs are included in Sentry events
|
||||
- [ ] User context is included
|
||||
- [ ] Sentry DSN is configurable
|
||||
|
||||
## Files to Create/Modify
|
||||
- `internal/errorbus/sentry_bus.go` - Sentry integration
|
||||
- `internal/server/middleware.go` - Sentry middleware
|
||||
- `internal/di/providers.go` - Add Sentry provider
|
||||
- `config/default.yaml` - Add Sentry config
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.2.1: Install `github.com/getsentry/sentry-go`
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.2.1
|
||||
- **Title**: Install `github.com/getsentry/sentry-go`
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.2
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Install `github.com/getsentry/sentry-go`
|
||||
|
||||
## Requirements
|
||||
- Install `github.com/getsentry/sentry-go`
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.2.1 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.2.2: Integrate with error bus:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.2.2
|
||||
- **Title**: Integrate with error bus:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.2
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Integrate with error bus:
|
||||
|
||||
## Requirements
|
||||
- Integrate with error bus:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.2.2 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.2.3: Add Sentry middleware:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.2.3
|
||||
- **Title**: Add Sentry middleware:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.2
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Add Sentry middleware:
|
||||
|
||||
## Requirements
|
||||
- Add Sentry middleware:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.2.3 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.2.4: Configure Sentry DSN via config
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.2.4
|
||||
- **Title**: Configure Sentry DSN via config
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.2
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Configure Sentry DSN via config
|
||||
|
||||
## Requirements
|
||||
- Configure Sentry DSN via config
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.2.4 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
46
docs/content/stories/phase6/6.3-grafana-dashboards.md
Normal file
46
docs/content/stories/phase6/6.3-grafana-dashboards.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# Story 6.3: Grafana Dashboards
|
||||
|
||||
## Metadata
|
||||
- **Story ID**: 6.3
|
||||
- **Title**: Grafana Dashboards
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Status**: Pending
|
||||
- **Priority**: Medium
|
||||
- **Estimated Time**: 4-5 hours
|
||||
- **Dependencies**: 1.3, 6.1
|
||||
|
||||
## Goal
|
||||
Create comprehensive Grafana dashboards for monitoring platform health, performance, and errors.
|
||||
|
||||
## Description
|
||||
This story creates Grafana dashboard JSON files that visualize platform metrics, health, and performance data from Prometheus.
|
||||
|
||||
## Deliverables
|
||||
|
||||
### 1. Grafana Dashboards (`ops/grafana/dashboards/`)
|
||||
- `platform-overview.json` - Overall health dashboard
|
||||
- `http-metrics.json` - HTTP request metrics
|
||||
- `database-metrics.json` - Database performance
|
||||
- `module-metrics.json` - Per-module metrics
|
||||
- `error-rates.json` - Error tracking
|
||||
- Dashboard setup documentation
|
||||
|
||||
### 2. Documentation
|
||||
- Document dashboard setup in `docs/operations.md`
|
||||
- Dashboard import instructions
|
||||
- Metric explanation
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] All dashboards are created
|
||||
- [ ] Dashboards display correct metrics
|
||||
- [ ] Dashboard setup is documented
|
||||
- [ ] Dashboards can be imported into Grafana
|
||||
|
||||
## Files to Create/Modify
|
||||
- `ops/grafana/dashboards/platform-overview.json`
|
||||
- `ops/grafana/dashboards/http-metrics.json`
|
||||
- `ops/grafana/dashboards/database-metrics.json`
|
||||
- `ops/grafana/dashboards/module-metrics.json`
|
||||
- `ops/grafana/dashboards/error-rates.json`
|
||||
- `docs/operations.md` - Dashboard documentation
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.3.1: Add request correlation:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.3.1
|
||||
- **Title**: Add request correlation:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.3
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Add request correlation:
|
||||
|
||||
## Requirements
|
||||
- Add request correlation:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.3.1 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.3.2: Add structured fields:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.3.2
|
||||
- **Title**: Add structured fields:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.3
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Add structured fields:
|
||||
|
||||
## Requirements
|
||||
- Add structured fields:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.3.2 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.3.3: Create log aggregation config:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.3.3
|
||||
- **Title**: Create log aggregation config:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.3
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Create log aggregation config:
|
||||
|
||||
## Requirements
|
||||
- Create log aggregation config:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.3.3 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
53
docs/content/stories/phase6/6.4-rate-limiting.md
Normal file
53
docs/content/stories/phase6/6.4-rate-limiting.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# Story 6.4: Rate Limiting
|
||||
|
||||
## Metadata
|
||||
- **Story ID**: 6.4
|
||||
- **Title**: Rate Limiting
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: 4-5 hours
|
||||
- **Dependencies**: 1.5, 5.1
|
||||
|
||||
## Goal
|
||||
Implement rate limiting to prevent API abuse and ensure fair resource usage.
|
||||
|
||||
## Description
|
||||
This story implements rate limiting middleware that limits requests per user and per IP address, with configurable limits per endpoint.
|
||||
|
||||
## Deliverables
|
||||
|
||||
### 1. Rate Limiting Middleware
|
||||
- Per-user rate limiting
|
||||
- Per-IP rate limiting
|
||||
- Configurable limits per endpoint
|
||||
- Rate limit storage (Redis)
|
||||
- Return `X-RateLimit-*` headers
|
||||
|
||||
### 2. Configuration
|
||||
- Rate limit config in `config/default.yaml`:
|
||||
```yaml
|
||||
rate_limiting:
|
||||
enabled: true
|
||||
per_user: 100/minute
|
||||
per_ip: 1000/minute
|
||||
```
|
||||
|
||||
### 3. Integration
|
||||
- Integrate with HTTP server
|
||||
- Add to middleware stack
|
||||
- Error responses for rate limit exceeded
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Rate limiting prevents abuse
|
||||
- [ ] Per-user limits work correctly
|
||||
- [ ] Per-IP limits work correctly
|
||||
- [ ] Rate limit headers are returned
|
||||
- [ ] Configuration is flexible
|
||||
- [ ] Rate limits are stored in Redis
|
||||
|
||||
## Files to Create/Modify
|
||||
- `internal/server/middleware.go` - Rate limiting middleware
|
||||
- `internal/infra/ratelimit/limiter.go` - Rate limiter implementation
|
||||
- `config/default.yaml` - Add rate limit config
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.4.1: Add more metrics:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.4.1
|
||||
- **Title**: Add more metrics:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.4
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Add more metrics:
|
||||
|
||||
## Requirements
|
||||
- Add more metrics:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.4.1 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.4.2: Create metric labels:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.4.2
|
||||
- **Title**: Create metric labels:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.4
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Create metric labels:
|
||||
|
||||
## Requirements
|
||||
- Create metric labels:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.4.2 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
54
docs/content/stories/phase6/6.5-security-hardening.md
Normal file
54
docs/content/stories/phase6/6.5-security-hardening.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# Story 6.5: Security Hardening
|
||||
|
||||
## Metadata
|
||||
- **Story ID**: 6.5
|
||||
- **Title**: Security Hardening
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: 5-6 hours
|
||||
- **Dependencies**: 1.5
|
||||
|
||||
## Goal
|
||||
Add comprehensive security hardening including security headers, input validation, and request size limits.
|
||||
|
||||
## Description
|
||||
This story implements security best practices including security headers, input validation, request size limits, and SQL injection protection.
|
||||
|
||||
## Deliverables
|
||||
|
||||
### 1. Security Headers Middleware
|
||||
- `X-Content-Type-Options: nosniff`
|
||||
- `X-Frame-Options: DENY`
|
||||
- `X-XSS-Protection: 1; mode=block`
|
||||
- `Strict-Transport-Security` (if HTTPS)
|
||||
- `Content-Security-Policy`
|
||||
|
||||
### 2. Request Size Limits
|
||||
- Max body size (10MB default)
|
||||
- Max header size
|
||||
- Configurable limits
|
||||
|
||||
### 3. Input Validation
|
||||
- Use `github.com/go-playground/validator`
|
||||
- Validate all request bodies
|
||||
- Sanitize user inputs
|
||||
- Validation error responses
|
||||
|
||||
### 4. SQL Injection Protection
|
||||
- Use parameterized queries (Ent already does this)
|
||||
- Add linter rule to prevent raw SQL
|
||||
- Security scanning
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Security headers are present
|
||||
- [ ] Request size limits are enforced
|
||||
- [ ] Input validation works
|
||||
- [ ] SQL injection protection is in place
|
||||
- [ ] Security headers are configurable
|
||||
|
||||
## Files to Create/Modify
|
||||
- `internal/server/middleware.go` - Security headers middleware
|
||||
- `internal/server/validation.go` - Input validation
|
||||
- `config/default.yaml` - Add security config
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.5.1: Create `ops/grafana/dashboards/`:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.5.1
|
||||
- **Title**: Create `ops/grafana/dashboards/`:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.5
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Create `ops/grafana/dashboards/`:
|
||||
|
||||
## Requirements
|
||||
- Create `ops/grafana/dashboards/`:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.5.1 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.5.2: Document dashboard setup in `docs/operations.md`
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.5.2
|
||||
- **Title**: Document dashboard setup in `docs/operations.md`
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.5
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Document dashboard setup in `docs/operations.md`
|
||||
|
||||
## Requirements
|
||||
- Document dashboard setup in `docs/operations.md`
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.5.2 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
53
docs/content/stories/phase6/6.6-performance-optimization.md
Normal file
53
docs/content/stories/phase6/6.6-performance-optimization.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# Story 6.6: Performance Optimization
|
||||
|
||||
## Metadata
|
||||
- **Story ID**: 6.6
|
||||
- **Title**: Performance Optimization
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Status**: Pending
|
||||
- **Priority**: Medium
|
||||
- **Estimated Time**: 6-8 hours
|
||||
- **Dependencies**: 1.2, 5.1
|
||||
|
||||
## Goal
|
||||
Optimize platform performance through database connection pooling, query optimization, response compression, and caching strategies.
|
||||
|
||||
## Description
|
||||
This story implements performance optimizations including database connection pooling, query optimization, response compression, and strategic caching.
|
||||
|
||||
## Deliverables
|
||||
|
||||
### 1. Database Connection Pooling
|
||||
- Configure max connections
|
||||
- Configure idle timeout
|
||||
- Monitor pool stats
|
||||
- Connection health checks
|
||||
|
||||
### 2. Query Optimization
|
||||
- Add indexes for common queries
|
||||
- Use database query logging (development)
|
||||
- Add slow query detection
|
||||
- Query performance monitoring
|
||||
|
||||
### 3. Response Compression
|
||||
- Gzip middleware for large responses
|
||||
- Configurable compression levels
|
||||
- Content type filtering
|
||||
|
||||
### 4. Caching Strategy
|
||||
- Cache frequently accessed data (user permissions, roles)
|
||||
- Cache invalidation strategies
|
||||
- Cache warming
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Database connection pooling is optimized
|
||||
- [ ] Query performance is improved
|
||||
- [ ] Response compression works
|
||||
- [ ] Caching strategy is effective
|
||||
- [ ] Performance meets SLA (< 100ms p95 for auth endpoints)
|
||||
|
||||
## Files to Create/Modify
|
||||
- `internal/infra/database/client.go` - Connection pooling
|
||||
- `internal/server/middleware.go` - Compression middleware
|
||||
- `internal/perm/in_memory_resolver.go` - Add caching
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.6.1: Install `github.com/ulule/limiter/v3`
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.6.1
|
||||
- **Title**: Install `github.com/ulule/limiter/v3`
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.6
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Install `github.com/ulule/limiter/v3`
|
||||
|
||||
## Requirements
|
||||
- Install `github.com/ulule/limiter/v3`
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.6.1 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.6.2: Create rate limit middleware:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.6.2
|
||||
- **Title**: Create rate limit middleware:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.6
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Create rate limit middleware:
|
||||
|
||||
## Requirements
|
||||
- Create rate limit middleware:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.6.2 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
# Task 6.6.3: Add rate limit config:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.6.3
|
||||
- **Title**: Add rate limit config:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.6
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Add rate limit config:
|
||||
|
||||
## Requirements
|
||||
- Add rate limit config:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.6.3 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
|
||||
## Code Reference
|
||||
|
||||
```go
|
||||
rate_limiting:
|
||||
enabled: true
|
||||
per_user: 100/minute
|
||||
per_ip: 1000/minute
|
||||
```
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.6.4: Return `X-RateLimit-*` headers
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.6.4
|
||||
- **Title**: Return `X-RateLimit-*` headers
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.6
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Return `X-RateLimit-*` headers
|
||||
|
||||
## Requirements
|
||||
- Return `X-RateLimit-*` headers
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.6.4 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.7.1: Add security headers middleware:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.7.1
|
||||
- **Title**: Add security headers middleware:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.7
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Add security headers middleware:
|
||||
|
||||
## Requirements
|
||||
- Add security headers middleware:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.7.1 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.7.2: Add request size limits:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.7.2
|
||||
- **Title**: Add request size limits:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.7
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Add request size limits:
|
||||
|
||||
## Requirements
|
||||
- Add request size limits:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.7.2 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.7.3: Add input validation:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.7.3
|
||||
- **Title**: Add input validation:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.7
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Add input validation:
|
||||
|
||||
## Requirements
|
||||
- Add input validation:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.7.3 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.7.4: Add SQL injection protection:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.7.4
|
||||
- **Title**: Add SQL injection protection:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.7
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Add SQL injection protection:
|
||||
|
||||
## Requirements
|
||||
- Add SQL injection protection:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.7.4 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.8.1: Add database connection pooling:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.8.1
|
||||
- **Title**: Add database connection pooling:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.8
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Add database connection pooling:
|
||||
|
||||
## Requirements
|
||||
- Add database connection pooling:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.8.1 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.8.2: Add query optimization:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.8.2
|
||||
- **Title**: Add query optimization:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.8
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Add query optimization:
|
||||
|
||||
## Requirements
|
||||
- Add query optimization:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.8.2 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.8.3: Add response compression:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.8.3
|
||||
- **Title**: Add response compression:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.8
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Add response compression:
|
||||
|
||||
## Requirements
|
||||
- Add response compression:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.8.3 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# Task 6.8.4: Add caching strategy:
|
||||
|
||||
## Metadata
|
||||
- **Task ID**: 6.8.4
|
||||
- **Title**: Add caching strategy:
|
||||
- **Phase**: 6 - Observability & Production Readiness
|
||||
- **Section**: 6.8
|
||||
- **Status**: Pending
|
||||
- **Priority**: High
|
||||
- **Estimated Time**: TBD
|
||||
- **Dependencies**: TBD
|
||||
|
||||
## Description
|
||||
Add caching strategy:
|
||||
|
||||
## Requirements
|
||||
- Add caching strategy:
|
||||
|
||||
## Implementation Steps
|
||||
1. TODO: Add implementation steps
|
||||
2. TODO: Add implementation steps
|
||||
3. TODO: Add implementation steps
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Task 6.8.4 is completed
|
||||
- [ ] All requirements are met
|
||||
- [ ] Code compiles and tests pass
|
||||
|
||||
## Related ADRs
|
||||
- See relevant ADRs in `docs/adr/`
|
||||
|
||||
## Implementation Notes
|
||||
- TODO: Add implementation notes
|
||||
|
||||
## Testing
|
||||
```bash
|
||||
# TODO: Add test commands
|
||||
go test ./...
|
||||
```
|
||||
|
||||
@@ -1,48 +1,55 @@
|
||||
# Phase 6: Observability & Production Readiness
|
||||
|
||||
## Overview
|
||||
Complete observability setup with OpenTelemetry, integrate error reporting with Sentry, enhance logging with correlation IDs, and add rate limiting.
|
||||
Enhance observability with full OpenTelemetry integration, add comprehensive error reporting (Sentry), create Grafana dashboards, improve logging with request correlation, add rate limiting and security hardening, and optimize performance.
|
||||
|
||||
## Tasks
|
||||
## Stories
|
||||
|
||||
### 6.1 OpenTelemetry Completion
|
||||
- [6.1.1 - Complete OpenTelemetry Setup](./6.1.1-complete-opentelemetry-setup.md)
|
||||
- [6.1.2 - Create Custom Spans](./6.1.2-create-custom-spans.md)
|
||||
- [6.1.3 - Add Trace Context Propagation](./6.1.3-add-trace-context-propagation.md)
|
||||
### 6.1 Enhanced Observability
|
||||
- [Story: 6.1 - Enhanced Observability](./6.1-enhanced-observability.md)
|
||||
- **Goal:** Enhance observability with full OpenTelemetry integration, comprehensive Prometheus metrics, and improved logging.
|
||||
- **Deliverables:** Complete OpenTelemetry integration, expanded metrics, enhanced logging
|
||||
|
||||
### 6.2 Error Reporting (Sentry)
|
||||
- [6.2.1 - Install Sentry](./6.2.1-install-githubcomgetsentrysentry-go.md)
|
||||
- [6.2.2 - Integrate with Error Bus](./6.2.2-integrate-with-error-bus.md)
|
||||
- [6.2.3 - Add Sentry Middleware](./6.2.3-add-sentry-middleware.md)
|
||||
- [6.2.4 - Configure Sentry DSN](./6.2.4-configure-sentry-dsn-via-config.md)
|
||||
- [Story: 6.2 - Error Reporting](./6.2-error-reporting.md)
|
||||
- **Goal:** Add comprehensive error reporting with Sentry integration.
|
||||
- **Deliverables:** Sentry integration, error context enhancement
|
||||
|
||||
### 6.3 Enhanced Logging
|
||||
- [6.3.1 - Add Request Correlation](./6.3.1-add-request-correlation.md)
|
||||
- [6.3.2 - Add Structured Fields](./6.3.2-add-structured-fields.md)
|
||||
- [6.3.3 - Create Log Aggregation Config](./6.3.3-create-log-aggregation-config.md)
|
||||
### 6.3 Grafana Dashboards
|
||||
- [Story: 6.3 - Grafana Dashboards](./6.3-grafana-dashboards.md)
|
||||
- **Goal:** Create comprehensive Grafana dashboards for monitoring.
|
||||
- **Deliverables:** Grafana dashboard JSON files, documentation
|
||||
|
||||
### 6.4 Rate Limiting
|
||||
- [6.4.1 - Create Rate Limiter Interface](./6.4.1-create-pkgratelimitratelimitergo-interface.md)
|
||||
- [6.4.2 - Implement Redis Rate Limiter](./6.4.2-implement-internalratelimitredis_limitergo.md)
|
||||
- [6.4.3 - Add Rate Limit Middleware](./6.4.3-add-rate-limit-middleware.md)
|
||||
- [Story: 6.4 - Rate Limiting](./6.4-rate-limiting.md)
|
||||
- **Goal:** Implement rate limiting to prevent API abuse.
|
||||
- **Deliverables:** Rate limiting middleware, configuration
|
||||
|
||||
### 6.5 Production Configuration
|
||||
- [6.5.1 - Create Production Config Template](./6.5.1-create-production-config-template.md)
|
||||
- [6.5.2 - Add Environment-Specific Settings](./6.5.2-add-environment-specific-settings.md)
|
||||
### 6.5 Security Hardening
|
||||
- [Story: 6.5 - Security Hardening](./6.5-security-hardening.md)
|
||||
- **Goal:** Add comprehensive security hardening.
|
||||
- **Deliverables:** Security headers, input validation, request limits
|
||||
|
||||
### 6.6 Performance Optimization
|
||||
- [Story: 6.6 - Performance Optimization](./6.6-performance-optimization.md)
|
||||
- **Goal:** Optimize platform performance.
|
||||
- **Deliverables:** Connection pooling, query optimization, compression, caching
|
||||
|
||||
## Deliverables Checklist
|
||||
- [ ] OpenTelemetry fully integrated with custom spans
|
||||
- [ ] Sentry error reporting working
|
||||
- [ ] Enhanced logging with correlation IDs
|
||||
- [ ] Rate limiting middleware implemented
|
||||
- [ ] Production configuration templates ready
|
||||
- [ ] All observability data flowing to external systems
|
||||
- [ ] Full OpenTelemetry integration
|
||||
- [ ] Sentry error reporting
|
||||
- [ ] Enhanced logging with correlation
|
||||
- [ ] Comprehensive Prometheus metrics
|
||||
- [ ] Grafana dashboards
|
||||
- [ ] Rate limiting
|
||||
- [ ] Security hardening
|
||||
- [ ] Performance optimizations
|
||||
|
||||
## Acceptance Criteria
|
||||
- Traces are exported to OTLP endpoint
|
||||
- Errors are reported to Sentry
|
||||
- Logs include correlation IDs
|
||||
- Traces are exported and visible in Jaeger
|
||||
- Errors are reported to Sentry with context
|
||||
- Logs include request IDs and trace IDs
|
||||
- Metrics are exposed and scraped by Prometheus
|
||||
- Rate limiting prevents abuse
|
||||
- Production configs are validated
|
||||
- All metrics are exposed via Prometheus
|
||||
|
||||
- Security headers are present
|
||||
- Performance meets SLA (< 100ms p95 for auth endpoints)
|
||||
|
||||
Reference in New Issue
Block a user