Pyroscope: Fix template variable support (#84477)

This commit is contained in:
Andrej Ocenas
2024-03-18 14:25:47 +01:00
committed by GitHub
parent aac2cf0aa5
commit 5b085976bf
4 changed files with 37 additions and 18 deletions
@@ -256,6 +256,10 @@ func (c *PyroscopeClient) LabelNames(ctx context.Context, labelSelector string,
return nil, fmt.Errorf("error sending LabelNames request %v", err)
}
if resp.Msg.Names == nil {
return []string{}, nil
}
var filtered []string
for _, label := range resp.Msg.Names {
if !isPrivateLabel(label) {
@@ -281,6 +285,9 @@ func (c *PyroscopeClient) LabelValues(ctx context.Context, label string, labelSe
span.SetStatus(codes.Error, err.Error())
return nil, err
}
if resp.Msg.Names == nil {
return []string{}, nil
}
return resp.Msg.Names, nil
}