MCPcopy Create free account
hub / github.com/evcc-io/evcc / Query

Method Query

plugin/prometheus.go:69–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

67}
68
69func (p *Prometheus) Query() (model.Value, error) {
70 ctx, cancel := context.WithTimeout(context.Background(), p.timeout)
71 defer cancel()
72
73 res, warn, err := p.api.Query(ctx, p.query, time.Now())
74 if err != nil {
75 return nil, err
76 }
77
78 p.log.TRACE.Printf("query %q: %+v", p.query, res)
79 if len(warn) > 0 {
80 p.log.WARN.Printf("query %q returned warnings: %v", p.query, warn)
81 }
82
83 return res, nil
84}
85
86var _ FloatGetter = (*Prometheus)(nil)
87

Callers 15

FloatGetterMethod · 0.95
NewTibberFromConfigFunction · 0.80
getDevicesFunction · 0.80
HomesMethod · 0.80
energyProfileFunction · 0.80
NewNtfyFromConfigFunction · 0.80
runMethod · 0.80
ActiveAgreementMethod · 0.80
AccountNumberMethod · 0.80
TariffCodeMethod · 0.80
tokenExchangeHandlerFunction · 0.80
energyHistoryHandlerFunction · 0.80

Calls 1

PrintfMethod · 0.80

Tested by

no test coverage detected