Skip to content

Commit

Permalink
Minor tweaks to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
possibull committed Jan 15, 2025
1 parent 1631c8a commit 44ffaf9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,6 @@ func expandWithExpr(was []*withArgExpr, e Expr) (Expr, error) {
{
var me MetricExpr
// Populate me.LabelFilterss
// Check to see if name is set in the first labelFilter

for _, lfes := range t.labelFilterss {
var lfsNew []LabelFilter
Expand All @@ -846,6 +845,9 @@ func expandWithExpr(was []*withArgExpr, e Expr) (Expr, error) {
// Expand lfe.Label into lfsNew.
wa := getWithArgExpr(was, lfe.Label)
if wa == nil {
// Check to see if this is a possible metric name
// This means label name set and starts and ends with quotes
// but value is nil
if lfe.IsPossibleMetricName {
if metricName == "" {
metricName = lfe.Label
Expand Down Expand Up @@ -1415,9 +1417,9 @@ func (p *parser) parseLabelFilterExpr() (*labelFilterExpr, error) {
// - {lf or other="filter"}
//
// It must be substituted by complete label filter during WITH template expand.
// If we have a label name that is quoted it is possible it's the metric name as per
// Prometheus 3.0 UTF8 quoted label names specifications, this is used later in our
// expanding of the with statements
// If we have a label name that is quoted with a nil value it is possible it's the metric
// name as per Prometheus 3.0 UTF8 quoted label names specifications, this is used later
// in our expanding of the with statements
lfe.IsPossibleMetricName = isPossibleMetricName

return &lfe, nil
Expand Down

0 comments on commit 44ffaf9

Please sign in to comment.