Skip to content

Commit

Permalink
feat: use signal handler mechanism from extension-kit
Browse files Browse the repository at this point in the history
  • Loading branch information
ReuDa committed Nov 12, 2024
1 parent 5e160b0 commit 7358257
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ require (
github.com/rs/zerolog v1.33.0
github.com/sosodev/duration v1.3.1
github.com/steadybit/action-kit/go/action_kit_api/v2 v2.9.4
github.com/steadybit/action-kit/go/action_kit_sdk v1.1.12
github.com/steadybit/action-kit/go/action_kit_sdk v1.1.14
github.com/steadybit/action-kit/go/action_kit_test v1.3.0
github.com/steadybit/discovery-kit/go/discovery_kit_api v1.6.0
github.com/steadybit/discovery-kit/go/discovery_kit_commons v0.2.0
github.com/steadybit/discovery-kit/go/discovery_kit_sdk v1.2.1
github.com/steadybit/discovery-kit/go/discovery_kit_test v1.1.2
github.com/steadybit/extension-kit v1.8.19
github.com/steadybit/extension-kit v1.8.22
github.com/stretchr/testify v1.9.0
github.com/testcontainers/testcontainers-go v0.34.0
github.com/testcontainers/testcontainers-go/modules/localstack v0.34.0
Expand Down Expand Up @@ -67,7 +67,7 @@ require (
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/docker v27.1.1+incompatible // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/elastic/go-sysinfo v1.14.2 // indirect
github.com/elastic/go-sysinfo v1.15.0 // indirect
github.com/elastic/go-windows v1.0.2 // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
Expand Down Expand Up @@ -141,7 +141,7 @@ require (
golang.org/x/net v0.30.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.7.0 // indirect
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj
github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/elastic/go-sysinfo v1.14.2 h1:DeIy+pVfdRsd08Nx2Xjh+dUS+jrEEI7LGc29U/BKVWo=
github.com/elastic/go-sysinfo v1.14.2/go.mod h1:jPSuTgXG+dhhh0GKIyI2Cso+w5lPJ5PvVqKlL8LV/Hk=
github.com/elastic/go-sysinfo v1.15.0 h1:54pRFlAYUlVNQ2HbXzLVZlV+fxS7Eax49stzg95M4Xw=
github.com/elastic/go-sysinfo v1.15.0/go.mod h1:jPSuTgXG+dhhh0GKIyI2Cso+w5lPJ5PvVqKlL8LV/Hk=
github.com/elastic/go-windows v1.0.2 h1:yoLLsAsV5cfg9FLhZ9EXZ2n2sQFKeDYrHenkcivY4vI=
github.com/elastic/go-windows v1.0.2/go.mod h1:bGcDpBzXgYSqM0Gx3DM4+UxFj300SZLixie9u9ixLM8=
github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU=
Expand Down Expand Up @@ -282,8 +282,8 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0=
github.com/steadybit/action-kit/go/action_kit_api/v2 v2.9.4 h1:imlfn0m5FEwZ3/ad75TgI5DoGQD4ztnSoLfPR4afqUY=
github.com/steadybit/action-kit/go/action_kit_api/v2 v2.9.4/go.mod h1:ycF2RLgRsB8I/jD52aE+dKZKVru1GIEtmkcRcIR3vXk=
github.com/steadybit/action-kit/go/action_kit_sdk v1.1.12 h1:qHgEHBbp83QxVoS9UuBc9EDbBkAyF8UWhDG0/VwoYYQ=
github.com/steadybit/action-kit/go/action_kit_sdk v1.1.12/go.mod h1:D8eHLbT+C797myIwacybsz0bqDfS1ShpIzjr+eSweX0=
github.com/steadybit/action-kit/go/action_kit_sdk v1.1.14 h1:x94RX+vh9Iyc0tS6BhiSpvknj+xE36AV0Nc3D5Yuub0=
github.com/steadybit/action-kit/go/action_kit_sdk v1.1.14/go.mod h1:Tp/klK5b7k+BCvb3JTSDZSNcnpFBaHauhndzOarnMW4=
github.com/steadybit/action-kit/go/action_kit_test v1.3.0 h1:PZ8BfKQyFlFmbOcrp0PKHjHFT3S8y3mOBTGo/mGQcAE=
github.com/steadybit/action-kit/go/action_kit_test v1.3.0/go.mod h1:R4L0LaZ60cE/pUOOrl3FoFgXNF1jT1tfQOWqJRdszbg=
github.com/steadybit/discovery-kit/go/discovery_kit_api v1.6.0 h1:q24S067wJ7uUZsi9LcccDJIEdsk9Ikss15hbqAt/OuE=
Expand All @@ -294,8 +294,8 @@ github.com/steadybit/discovery-kit/go/discovery_kit_sdk v1.2.1 h1:M2OX0sMGE+CnSB
github.com/steadybit/discovery-kit/go/discovery_kit_sdk v1.2.1/go.mod h1:dEJgg7BcW0E8pGMjpqtDU7m0lN6d38ievgFEUG39cxE=
github.com/steadybit/discovery-kit/go/discovery_kit_test v1.1.2 h1:IrTUwb69FDwOt/8OvY1Lvhv+qGNmy+Eu53HEjmsj0TA=
github.com/steadybit/discovery-kit/go/discovery_kit_test v1.1.2/go.mod h1:tr4oRjpqr2WOKwO4auJR+/m+YKA2EAUuvvpbz1faUxw=
github.com/steadybit/extension-kit v1.8.19 h1:D+H8sV8zsHYl1NtxCxBl+hiUT8ndWmIZ35Td9RnlmS8=
github.com/steadybit/extension-kit v1.8.19/go.mod h1:fPu9AA1yA92VTZCOT+JE5EEAiTFgnb8Sfut5sKloeo0=
github.com/steadybit/extension-kit v1.8.22 h1:rowDG0kBeTQi+lB9vGxi08HH6E+dEJ8vLjyKYREh9Bs=
github.com/steadybit/extension-kit v1.8.22/go.mod h1:Ym+tCgtMCcTw7iv/aPwB64E4/2WT8gsfYUIyb3kx+9g=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand Down Expand Up @@ -388,8 +388,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
10 changes: 8 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/steadybit/extension-kit/exthttp"
"github.com/steadybit/extension-kit/extlogging"
"github.com/steadybit/extension-kit/extruntime"
"github.com/steadybit/extension-kit/extsignals"
_ "go.uber.org/automaxprocs" // Importing automaxprocs automatically adjusts GOMAXPROCS.
_ "net/http/pprof" //allow pprof
"os"
Expand All @@ -49,9 +50,14 @@ func main() {

registerHandlers(ctx)

action_kit_sdk.InstallSignalHandler(func(o os.Signal) {
cancel()
extsignals.AddSignalHandler(extsignals.SignalHandler{
Handler: func(signal os.Signal) {
cancel()
},
Order: extsignals.OrderStopCustom,
Name: "custom-extension-aws",
})
extsignals.ActivateSignalHandlers()

action_kit_sdk.RegisterCoverageEndpoints()
exthealth.SetReady(true)
Expand Down

0 comments on commit 7358257

Please sign in to comment.