VSCode: Launch Grafana with Storage server (#88351)

* VSCode: Launch Grafana with Storage server

* Fix module_server_test
This commit is contained in:
Gabriel MABILLE
2024-05-29 10:02:35 +02:00
committed by GitHub
parent 1f90123f35
commit 5eecc01123
5 changed files with 24 additions and 10 deletions
+5 -3
View File
@@ -8,18 +8,20 @@ import (
"github.com/grafana/dskit/services"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/setting"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
type instrumentationService struct {
*services.BasicService
cfg *setting.Cfg
httpServ *http.Server
log log.Logger
errChan chan error
}
func NewInstrumentationService(log log.Logger) (*instrumentationService, error) {
s := &instrumentationService{log: log}
func NewInstrumentationService(log log.Logger, cfg *setting.Cfg) (*instrumentationService, error) {
s := &instrumentationService{log: log, cfg: cfg}
s.BasicService = services.NewBasicService(s.start, s.running, s.stop)
return s, nil
}
@@ -59,7 +61,7 @@ func (s *instrumentationService) newInstrumentationServer(ctx context.Context) *
srv := &http.Server{
// 5s timeout for header reads to avoid Slowloris attacks (https://thetooth.io/blog/slowloris-attack/)
ReadHeaderTimeout: 5 * time.Second,
Addr: ":3000", // TODO - make configurable?
Addr: ":" + s.cfg.HTTPPort,
Handler: router,
BaseContext: func(_ net.Listener) context.Context { return ctx },
}