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
772 stars 66 forks source link

faro-web-sdk API calls are going in loop #663

Open snehalk-mdsol opened 3 months ago

snehalk-mdsol commented 3 months ago

Facing a faro issue from quite a long now. Please find below screenshots -

Screenshot 2024-08-13 at 1 57 48 PM Screenshot 2024-08-13 at 1 57 38 PM Screenshot 2024-08-13 at 1 57 18 PM Screenshot 2024-08-13 at 1 56 12 PM

I tried updating faro libraries to the latest version 1.9.0 and added collector URLs in ignoreURLs while initializing a faro instance. You can check the PR here - https://github.com/mdsol/platform-portal/pull/619/files

Can someone please help. @codecapitano

eskirk commented 3 months ago

hi @snehalk-mdsol - @codecapitano is on PTO right now, but can you provide some more details regarding the issue you are facing? I am not fully understanding what the problem is.

codecapitano commented 3 months ago

Hi @snehalk-mdsol I can't access the PR you linked.

codecapitano commented 3 months ago

I have a suspicion. The otlp-http-transport didn't consume the request body so didn't close the connection. This can cause pending requests, memory leaks and other sorts of problems.

We'll release it soon.

Unfortunately I couldn't reproduce the issue so once released please let us know if the update fixed the problem.

Shawns2759 commented 2 months ago

We are seeing this as well. It is a big problem causing lots of failed logs.

codecapitano commented 2 months ago

@Shawns2759 do you use the same setup with the otlp-http-transport? What is the Faro version your are using? Can you share you Faro config? And do you use Faro in a microfrontend with multiple instances running simultaniously?

Shawns2759 commented 2 months ago
   "@grafana/faro-react": "^1.5.1",
    "@grafana/faro-web-sdk": "^1.5.1",
    "@grafana/faro-web-tracing": "^1.5.1",
Shawns2759 commented 2 months ago

Things are set up very similarly to this PR.

https://github.com/open-sauced/app/pull/3139

codecapitano commented 2 months ago

Architecture is a monolith not a micro frontend right? Means only a single Faro instance is running?

Shawns2759 commented 2 months ago

Our application is a Capacitor application that is serving a nextJs frontend and a a mobile frontend for Android and Apple via Capacitor. We delineate between mobile and web using namespace.

We are using Grafana Cloud.

Faro is still at 1.5.1.

codecapitano commented 2 months ago

Thank you @Shawns2759 Is it possible for you to upgrade Faro to the current version (currently 1.10.x)?

With Faro 1.8.0 we fixed an issue where session timings could drift between the faro receiver and faro itself which lead to rejected sessions. It may not be directly related but at least we can exclude that this is causing the issue in your case and then continue the investigation.

Enhancement (@grafana/faro-web-sdk): Auto extend a session if the Faro receiver indicates that a session is invalid (#591).

Shawns2759 commented 2 months ago

Interesting. Yes I will try that.

Shawns2759 commented 2 months ago

@codecapitano I updated to 1.10.0 and I am still receiving this error here is what it looks like.

console error: Faro @grafana/faro-web-sdk:transport-fetch Failed sending payload to the receiver { "meta": { "sdk": { "version": "1.10.0" }, "app": { "name": "redacted", "version": "1.0.0", "environment": "production", "namespace": "web" }, "browser": { "name": "redacted", "version": "redacted", "os": "Windows 10", "userAgent": "redacted", "language": "redacted", "mobile": false, "brands": "unknown", "viewportWidth": "1651", "viewportHeight": "801" }, "page": { "url": "redacted" }, "session": { "id": "redacted", "attributes": { "previousSession": "redacted" } } }, "events": [ { "name": "faro.performance.resource", "domain": "browser", "attributes": { "name": "redacted", "duration": "45", "tcpHandshakeTime": "0", "dnsLookupTime": "0", "tlsNegotiationTime": "0", "responseStatus": "202", "redirectTime": "0", "requestTime": "0", "responseTime": "504819", "fetchTime": "45", "serviceWorkerTime": "504774", "decodedBodySize": "53", "encodedBodySize": "53", "cacheHitStatus": "cache", "renderBlockingStatus": "unknown", "protocol": "", "initiatorType": "xmlhttprequest", "faroNavigationId": "redacted, "faroResourceId": "redacted" }, "timestamp": "2024-09-26T18:35:45.594Z" } ] } TypeError: NetworkError when attempting to fetch resource.

codecapitano commented 2 months ago

Can you share a screenshot with the request response information, like request/response headers etc.