MCPcopy Create free account
hub / github.com/cortexproject/cortex / NewRunner

Function NewRunner

pkg/testexporter/correctness/runner.go:82–111  ·  view source on GitHub ↗

NewRunner makes a new Runner.

(cfg RunnerConfig)

Source from the content-addressed store, hash-verified

80
81// NewRunner makes a new Runner.
82func NewRunner(cfg RunnerConfig) (*Runner, error) {
83 apiCfg := api.Config{
84 Address: cfg.PrometheusAddr,
85 }
86 if cfg.UserID != "" {
87 apiCfg.RoundTripper = &nethttp.Transport{
88 RoundTripper: promhttp.RoundTripperFunc(func(req *http.Request) (*http.Response, error) {
89 _ = user.InjectOrgIDIntoHTTPRequest(user.InjectOrgID(context.Background(), cfg.UserID), req)
90 return api.DefaultRoundTripper.RoundTrip(req)
91 }),
92 }
93 } else {
94 apiCfg.RoundTripper = &nethttp.Transport{}
95 }
96
97 client, err := api.NewClient(apiCfg)
98 if err != nil {
99 return nil, err
100 }
101
102 tc := &Runner{
103 cfg: cfg,
104 quit: make(chan struct{}),
105 client: v1.NewAPI(tracingClient{client}),
106 }
107
108 tc.wg.Add(1)
109 go tc.verifyLoop()
110 return tc, nil
111}
112
113type tracingClient struct {
114 api.Client

Callers 1

mainFunction · 0.92

Calls 3

verifyLoopMethod · 0.95
RoundTripMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected