You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"2019-05-07T18:57:50.904275087+00:00 stdout F some full line",
103
-
"2019-05-07T18:57:55.904275087+00:00 stdout F log",
108
+
entries: []testEntry{
109
+
{line: "2019-05-07T18:57:50.904275087+00:00 stdout F some full line", labels: model.LabelSet{"foo": "bar"}},
110
+
{line: "2019-05-07T18:57:55.904275087+00:00 stdout F log", labels: model.LabelSet{"foo": "bar"}},
104
111
},
105
112
expected: []string{"some full line", "log"},
106
113
},
107
114
{
108
-
name: "tag P",
109
-
lines: []string{
110
-
"2019-05-07T18:57:50.904275087+00:00 stdout P partial line 1 ",
111
-
"2019-05-07T18:57:50.904275087+00:00 stdout P partial line 2 ",
112
-
"2019-05-07T18:57:55.904275087+00:00 stdout F log finished",
113
-
"2019-05-07T18:57:55.904275087+00:00 stdout F another full log",
115
+
name: "tag P multi-stream",
116
+
entries: []testEntry{
117
+
{line: "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 1 ", labels: model.LabelSet{"foo": "bar"}},
118
+
{line: "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 2 ", labels: model.LabelSet{"foo": "bar2"}},
119
+
{line: "2019-05-07T18:57:55.904275087+00:00 stdout F log finished", labels: model.LabelSet{"foo": "bar"}},
120
+
{line: "2019-05-07T18:57:55.904275087+00:00 stdout F another full log", labels: model.LabelSet{"foo": "bar2"}},
121
+
},
122
+
expected: []string{
123
+
"partial line 1 log finished", // belongs to stream `{foo="bar"}`
124
+
"partial line 2 another full log", // belongs to stream `{foo="bar2"}
125
+
},
126
+
},
127
+
{
128
+
name: "tag P multi-stream with maxPartialLines exceeded",
129
+
entries: []testEntry{
130
+
{line: "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 1 ", labels: model.LabelSet{"label1": "val1", "label2": "val2"}},
131
+
132
+
{line: "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 2 ", labels: model.LabelSet{"label1": "val1"}},
133
+
{line: "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 3 ", labels: model.LabelSet{"label1": "val1", "label2": "val2"}},
134
+
{line: "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 4 ", labels: model.LabelSet{"label1": "val3"}},
135
+
{line: "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 5 ", labels: model.LabelSet{"label1": "val4"}}, // exceeded maxPartialLines as already 3 streams in flight.
{line: "2019-05-07T18:57:55.904275087+00:00 stdout F another full log", labels: model.LabelSet{"label1": "val3"}},
138
+
{line: "2019-05-07T18:57:55.904275087+00:00 stdout F yet an another full log", labels: model.LabelSet{"label1": "val4"}},
114
139
},
140
+
maxPartialLines: 2,
115
141
expected: []string{
116
-
"partial line 1 partial line 2 log finished",
142
+
"partial line 1 partial line 3 ",
143
+
"partial line 2 ",
144
+
"partial line 4 ",
145
+
"log finished",
117
146
"another full log",
147
+
"partial line 5 yet an another full log",
118
148
},
119
149
},
120
150
{
121
-
name: "tag P exceeding MaxPartialLinesSize lines",
122
-
lines: []string{
123
-
"2019-05-07T18:57:50.904275087+00:00 stdout P partial line 1 ",
124
-
"2019-05-07T18:57:50.904275087+00:00 stdout P partial line 2 ",
125
-
"2019-05-07T18:57:50.904275087+00:00 stdout P partial line 3",
126
-
"2019-05-07T18:57:50.904275087+00:00 stdout P partial line 4 ", // this exceeds the `MaxPartialLinesSize` of 3
127
-
"2019-05-07T18:57:55.904275087+00:00 stdout F log finished",
128
-
"2019-05-07T18:57:55.904275087+00:00 stdout F another full log",
151
+
name: "tag P single stream",
152
+
entries: []testEntry{
153
+
{line: "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 1 ", labels: model.LabelSet{"foo": "bar"}},
154
+
{line: "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 2 ", labels: model.LabelSet{"foo": "bar"}},
155
+
{line: "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 3 ", labels: model.LabelSet{"foo": "bar"}},
156
+
{line: "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 4 ", labels: model.LabelSet{"foo": "bar"}}, // this exceeds the `MaxPartialLinesSize` of 3
157
+
{line: "2019-05-07T18:57:55.904275087+00:00 stdout F log finished", labels: model.LabelSet{"foo": "bar"}},
158
+
{line: "2019-05-07T18:57:55.904275087+00:00 stdout F another full log", labels: model.LabelSet{"foo": "bar"}},
129
159
},
130
160
maxPartialLines: 3,
131
161
expected: []string{
132
-
"partial line 1 partial line 2 partial line 3",
133
-
"partial line 4 log finished",
162
+
"partial line 1 partial line 2 partial line 3 partial line 4 log finished",
Copy file name to clipboardExpand all lines: clients/pkg/logentry/stages/pipeline.go
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -91,6 +91,25 @@ func RunWithSkip(input chan Entry, process func(e Entry) (Entry, bool)) chan Ent
91
91
returnout
92
92
}
93
93
94
+
// RunWithSkiporSendMany same as RunWithSkip, except it can either skip sending it to output channel, if `process` functions returns `skip` true. Or send many entries.
0 commit comments