generated from steadybit/extension-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
58 lines (47 loc) · 1.63 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* Copyright 2023 steadybit GmbH. All rights reserved.
*/
package main
import (
_ "github.com/KimMachineGun/automemlimit" // By default, it sets `GOMEMLIMIT` to 90% of cgroup's memory limit.
"github.com/rs/zerolog"
"github.com/steadybit/action-kit/go/action_kit_api/v2"
"github.com/steadybit/action-kit/go/action_kit_sdk"
"github.com/steadybit/extension-k6/config"
"github.com/steadybit/extension-k6/extk6"
"github.com/steadybit/extension-kit/extbuild"
"github.com/steadybit/extension-kit/exthealth"
"github.com/steadybit/extension-kit/exthttp"
"github.com/steadybit/extension-kit/extlogging"
"github.com/steadybit/extension-kit/extruntime"
_ "go.uber.org/automaxprocs" // Importing automaxprocs automatically adjusts GOMAXPROCS.
_ "net/http/pprof" //allow pprof
)
func main() {
extlogging.InitZeroLog()
extbuild.PrintBuildInformation()
extruntime.LogRuntimeInformation(zerolog.DebugLevel)
exthealth.SetReady(false)
exthealth.StartProbes(8088)
config.ParseConfiguration()
config.ValidateConfiguration()
exthttp.RegisterHttpHandler("/", exthttp.GetterAsHandler(getExtensionList))
action_kit_sdk.RegisterAction(extk6.NewK6LoadTestRunAction())
if config.Config.CloudApiToken != "" {
action_kit_sdk.RegisterAction(extk6.NewK6LoadTestCloudAction())
}
action_kit_sdk.InstallSignalHandler()
action_kit_sdk.RegisterCoverageEndpoints()
exthealth.SetReady(true)
exthttp.Listen(exthttp.ListenOpts{
Port: 8087,
})
}
type ExtensionListResponse struct {
action_kit_api.ActionList `json:",inline"`
}
func getExtensionList() ExtensionListResponse {
return ExtensionListResponse{
ActionList: action_kit_sdk.GetActionList(),
}
}