mirror of
https://github.com/JetSprow/J-Board-Lite.git
synced 2026-05-01 01:14:10 +05:30
Initial commit
This commit is contained in:
35
agent/jboard-agent/cmd/agent/main.go
Normal file
35
agent/jboard-agent/cmd/agent/main.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"runtime/debug"
|
||||
"syscall"
|
||||
|
||||
"github.com/jboard/jboard-agent/internal/config"
|
||||
"github.com/jboard/jboard-agent/internal/probe"
|
||||
)
|
||||
|
||||
const version = "2.3.0"
|
||||
|
||||
func main() {
|
||||
debug.SetGCPercent(50)
|
||||
|
||||
cfg := config.Load()
|
||||
log.Printf("[agent] jboard-agent v%s starting in probe-only mode — server=%s", version, cfg.ServerURL)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
go probe.LatencyLoop(ctx, cfg)
|
||||
go probe.TraceLoop(ctx, cfg)
|
||||
|
||||
sigCh := make(chan os.Signal, 1)
|
||||
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
|
||||
<-sigCh
|
||||
|
||||
log.Println("[agent] shutting down...")
|
||||
cancel()
|
||||
}
|
||||
Reference in New Issue
Block a user