grafana / faro-web-sdk

The Grafana Faro Web SDK, part of the Grafana Faro project, is a highly configurable web SDK for real user monitoring (RUM) that instruments browser frontend applications to capture observability signals. Frontend telemetry can then be correlated with backend and infrastructure data for full-stack observability.
https://grafana.com/oss/faro/
Apache License 2.0
737 stars 64 forks source link

Fails to post events with non string attributes #369

Open domasx2 opened 11 months ago

domasx2 commented 11 months ago

Description

:wave: web sdk allows posting events with attributes of type number, but Grafana cloud endpoint fails to parse them with error:

json: cannot unmarshal number into Go struct field Event.events.attributes of type string

payload:

fana/faro-web-sdk:instrumentation-errors","version":"1.2.1"},{"name":"@grafana/faro-web-sdk:instrumentation-web-vitals","version":"1.2.1"},{"name":"@grafana/faro-web-sdk:instrumentation-session","version":"1.2.1"},{"name":"@grafana/faro-web-sdk:instrumentation-view","version":"1.2.1"},{"name":"@grafana/faro-web-sdk:instrumentation-console","version":"1.2.1"},{"name":"@grafana/faro-react","version":"1.2.1"}]},"app":{"environment":"prod","name":"grafana-app-observability-app","version":"0.17.0"},"user":{"id":"2","username":"Domas Lapinskas","attributes":{"orgId":"1","orgName":"Main Org.","isSignedIn":"true"}},"view":{"name":"services"},"browser":{"name":"Chrome","version":"119.0.0.0","os":"Linux x86_64","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36","language":"en-US","mobile":false,"brands":[{"brand":"Google Chrome","version":"119"},{"brand":"Chromium","version":"119"},{"brand":"Not?A_Brand","version":"24"}]},"page":{"url":"https://invorep.grafana.net/a/grafana-app-observability-app/services?var-prometheus=grafanacloud-invorep-prom&var-loki=grafanacloud-invorep-logs&var-tempo=grafanacloud-invorep-traces&var-attributeFilter=$__all"}},"events":[{"name":"appo11y_serviceinventory_list","domain":"browser","attributes":{"services_count":0,"services_filtered_count":0,"services_uninstrumented_count":0,"namespaces_count":0},"timestamp":"2023-11-03T11:49:35.624Z"}]}

Steps to reproduce

  1. Try sending some events with attributes that have numeric values
  2. Request fails

Expected behavior

Either numeric values are accepted or web sdk types won't allow them

Actual behavior

Reques to cloud endpoint fails

Environment

Demo

Context

codecapitano commented 9 months ago

Relates to #348