Skip to content

Commit

Permalink
[faro collector] add missing struct fields so that payload.meta.brows…
Browse files Browse the repository at this point in the history
…er fields are not lost (#1824)

* Update payload.go

* Update CHANGELOG.md

* Update payload.go

* Update payload.go

* Update payload.json

* Update payload.json

* Update payload.json

* Update payload_test.go

* Update payload.json
  • Loading branch information
elee1766 authored Oct 7, 2024
1 parent 1f14cca commit ff673a9
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ v1.4.2

- Fix issue where `loki.source.kubernetes` took into account all labels, instead of specific logs labels. Resulting in duplication. (@mattdurham)

- Fix an issue where some `faro.receiver` would drop multiple fields defined in `payload.meta.browser`, as fields were defined in the struct

### Other changes

- Small fix in UI stylesheet to fit more content into visible table area. (@defanator)

- Changed OTEL alerts in Alloy mixin to use success rate for tracing. (@thampiotr)

- Support TLS client settings for clustering (@tiagorossig)

v1.4.1
-----------------

Expand Down
18 changes: 14 additions & 4 deletions internal/component/faro/receiver/internal/payload/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,16 @@ func (a App) KeyVal() *KeyVal {

// Browser holds metadata about a client's browser
type Browser struct {
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
OS string `json:"os,omitempty"`
Mobile bool `json:"mobile,omitempty"`
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
OS string `json:"os,omitempty"`
Mobile bool `json:"mobile,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
Language string `json:"language,omitempty"`
// TODO: properly serialize brands
// Brands json.RawMessage `json:"brands,omitempty"`
ViewportWidth string `json:"viewportWidth,omitempty"`
ViewportHeight string `json:"viewportHeight,omitempty"`
}

// KeyVal produces key->value representation of the Browser metadata
Expand All @@ -409,6 +415,10 @@ func (b Browser) KeyVal() *KeyVal {
KeyValAdd(kv, "version", b.Version)
KeyValAdd(kv, "os", b.OS)
KeyValAdd(kv, "mobile", fmt.Sprintf("%v", b.Mobile))
KeyValAdd(kv, "userAgent", b.UserAgent)
KeyValAdd(kv, "language", b.Language)
KeyValAdd(kv, "viewportWidth", b.ViewportWidth)
KeyValAdd(kv, "viewportHeight", b.ViewportHeight)
return kv
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ func TestUnmarshalPayloadJSON(t *testing.T) {
Version: "88.12.1",
OS: "linux",
Mobile: false,
UserAgent: "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0",
Language: "en-US",
ViewportWidth: "1920",
ViewportHeight: "1080",
},
View: View{
Name: "foobar",
Expand Down
6 changes: 5 additions & 1 deletion internal/component/faro/receiver/testdata/payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,11 @@
"name": "chrome",
"version": "88.12.1",
"os": "linux",
"mobile": false
"mobile": false,
"userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0",
"language": "en-US",
"viewportWidth": "1920",
"viewportHeight": "1080"
},
"view": {
"name": "foobar"
Expand Down

0 comments on commit ff673a9

Please sign in to comment.