diff --git a/CHANGELOG.md b/CHANGELOG.md index c960c2bccc62..8a6941a29d34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,8 @@ Main (unreleased) - Fixed a bug in River where passing a non-string key to an object (such as `{}[true]`) would incorrectly report that a number type was expected instead. (@rfratto) +- Include Faro Measurement `type` field in `faro.receiver` Flow component and legacy `app_agent_receiver` integration. (@rlankfo) + ### Enhancements - The `loki.write` WAL now has snappy compression enabled by default. (@thepalbi) diff --git a/component/faro/receiver/internal/payload/payload.go b/component/faro/receiver/internal/payload/payload.go index 9bc05f8c5bba..15e7a970e1f5 100644 --- a/component/faro/receiver/internal/payload/payload.go +++ b/component/faro/receiver/internal/payload/payload.go @@ -213,6 +213,7 @@ type MeasurementContext map[string]string // Measurement holds the data for user provided measurements type Measurement struct { + Type string `json:"type,omitempty"` Values map[string]float64 `json:"values,omitempty"` Timestamp time.Time `json:"timestamp,omitempty"` Trace TraceContext `json:"trace,omitempty"` @@ -225,6 +226,7 @@ func (m Measurement) KeyVal() *KeyVal { KeyValAdd(kv, "timestamp", m.Timestamp.String()) KeyValAdd(kv, "kind", "measurement") + KeyValAdd(kv, "type", m.Type) keys := make([]string, 0, len(m.Values)) for k := range m.Values { diff --git a/component/faro/receiver/internal/payload/payload_test.go b/component/faro/receiver/internal/payload/payload_test.go index b219e3d8ba8f..5944a2b10e34 100644 --- a/component/faro/receiver/internal/payload/payload_test.go +++ b/component/faro/receiver/internal/payload/payload_test.go @@ -123,6 +123,7 @@ func TestUnmarshalPayloadJSON(t *testing.T) { require.Equal(t, []Measurement{ { + Type: "foobar", Values: map[string]float64{ "ttfp": 20.12, "ttfcp": 22.12, diff --git a/component/faro/receiver/testdata/payload.json b/component/faro/receiver/testdata/payload.json index 5646a6b05294..b6ac7efce084 100644 --- a/component/faro/receiver/testdata/payload.json +++ b/component/faro/receiver/testdata/payload.json @@ -214,12 +214,12 @@ ], "measurements": [ { + "type": "foobar", "values": { "ttfp": 20.12, "ttfcp": 22.12, "ttfb": 14 }, - "type": "page load", "timestamp": "2021-09-30T10:46:17.680Z", "trace": { "trace_id": "abcd", diff --git a/pkg/integrations/v2/app_agent_receiver/payload.go b/pkg/integrations/v2/app_agent_receiver/payload.go index 8732886133a3..0ab9c5db25ea 100644 --- a/pkg/integrations/v2/app_agent_receiver/payload.go +++ b/pkg/integrations/v2/app_agent_receiver/payload.go @@ -213,6 +213,7 @@ type MeasurementContext map[string]string // Measurement holds the data for user provided measurements type Measurement struct { + Type string `json:"type,omitempty"` Values map[string]float64 `json:"values,omitempty"` Timestamp time.Time `json:"timestamp,omitempty"` Trace TraceContext `json:"trace,omitempty"` diff --git a/pkg/integrations/v2/app_agent_receiver/payload_test.go b/pkg/integrations/v2/app_agent_receiver/payload_test.go index 483796f2879d..b66792547a7c 100644 --- a/pkg/integrations/v2/app_agent_receiver/payload_test.go +++ b/pkg/integrations/v2/app_agent_receiver/payload_test.go @@ -123,6 +123,7 @@ func TestUnmarshalPayloadJSON(t *testing.T) { require.Equal(t, []Measurement{ { + Type: "foobar", Values: map[string]float64{ "ttfp": 20.12, "ttfcp": 22.12, diff --git a/pkg/integrations/v2/app_agent_receiver/testdata/payload.json b/pkg/integrations/v2/app_agent_receiver/testdata/payload.json index 5646a6b05294..b6ac7efce084 100644 --- a/pkg/integrations/v2/app_agent_receiver/testdata/payload.json +++ b/pkg/integrations/v2/app_agent_receiver/testdata/payload.json @@ -214,12 +214,12 @@ ], "measurements": [ { + "type": "foobar", "values": { "ttfp": 20.12, "ttfcp": 22.12, "ttfb": 14 }, - "type": "page load", "timestamp": "2021-09-30T10:46:17.680Z", "trace": { "trace_id": "abcd",