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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃檹 Workaround for MFE Logging Supporting Sourcemaps #2585

Open
CallMeHK opened this issue Feb 1, 2024 · 2 comments
Open

馃檹 Workaround for MFE Logging Supporting Sourcemaps #2585

CallMeHK opened this issue Feb 1, 2024 · 2 comments

Comments

@CallMeHK
Copy link

CallMeHK commented Feb 1, 2024

What are you trying to achieve and what is your issue? Please describe.
Looking for a workaround for microfrontend applications - I'm not looking for a way to do this natively, just a way to send logs as a different service/version tag than the init configuration.

Describe the solution you'd like
I would like to be able to override the init configuration for one window.DD_LOGS.logger.log invocation. If the logger has been initialized with service a and version 2.2.2, overwriting the services via:

window.DD_LOGS.logger.log('test', { service: 'b', version: '1.11.111' }, 'error')

Results in a log with Event attributes {service: 'b', version: '1.11.111'}, but it still has the tags {service: 'a', version: '2.2.2'}. I need the tags to change so that source maps will work for errors. it would be great if i could access the internal properties via something similar to:

{
  ...window.DD_LOGS.logger.log('test', { service: 'b', version: '1.11.111' }, 'error'),
  service: 'b', version: '1.11.111'
}.log('test', { ... }, 'error')

until datadog has adequate MFE support.

Describe alternatives you've considered
I dont know what alternatives i have until DD has some form of MFE support. Thanks!

@CallMeHK CallMeHK changed the title 馃檹 My support need 馃檹 Workaround for MFE Logging Supporting Sourcemaps Feb 1, 2024
@bcaudan
Copy link
Contributor

bcaudan commented Feb 2, 2024

Hi @CallMeHK,

Indeed, we don't have an adequate support for MFE for now and we don't allow to overwrite tags at SDK level.
However, similarly to the error stack remapping, it should be possible to use a log remapper to overwrite service/version tags with service/version attributes.

@aviv-akhansari
Copy link

aviv-akhansari commented Apr 15, 2024

Hi @bcaudan

I know that with RUM, we can override the service thanks to startView.
On the other hand, in our app we'd like to only use browser-logs to keep it lightweight.

Do you think that in the future we'll be able to have the same functionality as startView with createLogger, for MFEs?
As the workaround, is it a good idea to remap the logger name to service name?

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

No branches or pull requests

3 participants