@@ -195,6 +195,7 @@ type opt struct {
195195 scrapeInterval time.Duration
196196 customRegistry * prometheus.Registry
197197 customPromImage string
198+ useCadvisor bool
198199}
199200
200201// WithScrapeInterval changes how often metrics are scrape by Prometheus. 5s by default.
@@ -220,12 +221,21 @@ func WithPrometheusImage(image string) Option {
220221 }
221222}
222223
224+ func WithCadvisorDisabled () Option {
225+ return func (o * opt ) {
226+ o .useCadvisor = false
227+ }
228+ }
229+
223230type Option func (* opt )
224231
225232// Start deploys monitoring service which deploys Prometheus that monitors all
226233// InstrumentedRunnable instances in an environment created with AsInstrumented.
227234func Start (env e2e.Environment , opts ... Option ) (_ * Service , err error ) {
228- opt := opt {scrapeInterval : 5 * time .Second }
235+ opt := opt {
236+ scrapeInterval : 5 * time .Second ,
237+ useCadvisor : true ,
238+ }
229239 for _ , o := range opts {
230240 o (& opt )
231241 }
@@ -271,9 +281,14 @@ func Start(env e2e.Environment, opts ...Option) (_ *Service, err error) {
271281 }
272282 env .AddListener (l )
273283
274- c := newCadvisor (env , "cadvisor" )
275- if err := e2e .StartAndWaitReady (c , p ); err != nil {
276- return nil , errors .Wrap (err , "starting cadvisor and monitoring and waiting until ready" )
284+ if opt .useCadvisor {
285+ c := newCadvisor (env , "cadvisor" )
286+ if err := e2e .StartAndWaitReady (c ); err != nil {
287+ return nil , errors .Wrap (err , "starting cadvisor and waiting until ready" )
288+ }
289+ }
290+ if err := e2e .StartAndWaitReady (p ); err != nil {
291+ return nil , errors .Wrap (err , "starting monitoring and waiting until ready" )
277292 }
278293
279294 select {
0 commit comments