diff --git a/src/pkg/otelcolclient/otelcolclient.go b/src/pkg/otelcolclient/otelcolclient.go index 6b95fce59..30e87ae96 100644 --- a/src/pkg/otelcolclient/otelcolclient.go +++ b/src/pkg/otelcolclient/otelcolclient.go @@ -173,7 +173,7 @@ func attributes(e *loggregator_v2.Envelope) []*commonpb.KeyValue { } for k, v := range e.Tags { - if k == "instance_id" || k == "source_id" { + if k == "instance_id" || k == "source_id" || k == "__v1_type" { continue } diff --git a/src/pkg/otelcolclient/otelcolclient_test.go b/src/pkg/otelcolclient/otelcolclient_test.go index 20a3e256d..2e0a3c9e6 100644 --- a/src/pkg/otelcolclient/otelcolclient_test.go +++ b/src/pkg/otelcolclient/otelcolclient_test.go @@ -255,6 +255,20 @@ var _ = Describe("Client", func() { Expect(cmp.Diff(actualAtts, expectedAtts, protocmp.Transform(), sortFunc)).To(BeEmpty()) }) }) + + Context("when the envelope has been converted from a v1 representation", func() { + BeforeEach(func() { + envelope.Tags["__v1_type"] = "ValueMetric" + }) + + It("drops the __v1_type tag", func() { + var msr *colmetricspb.ExportMetricsServiceRequest + Expect(spyMSC.requests).To(Receive(&msr)) + + actualAtts := msr.GetResourceMetrics()[0].GetScopeMetrics()[0].GetMetrics()[0].GetGauge().GetDataPoints()[0].GetAttributes() + Expect(actualAtts).ToNot(ContainElement(HaveField("Key", "__v1_type"))) + }) + }) }) Context("when given a counter", func() {