MCPcopy Index your code
hub / github.com/cortexproject/cortex / Start

Method Start

tools/querytee/instrumentation.go:31–52  ·  view source on GitHub ↗

Start the instrumentation server.

()

Source from the content-addressed store, hash-verified

29
30// Start the instrumentation server.
31func (s *InstrumentationServer) Start() error {
32 // Setup listener first, so we can fail early if the port is in use.
33 listener, err := net.Listen("tcp", fmt.Sprintf(":%d", s.port))
34 if err != nil {
35 return err
36 }
37
38 router := mux.NewRouter()
39 router.Handle("/metrics", promhttp.HandlerFor(s.registry, promhttp.HandlerOpts{}))
40
41 s.srv = &http.Server{
42 Handler: router,
43 }
44
45 go func() {
46 if err := s.srv.Serve(listener); err != nil {
47 level.Error(util_log.Logger).Log("msg", "metrics server terminated", "err", err)
48 }
49 }()
50
51 return nil
52}
53
54// Stop closes the instrumentation server.
55func (s *InstrumentationServer) Stop() {

Callers 1

mainFunction · 0.95

Calls 3

HandleMethod · 0.65
LogMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected