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

✨ [RUMF-772] add beforeSend API #644

Merged
merged 15 commits into from
Dec 17, 2020
Merged

✨ [RUMF-772] add beforeSend API #644

merged 15 commits into from
Dec 17, 2020

Conversation

bcaudan
Copy link
Contributor

@bcaudan bcaudan commented Dec 11, 2020

Motivation

Provide an API to modified fields that can contain sensitive data before sending them to our server:

ex:

DD_RUM.init({
  ...,
  beforeSend: (event) => {
    // remove email from view url
    event.view.url = event.view.url.replace(/email=[^&]*/, "email=REDACTED")
  },
  ...
})

Only the following fields are updatable:

  • RUM
    • view.url
    • view.referrer
    • action.target.name
    • error.message
    • error.stack
    • error.resource.url
    • resource.url
  • Logs
    • view.url
    • view.referrer
    • message
    • error.stack
    • http.url

Changes

  • new limitModification core method
  • document logsEventsFormat
  • add beforeSend API for rum and logs

Testing

automated tests + sandbox tests


I have gone over the contributing documentation.

@bcaudan bcaudan force-pushed the bcaudan/before-send branch 2 times, most recently from 723d60a to 5604edd Compare December 11, 2020 12:13
@codecov-io
Copy link

codecov-io commented Dec 11, 2020

Codecov Report

Merging #644 (5567244) into master (0fb8bde) will increase coverage by 0.10%.
The diff coverage is 97.01%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #644      +/-   ##
==========================================
+ Coverage   87.50%   87.60%   +0.10%     
==========================================
  Files          54       55       +1     
  Lines        2464     2510      +46     
  Branches      509      517       +8     
==========================================
+ Hits         2156     2199      +43     
- Misses        308      311       +3     
Impacted Files Coverage Δ
packages/core/src/domain/configuration.ts 90.41% <ø> (ø)
packages/logs/src/boot/logs.entry.ts 100.00% <ø> (ø)
packages/rum/src/boot/rum.entry.ts 92.06% <ø> (ø)
packages/rum/src/domain/internalContext.ts 100.00% <ø> (ø)
packages/rum/src/domain/lifeCycle.ts 100.00% <ø> (ø)
packages/rum/src/domain/parentContexts.ts 98.24% <ø> (ø)
packages/rum/src/domain/trackEventCounts.ts 100.00% <ø> (ø)
packages/rum/src/rawRumEvent.types.ts 100.00% <ø> (ø)
packages/rum/test/fixtures.ts 100.00% <ø> (ø)
packages/logs/src/boot/logs.ts 71.11% <94.44%> (+2.53%) ⬆️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0fb8bde...5567244. Read the comment docs.

@bcaudan bcaudan force-pushed the bcaudan/before-send branch 2 times, most recently from f5171f3 to 1aa110a Compare December 11, 2020 12:29
@bcaudan bcaudan marked this pull request as ready for review December 11, 2020 12:32
@bcaudan bcaudan requested a review from a team as a code owner December 11, 2020 12:32
packages/logs/src/logsEventsFormat.ts Outdated Show resolved Hide resolved
packages/logs/src/logsEventsFormat.ts Outdated Show resolved Hide resolved
packages/rum/src/boot/rum.spec.ts Outdated Show resolved Hide resolved
packages/logs/src/boot/logs.ts Outdated Show resolved Hide resolved
@bcaudan bcaudan force-pushed the bcaudan/before-send branch from f42a5d8 to 578f648 Compare December 14, 2020 17:54
@bcaudan bcaudan force-pushed the bcaudan/generate-types branch from e01cc6d to a4f0e8b Compare December 14, 2020 17:56
@bcaudan bcaudan force-pushed the bcaudan/before-send branch 3 times, most recently from dbf61de to 848e0b4 Compare December 14, 2020 18:35
Copy link
Member

@BenoitZugmeyer BenoitZugmeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Base automatically changed from bcaudan/generate-types to master December 15, 2020 10:30
@bcaudan bcaudan changed the base branch from master to bcaudan/generate-types December 15, 2020 10:32
@bcaudan bcaudan changed the base branch from bcaudan/generate-types to master December 15, 2020 10:38
@bcaudan bcaudan force-pushed the bcaudan/before-send branch from 0118968 to 848e0b4 Compare December 15, 2020 10:41
@bcaudan bcaudan changed the base branch from master to bcaudan/generate-types December 15, 2020 10:45
@bcaudan bcaudan changed the base branch from bcaudan/generate-types to master December 15, 2020 10:47
@bcaudan bcaudan force-pushed the bcaudan/before-send branch from 53c445a to 73c7402 Compare December 15, 2020 11:06
@bcaudan bcaudan merged commit f50c3ce into master Dec 17, 2020
@bcaudan bcaudan deleted the bcaudan/before-send branch December 17, 2020 09:24
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.

3 participants