Skip to content

Commit

Permalink
feat: adding health checks
Browse files Browse the repository at this point in the history
Signed-off-by: mohamedasifs123 <[email protected]>
  • Loading branch information
mohamedasifs123 committed Dec 19, 2024
1 parent 0761239 commit 32c2f20
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
15 changes: 14 additions & 1 deletion config/demo-trace/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,18 @@ func main() {
}
span.End()
time.Sleep(5 * time.Second)
}
// Health check endpoint
http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
fmt.Fprintln(w, "OK")
})

// Application logic
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello, World!")
})

// Start server
http.ListenAndServe(":57400", nil)
}
}
13 changes: 12 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ services:
- spdk
networks:
- opi
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:57400/health
interval: 10s
timeout: 10s
retries: 5


jaeger-all-in-one:
image: jaegertracing/all-in-one:latest
Expand All @@ -169,7 +175,12 @@ services:
- "14250"
networks:
- opi

healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:16686 || exit 1
interval: 6s
timeout: 10s
retries: 5

volumes:
influxdb-storage:

Expand Down

0 comments on commit 32c2f20

Please sign in to comment.