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

define createReporter API #3254

Closed

Conversation

eloytoro
Copy link
Contributor

@eloytoro eloytoro commented Jan 6, 2025

Motivation

As of today there's no easy way to send RUM errors or actions that share the same tags, this is something that makes a lot of sense if you wish to define scopes for your application that all share the same information.

There's also no way to supply a handledStack for specifying which part of the codebase is actually reporting the error or action

Changes

Introduce a new API that allows to specify a handling stack trace to addError (as well as addAction?)

{
  // ... rum public api methods
  createReporter: (component: string, conf?: ReporterConfiguration) => Reporter
  // ...
}
export interface Reporter {
  addAction: RumPublicApi['addAction']
  addError: RumPublicApi['addError']
}
export interface ReporterConfiguration {
  handlingStack?: string
  context?: object
}

This new createReporter method returns an object that has the addError method, but now when that method is called the supplied handlingStack will be used as well as all of the context passed to the configuration

const reporter = createReporer('MyComponent', {
  handlingStack: info.componentStack,
  context: { team: 'datadog' }
})

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@bits-bot
Copy link

bits-bot commented Jan 6, 2025

CLA assistant check
All committers have signed the CLA.

@eloytoro eloytoro force-pushed the eloytoro/get-handling-location branch from 9437cce to 96714be Compare January 7, 2025 09:33
@eloytoro eloytoro changed the title define getHandlingStack API and use it in the react plugin define createReporter API and use it in the react plugin Jan 7, 2025
@eloytoro eloytoro changed the title define createReporter API and use it in the react plugin define createReporter API Jan 7, 2025
@eloytoro eloytoro marked this pull request as ready for review January 7, 2025 10:25
@eloytoro eloytoro requested a review from a team as a code owner January 7, 2025 10:25
@eloytoro eloytoro closed this Jan 15, 2025
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

Successfully merging this pull request may close these issues.

2 participants