Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support shipping of Console.xxx calls at App Insights #2435

Open
finbarw opened this issue Oct 17, 2024 · 1 comment
Open

Support shipping of Console.xxx calls at App Insights #2435

finbarw opened this issue Oct 17, 2024 · 1 comment

Comments

@finbarw
Copy link

finbarw commented Oct 17, 2024

Is your feature request related to a problem? Please describe.
We recently implemented front-end application insights with the requirement that we ship all console logs to application insights. This doesn't appear to be possible with the base library.

Describe the solution you'd like
We would like the ability to ship console logs to app insights using the base library. Of course, we'd expect this to be configurable, and the default behaviour probably to be don't ship.

Describe alternatives you've considered
As you can imagine, we achieved this via console method overrides, which works just fine.

Additional context
This is by no means a bugbear, as our implementation was straightforward - it's just a suggestion.
It's possible this isn't a high demand requirement. But it may also be fairly trivial to include and would be an improvement to the library.
I would also expect may have has been discussed and intentionally excluded as a feature, in which case it would be great to know the reasoning for that decision.

@MSNev
Copy link
Collaborator

MSNev commented Oct 17, 2024

I've tagged this as an enhancement as there would be several ways to achieve this, we have not previously implemented this as it was not a requested feature and as we need to run in a wide variety of runtimes (older browser versions), browsers have historically implemented the "console" differently.

For example IE originally did not have the console available unless the F12 Developer tools was open (I don't recall which specific versions -- but when I first hit this (and caused production issues with another product -- wasn't working for MS at the time) it was very surprising)

Future notes for implementation Options

  • Implementing as an additional plugin (extension)
  • Implementing as part of simple Instrumentation Hooks (would need to handle the differences between console implementation functions, to avoid just "adding" a proxy when the runtime doesn't implement -- to avoid causing anyone detecting the wrong implementation)
  • A simple config enable / disable might be nice
  • Would need to ensure that the existing diag logWarn() doesn't cause endless looping when enabled (it's off by default)
  • Review with backend team on whether we can introduce this as a new "Event" type for capturing as a specific console log, etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants