Vydruth
Vydruth

Reputation: 133

Grafana Promql histogram quantile query issue

I am trying to plot the TP99 for all the models that do not start with the word "test".

So I created the following query:

histogram_quantile(0.99, 
    sum by (m_application)(
        rate( 
            model_execution_duration_seconds_percentile_bucket{
                m_account="test-account-number", kubernetes_cluster="cluster01", m_application!~"^(test).*", method="POST"
            }[5m]
        )
    ) 
    by (le, m_application)
)

I am certain that the inner query is correct which plots the rate for all the models that do not start with the pattern test* (has been verified).

The error I am receiving is "1:279: parse error: unexpected <by>". Not exactly sure what I should do to fix this issue. Could someone help me with this issue?

Upvotes: 0

Views: 1530

Answers (1)

Jens Baitinger
Jens Baitinger

Reputation: 2365

you have two by clauses in your query:

histogram_quantile(0.99, 
    sum by (m_application)(   <------------ here is the first
        rate( 
            model_execution_duration_seconds_percentile_bucket{
                m_account="test-account-number", kubernetes_cluster="cluster01", m_application!~"^(test).*", method="POST"
            }[5m]
        )
    ) 
    by (le, m_application)  <------------ here is the second
)

Please note, you also need to aggregate by le in order to calculate the histogram. So removing the first one will solve your problem.

Upvotes: 2

Related Questions