Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit81c4072

Browse files
committed
feat: healthcheck & worker refactor
feat: healthcheck & worker refactor
1 parenteb261a8 commit81c4072

File tree

41 files changed

+2034
-200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2034
-200
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ Check the services are running:
173173
curl$OUTPOST_URL/api/v1/healthz
174174
```
175175
176-
Wait until you get a`OK%` response.
176+
Wait until you get a200 response.
177177

178178
Create a tenant with the following command, replacing`$TENANT_ID` with a unique identifier such as "your_org_name", and the`$API_KEY` with the value you set in your`.env`:
179179

‎cmd/e2e/api_test.go‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ func (suite *basicSuite) TestHealthzAPI() {
2323
Match:&httpclient.Response{
2424
StatusCode:http.StatusOK,
2525
},
26+
Validate:map[string]interface{}{
27+
"type":"object",
28+
"properties":map[string]interface{}{
29+
"status":map[string]interface{}{
30+
"type":"string",
31+
},
32+
"timestamp":map[string]interface{}{
33+
"type":"string",
34+
},
35+
"workers":map[string]interface{}{
36+
"type":"object",
37+
},
38+
},
39+
},
2640
},
2741
},
2842
}

‎cmd/e2e/suites_test.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,17 @@ type e2eSuite struct {
3030
mockServerInfra*testinfra.MockServerInfra
3131
cleanupfunc()
3232
client httpclient.Client
33+
appDonechanstruct{}
3334
}
3435

3536
func (suite*e2eSuite)SetupSuite() {
3637
ctx,cancel:=context.WithCancel(context.Background())
3738
suite.ctx=ctx
3839
suite.cancel=cancel
40+
suite.appDone=make(chanstruct{})
3941
suite.client=httpclient.New(fmt.Sprintf("http://localhost:%d/api/v1",suite.config.APIPort),suite.config.APIKey)
4042
gofunc() {
43+
deferclose(suite.appDone)
4144
application:=app.New(&suite.config)
4245
iferr:=application.Run(suite.ctx);err!=nil {
4346
log.Println("Application failed to run",err)
@@ -48,6 +51,8 @@ func (suite *e2eSuite) SetupSuite() {
4851
func (s*e2eSuite)TearDownSuite() {
4952
ifs.cancel!=nil {
5053
s.cancel()
54+
// Wait for application to fully shut down before cleaning up resources
55+
<-s.appDone
5156
}
5257
s.cleanup()
5358
}

‎docs/apis/openapi.yaml‎

Lines changed: 89 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,17 +1686,101 @@ paths:
16861686
get:
16871687
tags:[Health]
16881688
summary:Health Check
1689-
description:Simple health check endpoint.
1689+
description:|
1690+
Health check endpoint that reports the status of all workers.
1691+
1692+
Returns HTTP 200 when all workers are healthy, or HTTP 503 if any worker has failed.
1693+
1694+
The response includes:
1695+
- `status`: Overall health status ("healthy" or "failed")
1696+
- `timestamp`: When this health check was performed (ISO 8601 format)
1697+
- `workers`: Map of worker names to their individual health status
1698+
1699+
Each worker reports:
1700+
- `status`: Worker health ("healthy" or "failed")
1701+
1702+
Note: Error details are not exposed for security reasons. Check application logs for detailed error information.
16901703
operationId:healthCheck
16911704
security:[]
16921705
responses:
16931706
"200":
1694-
description:Service is healthy.
1707+
description:Service is healthy - all workers are operational.
16951708
content:
1696-
text/plain:
1709+
application/json:
1710+
schema:
1711+
type:object
1712+
required:
1713+
-status
1714+
-timestamp
1715+
-workers
1716+
properties:
1717+
status:
1718+
type:string
1719+
enum:[healthy]
1720+
example:healthy
1721+
timestamp:
1722+
type:string
1723+
format:date-time
1724+
description:When this health check was performed
1725+
example:"2025-11-11T10:30:00Z"
1726+
workers:
1727+
type:object
1728+
additionalProperties:
1729+
type:object
1730+
required:
1731+
-status
1732+
properties:
1733+
status:
1734+
type:string
1735+
enum:[healthy]
1736+
example:healthy
1737+
example:
1738+
status:healthy
1739+
timestamp:"2025-11-11T10:30:00Z"
1740+
workers:
1741+
http-server:
1742+
status:healthy
1743+
retrymq-consumer:
1744+
status:healthy
1745+
"503":
1746+
description:Service is unhealthy - one or more workers have failed.
1747+
content:
1748+
application/json:
16971749
schema:
1698-
type:string
1699-
example:OK
1750+
type:object
1751+
required:
1752+
-status
1753+
-timestamp
1754+
-workers
1755+
properties:
1756+
status:
1757+
type:string
1758+
enum:[failed]
1759+
example:failed
1760+
timestamp:
1761+
type:string
1762+
format:date-time
1763+
description:When this health check was performed
1764+
example:"2025-11-11T10:30:15Z"
1765+
workers:
1766+
type:object
1767+
additionalProperties:
1768+
type:object
1769+
required:
1770+
-status
1771+
properties:
1772+
status:
1773+
type:string
1774+
enum:[healthy, failed]
1775+
example:failed
1776+
example:
1777+
status:failed
1778+
timestamp:"2025-11-11T10:30:15Z"
1779+
workers:
1780+
http-server:
1781+
status:healthy
1782+
retrymq-consumer:
1783+
status:failed
17001784
# Tenants
17011785
/{tenant_id}:
17021786
parameters:

‎internal/services/api/auth_middleware.go‎renamed to ‎internal/apirouter/auth_middleware.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
packageapi
1+
packageapirouter
22

33
import (
44
"errors"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp