diff --git a/src/PromQL.Parser/Printer.cs b/src/PromQL.Parser/Printer.cs index 1e3d4ca..d172c3c 100644 --- a/src/PromQL.Parser/Printer.cs +++ b/src/PromQL.Parser/Printer.cs @@ -173,7 +173,7 @@ public virtual void Visit(VectorMatching vm) _sb.Append(vm.MatchCardinality.ToPromQl()); } - if (vm.Include.Length > 0) + if (vm.Include.Length > 0 || vm.MatchCardinality != VectorMatching.DefaultMatchCardinality) { if (_sb.Length > 0) _sb.Append(" "); diff --git a/tests/PromQL.Parser.Tests/PrinterTests.cs b/tests/PromQL.Parser.Tests/PrinterTests.cs index 8d8927e..72d932a 100644 --- a/tests/PromQL.Parser.Tests/PrinterTests.cs +++ b/tests/PromQL.Parser.Tests/PrinterTests.cs @@ -136,7 +136,7 @@ public void VectorMatching_GroupRight_NoLabels_ToPromQl() false, ImmutableArray.Empty, false - )).Should().Be("group_right"); + )).Should().Be("group_right ()"); } [Test]