Implement health check endpoint#28
Merged
Villarley merged 7 commits intoNeko-Protocol:mainfrom Jan 31, 2026
Merged
Conversation
- @nestjs/terminus, @nestjs/axios, @nestjs/config for health checks - prom-client for Prometheus metrics - ioredis for Redis health indicator
- /health: full check (Redis, Ingestor), returns 200 or 503 - /ready: readiness probe for Kubernetes - /live: liveness probe - /status: detailed system info (uptime, memory, checks) - RedisHealthIndicator: ping when REDIS_URL is set - IngestorHealthIndicator: GET ingestor when INGESTOR_URL is set - Health controller and module with tests
- /metrics: Prometheus exposition format - MetricsService: aggregation count, latency histogram, errors, by-symbol - Default Node.js metrics with aggregator_ prefix - Metrics controller and service with tests
- /debug/prices: returns last aggregated and normalized prices in memory - DebugService: in-memory store for last prices per symbol - Debug controller and service with tests
- AppModule: import ConfigModule, HealthModule, MetricsModule, DebugModule - AggregationService: optional MetricsService and DebugService injection - Record aggregation metrics (count, latency, errors) and last prices on aggregate()
- README: API endpoints table (health, ready, live, status, metrics, debug/prices) - README: update architecture with health, metrics, debug folders - .env.example: REDIS_URL and INGESTOR_URL for health checks
Contributor
Author
|
@Villarley could you please review my pr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Changes description
Summary
Implements health check endpoints, Prometheus metrics, and monitoring/debug APIs for the aggregator service to support production observability and Kubernetes probes.
Context: Production needs clear visibility into the aggregator’s state. Health checks let Kubernetes determine if the service is healthy; metrics support performance and error analysis.
Closes #22
Health checks (
@nestjs/terminus)/health).Indicators:
REDIS_URLis set, pings Redis; health fails if unreachable. Skipped if not set.INGESTOR_URLis set, HTTP GET toINGESTOR_URL/prices/raw; health fails if unreachable or non-2xx. Skipped if not set.Prometheus metrics
Registered metrics:
aggregator_aggregations_total(bymethod)aggregator_aggregation_duration_seconds(histogram, bymethod)aggregator_errors_total(bymethod)aggregator_aggregations_by_symbol_total(bysymbol,method)aggregator_prefixAggregationServicerecords success (count + latency) and errors on each aggregation whenMetricsServiceis injected.Debug
Files changed / added
New:
apps/aggregator/src/health/– Health module, controller, Redis/Ingestor indicators + specsapps/aggregator/src/metrics/– Metrics module, controller, service + specsapps/aggregator/src/debug/– Debug module, controller, service + specsModified:
apps/aggregator/package.json– Dependencies:@nestjs/terminus,@nestjs/axios,@nestjs/config,prom-client,ioredisapps/aggregator/src/app.module.ts– ImportsConfigModule,HealthModule,MetricsModule,DebugModuleapps/aggregator/src/services/aggregation.service.ts– OptionalMetricsServiceandDebugService; records metrics and last prices onaggregate()apps/aggregator/README.md– API endpoints table and updated architectureapps/aggregator/.env.example–REDIS_URL,INGESTOR_URLAcceptance criteria
/healthreturns 200 when OK, 503 when a configured dependency is downREDIS_URLis set; health fails if no connectionINGESTOR_URLis set; health fails if it doesn’t respond/metricsreturns Prometheus format with latency, throughput, and error metrics/readyand/livework for Kubernetes probes/statusreturns detailed system information