diff --git a/pkg/loghttp/push/push.go b/pkg/loghttp/push/push.go index ad7dba5a64f90..01feefae67e88 100644 --- a/pkg/loghttp/push/push.go +++ b/pkg/loghttp/push/push.go @@ -264,9 +264,6 @@ func ParseLokiRequest(userID string, r *http.Request, tenantsRetention TenantsRe lb := labels.NewBuilder(lbs) lbs = lb.Set(LabelServiceName, serviceName).Labels() s.Labels = lbs.String() - - // Remove the added label after it's added to the stream so it's not consumed by subsequent steps - lbs = lb.Del(LabelServiceName).Labels() } if logPushRequestStreams { diff --git a/pkg/loghttp/push/push_test.go b/pkg/loghttp/push/push_test.go index b5609dec57a69..54618eb3480cc 100644 --- a/pkg/loghttp/push/push_test.go +++ b/pkg/loghttp/push/push_test.go @@ -221,7 +221,7 @@ func TestParseRequest(t *testing.T) { enableServiceDiscovery: true, expectedBytes: len("fizzbuzz"), expectedLines: 1, - expectedBytesUsageTracker: map[string]float64{`{foo="bar2", job="stuff"}`: float64(len("fizzbuss"))}, + expectedBytesUsageTracker: map[string]float64{`{foo="bar2", job="stuff", service_name="stuff"}`: float64(len("fizzbuss"))}, expectedLabels: labels.FromStrings("foo", "bar2", "job", "stuff", LabelServiceName, "stuff"), }, { @@ -232,7 +232,7 @@ func TestParseRequest(t *testing.T) { enableServiceDiscovery: true, expectedBytes: len("fizzbuzz"), expectedLines: 1, - expectedBytesUsageTracker: map[string]float64{`{foo="bar2"}`: float64(len("fizzbuss"))}, + expectedBytesUsageTracker: map[string]float64{`{foo="bar2", service_name="unknown_service"}`: float64(len("fizzbuss"))}, expectedLabels: labels.FromStrings("foo", "bar2", LabelServiceName, ServiceUnknown), }, {