()
| 67 | } |
| 68 | |
| 69 | func (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 | |
| 86 | var _ FloatGetter = (*Prometheus)(nil) |
| 87 |
no test coverage detected