f-21: code: ajout d'un system de worker
All checks were successful
Pre Release Workflow / set-release-target (push) Successful in 1s
Pre Release Workflow / build (agent, amd64, linux) (push) Successful in 2m2s
Pre Release Workflow / build (db, amd64, linux) (push) Successful in 1m32s
Pre Release Workflow / build (dhcp, amd64, linux) (push) Successful in 1m32s
Pre Release Workflow / build (metadata, amd64, linux) (push) Successful in 1m33s
Pre Release Workflow / build (metacli, amd64, linux) (push) Successful in 1m40s
Pre Release Workflow / build (subnet, amd64, linux) (push) Successful in 1m37s
Pre Release Workflow / prerelease (push) Successful in 16s
Pre Release Workflow / build (vpc, amd64, linux) (push) Successful in 1m34s
Pre Release Workflow / upload-scripts (run-dnsmasq-in-netns.sh) (push) Successful in 7s
All checks were successful
Pre Release Workflow / set-release-target (push) Successful in 1s
Pre Release Workflow / build (agent, amd64, linux) (push) Successful in 2m2s
Pre Release Workflow / build (db, amd64, linux) (push) Successful in 1m32s
Pre Release Workflow / build (dhcp, amd64, linux) (push) Successful in 1m32s
Pre Release Workflow / build (metadata, amd64, linux) (push) Successful in 1m33s
Pre Release Workflow / build (metacli, amd64, linux) (push) Successful in 1m40s
Pre Release Workflow / build (subnet, amd64, linux) (push) Successful in 1m37s
Pre Release Workflow / prerelease (push) Successful in 16s
Pre Release Workflow / build (vpc, amd64, linux) (push) Successful in 1m34s
Pre Release Workflow / upload-scripts (run-dnsmasq-in-netns.sh) (push) Successful in 7s
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
e1f7676093
commit
53ca41e635
9 changed files with 87 additions and 14 deletions
|
|
@ -6,10 +6,11 @@ import (
|
|||
"log"
|
||||
|
||||
agentapi "git.g3e.fr/syonad/two/internal/api/agent"
|
||||
agentmetrics "git.g3e.fr/syonad/two/internal/prometheus/agent"
|
||||
configuration "git.g3e.fr/syonad/two/internal/config/agent"
|
||||
promserver "git.g3e.fr/syonad/two/pkg/prometheus"
|
||||
agentmetrics "git.g3e.fr/syonad/two/internal/prometheus/agent"
|
||||
"git.g3e.fr/syonad/two/pkg/db/kv"
|
||||
promserver "git.g3e.fr/syonad/two/pkg/prometheus"
|
||||
"git.g3e.fr/syonad/two/pkg/worker"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
|
|
@ -25,13 +26,16 @@ func main() {
|
|||
db := kv.InitDB(kv.Config{Path: cfg.Database.Path}, true)
|
||||
defer db.Close()
|
||||
|
||||
apiAddr := fmt.Sprintf("%s:%d", cfg.Api.Address, cfg.Api.Port)
|
||||
promAddr := fmt.Sprintf("%s:%d", cfg.Prometheus.Address, cfg.Prometheus.Port)
|
||||
q := worker.New(cfg.Worker.BufferSize)
|
||||
q.Start(cfg.Worker.Count)
|
||||
|
||||
registry := prometheus.NewRegistry()
|
||||
registry.MustRegister(agentmetrics.NewAgentCollector(db))
|
||||
|
||||
go agentapi.Start(apiAddr)
|
||||
apiAddr := fmt.Sprintf("%s:%d", cfg.Api.Address, cfg.Api.Port)
|
||||
promAddr := fmt.Sprintf("%s:%d", cfg.Prometheus.Address, cfg.Prometheus.Port)
|
||||
|
||||
go agentapi.New(q).Start(apiAddr)
|
||||
go promserver.Start(promAddr, registry)
|
||||
|
||||
select {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue