@@ -21,21 +21,19 @@ import (
2121 "github.com/grafana/loki/v3/clients/pkg/promtail/utils"
2222
2323 "github.com/grafana/alloy/internal/component/common/loki"
24-
25- "github.com/grafana/loki/v3/pkg/logproto"
2624)
2725
2826var logEntries = []loki.Entry {
29- {Labels : model.LabelSet {}, Entry : logproto .Entry {Timestamp : time .Unix (1 , 0 ).UTC (), Line : "line1" }},
30- {Labels : model.LabelSet {}, Entry : logproto .Entry {Timestamp : time .Unix (2 , 0 ).UTC (), Line : "line2" }},
31- {Labels : model.LabelSet {}, Entry : logproto .Entry {Timestamp : time .Unix (3 , 0 ).UTC (), Line : "line3" }},
32- {Labels : model.LabelSet {"__tenant_id__" : "tenant-1" }, Entry : logproto .Entry {Timestamp : time .Unix (4 , 0 ).UTC (), Line : "line4" }},
33- {Labels : model.LabelSet {"__tenant_id__" : "tenant-1" }, Entry : logproto .Entry {Timestamp : time .Unix (5 , 0 ).UTC (), Line : "line5" }},
34- {Labels : model.LabelSet {"__tenant_id__" : "tenant-2" }, Entry : logproto .Entry {Timestamp : time .Unix (6 , 0 ).UTC (), Line : "line6" }},
35- {Labels : model.LabelSet {}, Entry : logproto .Entry {Timestamp : time .Unix (6 , 0 ).UTC (), Line : "line0123456789" }},
27+ {Labels : model.LabelSet {}, Entry : push .Entry {Timestamp : time .Unix (1 , 0 ).UTC (), Line : "line1" }},
28+ {Labels : model.LabelSet {}, Entry : push .Entry {Timestamp : time .Unix (2 , 0 ).UTC (), Line : "line2" }},
29+ {Labels : model.LabelSet {}, Entry : push .Entry {Timestamp : time .Unix (3 , 0 ).UTC (), Line : "line3" }},
30+ {Labels : model.LabelSet {"__tenant_id__" : "tenant-1" }, Entry : push .Entry {Timestamp : time .Unix (4 , 0 ).UTC (), Line : "line4" }},
31+ {Labels : model.LabelSet {"__tenant_id__" : "tenant-1" }, Entry : push .Entry {Timestamp : time .Unix (5 , 0 ).UTC (), Line : "line5" }},
32+ {Labels : model.LabelSet {"__tenant_id__" : "tenant-2" }, Entry : push .Entry {Timestamp : time .Unix (6 , 0 ).UTC (), Line : "line6" }},
33+ {Labels : model.LabelSet {}, Entry : push .Entry {Timestamp : time .Unix (6 , 0 ).UTC (), Line : "line0123456789" }},
3634 {
3735 Labels : model.LabelSet {},
38- Entry : logproto .Entry {
36+ Entry : push .Entry {
3937 Timestamp : time .Unix (7 , 0 ).UTC (),
4038 Line : "line7" ,
4139 StructuredMetadata : push.LabelsAdapter {
@@ -67,11 +65,11 @@ func TestClient_Handle(t *testing.T) {
6765 expectedReqs : []utils.RemoteWriteRequest {
6866 {
6967 TenantID : "" ,
70- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [0 ].Entry , logEntries [1 ].Entry }}}},
68+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [0 ].Entry , logEntries [1 ].Entry }}}},
7169 },
7270 {
7371 TenantID : "" ,
74- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [2 ].Entry }}}},
72+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [2 ].Entry }}}},
7573 },
7674 },
7775 expectedMetrics : `
@@ -108,11 +106,11 @@ func TestClient_Handle(t *testing.T) {
108106 expectedReqs : []utils.RemoteWriteRequest {
109107 {
110108 TenantID : "" ,
111- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [0 ].Entry }}}},
109+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [0 ].Entry }}}},
112110 },
113111 {
114112 TenantID : "" ,
115- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [1 ].Entry }}}},
113+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [1 ].Entry }}}},
116114 },
117115 },
118116 expectedMetrics : `
@@ -148,15 +146,15 @@ func TestClient_Handle(t *testing.T) {
148146 expectedReqs : []utils.RemoteWriteRequest {
149147 {
150148 TenantID : "" ,
151- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [0 ].Entry }}}},
149+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [0 ].Entry }}}},
152150 },
153151 {
154152 TenantID : "" ,
155- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [0 ].Entry }}}},
153+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [0 ].Entry }}}},
156154 },
157155 {
158156 TenantID : "" ,
159- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [0 ].Entry }}}},
157+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [0 ].Entry }}}},
160158 },
161159 },
162160 expectedMetrics : `
@@ -192,7 +190,7 @@ func TestClient_Handle(t *testing.T) {
192190 expectedReqs : []utils.RemoteWriteRequest {
193191 {
194192 TenantID : "" ,
195- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [0 ].Entry }}}},
193+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [0 ].Entry }}}},
196194 },
197195 },
198196 expectedMetrics : `
@@ -228,15 +226,15 @@ func TestClient_Handle(t *testing.T) {
228226 expectedReqs : []utils.RemoteWriteRequest {
229227 {
230228 TenantID : "" ,
231- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [0 ].Entry }}}},
229+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [0 ].Entry }}}},
232230 },
233231 {
234232 TenantID : "" ,
235- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [0 ].Entry }}}},
233+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [0 ].Entry }}}},
236234 },
237235 {
238236 TenantID : "" ,
239- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [0 ].Entry }}}},
237+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [0 ].Entry }}}},
240238 },
241239 },
242240 expectedMetrics : `
@@ -273,7 +271,7 @@ func TestClient_Handle(t *testing.T) {
273271 expectedReqs : []utils.RemoteWriteRequest {
274272 {
275273 TenantID : "" ,
276- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [0 ].Entry }}}},
274+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [0 ].Entry }}}},
277275 },
278276 },
279277 expectedMetrics : `
@@ -310,7 +308,7 @@ func TestClient_Handle(t *testing.T) {
310308 expectedReqs : []utils.RemoteWriteRequest {
311309 {
312310 TenantID : "tenant-default" ,
313- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [0 ].Entry , logEntries [1 ].Entry }}}},
311+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [0 ].Entry , logEntries [1 ].Entry }}}},
314312 },
315313 },
316314 expectedMetrics : `
@@ -347,15 +345,15 @@ func TestClient_Handle(t *testing.T) {
347345 expectedReqs : []utils.RemoteWriteRequest {
348346 {
349347 TenantID : "tenant-default" ,
350- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [0 ].Entry }}}},
348+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [0 ].Entry }}}},
351349 },
352350 {
353351 TenantID : "tenant-1" ,
354- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [3 ].Entry , logEntries [4 ].Entry }}}},
352+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [3 ].Entry , logEntries [4 ].Entry }}}},
355353 },
356354 {
357355 TenantID : "tenant-2" ,
358- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [5 ].Entry }}}},
356+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [5 ].Entry }}}},
359357 },
360358 },
361359 expectedMetrics : `
@@ -505,11 +503,11 @@ func TestClient_StopNow(t *testing.T) {
505503 expectedReqs : []utils.RemoteWriteRequest {
506504 {
507505 TenantID : "" ,
508- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [0 ].Entry , logEntries [1 ].Entry }}}},
506+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [0 ].Entry , logEntries [1 ].Entry }}}},
509507 },
510508 {
511509 TenantID : "" ,
512- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [2 ].Entry }}}},
510+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [2 ].Entry }}}},
513511 },
514512 },
515513 expectedMetrics : `
@@ -534,7 +532,7 @@ func TestClient_StopNow(t *testing.T) {
534532 expectedReqs : []utils.RemoteWriteRequest {
535533 {
536534 TenantID : "" ,
537- Request : logproto .PushRequest {Streams : []logproto .Stream {{Labels : "{}" , Entries : []logproto .Entry {logEntries [0 ].Entry }}}},
535+ Request : push .PushRequest {Streams : []push .Stream {{Labels : "{}" , Entries : []push .Entry {logEntries [0 ].Entry }}}},
538536 },
539537 },
540538 expectedMetrics : `
0 commit comments