• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

blind-oracle / cortex-tenant / 14759730518

30 Apr 2025 04:28PM UTC coverage: 68.056%. Remained the same
14759730518

Pull #87

github

seapasulli
update schema validation to include annotations
Pull Request #87: Expose annotations for service

245 of 360 relevant lines covered (68.06%)

4.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/main.go
1
package main
2

3
import (
4
        "encoding/json"
5
        "flag"
6
        "os"
7
        "os/signal"
8
        "syscall"
9

10
        "net/http"
11
        _ "net/http/pprof"
12

13
        "github.com/prometheus/client_golang/prometheus/promhttp"
14
        log "github.com/sirupsen/logrus"
15
)
16

17
var (
18
        Version string
19
)
20

21
func main() {
×
22
        cfgFile := flag.String("config", "", "Path to a config file")
×
23
        flag.Parse()
×
24

×
25
        cfg, err := configLoad(*cfgFile)
×
26
        if err != nil {
×
27
                log.Fatal(err)
×
28
        }
×
29

30
        if cfg.ListenPprof != "" {
×
31
                go func() {
×
32
                        if err := http.ListenAndServe(cfg.ListenPprof, nil); err != nil {
×
33
                                log.Fatalf("Unable to listen on %s: %s", cfg.ListenPprof, err)
×
34
                        }
×
35
                }()
36
        }
37

38
        go func() {
×
39
                http.Handle("/metrics", promhttp.Handler())
×
40
                if err := http.ListenAndServe(cfg.ListenMetricsAddress, nil); err != nil {
×
41
                        log.Fatalf("Unable to listen on %s: %s", cfg.ListenMetricsAddress, err)
×
42
                }
×
43
        }()
44

45
        lvl, err := log.ParseLevel(cfg.LogLevel)
×
46
        if err != nil {
×
47
                log.Fatalf("Unable to parse log level: %s", err)
×
48
        }
×
49

50
        log.SetLevel(lvl)
×
51

×
52
        cfgJSON, _ := json.Marshal(cfg)
×
53
        log.Warnf("Effective config: %+v", string(cfgJSON))
×
54

×
55
        proc := newProcessor(*cfg)
×
56

×
57
        if err = proc.run(); err != nil {
×
58
                log.Fatalf("Unable to start: %s", err)
×
59
        }
×
60

61
        log.Warnf("Listening on %s, sending to %s", cfg.Listen, cfg.Target)
×
62
        log.Warnf("Started v%s", Version)
×
63

×
64
        ch := make(chan os.Signal, 1)
×
65
        signal.Notify(ch, syscall.SIGTERM, os.Interrupt)
×
66
        <-ch
×
67

×
68
        log.Warn("Shutting down, draining requests")
×
69
        if err = proc.close(); err != nil {
×
70
                log.Errorf("Error during shutdown: %s", err)
×
71
        }
×
72

73
        log.Warnf("Finished")
×
74
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc