@@ -6,8 +6,11 @@ A Rust web service implementing Twitter's Snowflake ID generation algorithm. Gen
66
77- Single ID generation endpoint
88- Bulk ID generation (up to 4,096,000 IDs per request)
9- - Handles clock drift and leap seconds
9+ - Health check endpoint for container orchestration
10+ - Handles clock drift and leap seconds with timeout protection
1011- Thread-safe sequence management
12+ - Configurable worker threads
13+ - Comprehensive input validation
1114
1215## API Endpoints
1316
@@ -21,17 +24,34 @@ Returns a single unique ID.
2124
2225### GET /ids/{count}
2326
24- Returns multiple unique IDs.
27+ Returns multiple unique IDs (count must be 1 to 4,096,000) .
2528
2629``` json
2730{"ids" : [" 123456789012345678" , " 123456789012345679" , ... ]}
2831```
2932
33+ ### GET /health
34+
35+ Health check endpoint for container orchestration (Kubernetes, Docker, etc.).
36+
37+ ``` json
38+ {"status" : " healthy" , "worker_id" : 1 }
39+ ```
40+
41+ ### Error Responses
42+
43+ All errors return JSON with a consistent format:
44+
45+ ``` json
46+ {"error" : " Error message description" }
47+ ```
48+
3049## Configuration
3150
32- | Environment Variable | Description | Required |
33- | ---------------------| -------------| ----------|
34- | ` WORKER_ID ` | Unique worker identifier (0-1023) | Yes |
51+ | Environment Variable | Description | Required | Default |
52+ | ---------------------| -------------| ----------| ---------|
53+ | ` WORKER_ID ` | Unique worker identifier (0-1023) | Yes | - |
54+ | ` WORKERS ` | Number of HTTP worker threads | No | 1 |
3555
3656## Running
3757
0 commit comments