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
688 stars 62 forks source link

Add Option to Suppress Logs from Being Displayed in Console by ConsoleInstrumentation #607

Closed vitebo closed 4 weeks ago

vitebo commented 1 month ago

Description

Currently, when a log is triggered in the application, it is captured and sent to Alloy by ConsoleInstrumentation. The issue is that this log continues to be displayed in the console, making some information more visible than we would prefer.

Would it make sense to create an option to prevent this behavior?

Proposed Solution

If an option is created, we can simply add a conditional here.

I am willing to open a PR with this modification if it makes sense.

codecapitano commented 4 weeks ago

I don't think Faro should be used to hide logs in the browsers console. Imho it's up to the developers to remove logs before release.

@cedricziel wdyt? Are you aware of any similar requests?

vitebo commented 4 weeks ago

To clarify the problem:

Removing the logs before release means they won’t be available in Grafana.

The goal is to achieve the same behavior as the faro.api.pushLog API but in a way that is transparent to developers, so they don’t need to change their current logging methods.

codecapitano commented 4 weeks ago

Let me clarify, so I do not misunderstand anything:

You want the ConsoleInstrumentation to capture and send logs but without printing them to the browsers console, right?

Faro only instruments the browser console, sends a log signal and forwards the raw log to the original browser console.

So it sounds the desired functionality is to be able to suppress logs form being printed to the console. This is a concern of logging tools or similar but should not be done by a RUM library.

vitebo commented 4 weeks ago

I understand your point, it really seems to make sense. I think we can consider this issue as resolved then.