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

feat: Add auto-logging feature #1274

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

feat: Add auto-logging feature #1274

wants to merge 18 commits into from

Conversation

ptang-nr
Copy link
Contributor

The auto-logging feature builds on top of the current API calls log and wrapLogger. The api calls continue to provide a way to add custom attributes as needed. Otherwise, customers may simply configure browser logs (on/off, logging level, and sampling rates), which will capture logging statements from the browser console across a given session automatically.

Overview

This PR includes work that:

  • wraps the various logging methods of the console
  • aggregates logging events according to the log flag received from rum call to BCS
  • persists logging mode across active session and will auto-disable upon session expiration after 4 hours or session inactivity after 30 minutes.

Related Issue(s)

https://new-relic.atlassian.net/browse/NR-323591
https://new-relic.atlassian.net/browse/NR-323597
https://new-relic.atlassian.net/browse/NR-341932

Testing

  • Extended the existing e2e tests for logging harvests:

    • pre-load
    • post-load
    • harvests that are too large
    • harvest early
  • Extended existing logging aggregate unit and e2e tests around handling the flag. Includes tests for each logging mode to ensure log messages of equal or higher levels are collected. For example, if the log flag = 3 (INFO), then collect console.error, console.warn, console.info, and console.log events.

  • Extended existing tests to ensure no harvests when rum flag = 0 and events are drained.

Copy link

github-actions bot commented Dec 11, 2024

Asset Size Report

Merging this pull request will result in the following asset size changes:

Agent Asset Previous Size New Size Diff
lite loader 29.82 kB / 10.82 kB (gzip) 29.87 kB / 10.84 kB (gzip) 0.19% / 0.24% (gzip)
lite async-chunk 52.6 kB / 17.08 kB (gzip) 52.67 kB / 17.1 kB (gzip) 0.13% / 0.11% (gzip)
pro loader 51.51 kB / 17.8 kB (gzip) 51.95 kB / 17.9 kB (gzip) 0.86% / 0.61% (gzip)
pro async-chunk 100.74 kB / 30.77 kB (gzip) 102.01 kB / 31.08 kB (gzip) 1.26% / 0.98% (gzip)
spa loader 59.12 kB / 20.11 kB (gzip) 59.57 kB / 20.22 kB (gzip) 0.75% / 0.52% (gzip)
spa async-chunk 115.45 kB / 35.1 kB (gzip) 116.72 kB / 35.39 kB (gzip) 1.1% / 0.84% (gzip)

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 85.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 88.80%. Comparing base (46f5cc7) to head (9b54992).

Files with missing lines Patch % Lines
src/features/logging/aggregate/index.js 80.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1274      +/-   ##
==========================================
+ Coverage   88.75%   88.80%   +0.04%     
==========================================
  Files         170      170              
  Lines        7348     7412      +64     
  Branches     1489     1503      +14     
==========================================
+ Hits         6522     6582      +60     
- Misses        716      722       +6     
+ Partials      110      108       -2     
Flag Coverage Δ
integration-tests 91.33% <100.00%> (+0.15%) ⬆️
unit-tests 79.93% <70.45%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Dec 11, 2024

Static Badge

Last ran on February 05, 2025 14:19:39 CST
Checking merge of (9b54992) into main (46f5cc7)

Copy link
Member

@metal-messiah metal-messiah left a comment

Choose a reason for hiding this comment

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

This is my approval, but this needs to wait until tentative GA date as discussed internally. Adjacent teams doing final checks. Blocking until that is reached

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