Hi,

On 5/20/20 12:26 PM, zichen chuh wrote:
> {{ with query "time()" }}{{ . | first | value }}{{ end}}
> 
> This expression is exactly what I need. 
> And I wanna learn how to assemble such an expression. After searching
> through this document template <https://golang.org/pkg/text/template/> ,
> still no clue about these in the expression you wrote: query, first,
> value. Could you give me an advice?

You already got the base for the template syntax (golang.org) and some
very specific documentation about the alert data structures and their
methods.

You might be missing the part in-between, i.e. the documentation which
describes Prometheus-providede helper functions:
https://prometheus.io/docs/prometheus/latest/configuration/template_reference/

The example section right next to it is also helpful:
https://prometheus.io/docs/prometheus/latest/configuration/template_examples/


Kind regards,
Christian

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/2c22692b-b036-59a2-0d6c-29dfc0ab09df%40hoffmann-christian.info.

Reply via email to