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(opentelemetry-instrumentation-xhr): optionally ignore network events #4571

Conversation

MustafaHaddara
Copy link
Contributor

@MustafaHaddara MustafaHaddara commented Mar 21, 2024

Which problem is this PR solving?

PR #3028 added a ignoreNetworkEvents boolean to the experimental/opentelemetry-instrumentation-fetch package. This PR adds the same behaviour + flag to the experimental/opentelemetry-instrumentation-xml-http-request package.

Quoting from that PR

Summary: This PR allows to optionally disable adding network events as span events to control the total volume of telemetry data produced.

Some of the modern vendors treat spans and span events (annotations) equally – both are counted towards the overall retained events volume. Similarly, vendors that charge for the overall size of data retained will count span annotations as part of the data. Typically, span produced by the @opentelemetry-instrumentation-fetch includes 9 network events – 10 event items along with the span itself. It would be great to have ability to optionally disable network events being added as span annotations to reduce the overall volume of data/events generated and eventually retained.

Short description of the changes

This PR adds an optional boolean flag ignoreNetworkEvents to the XMLHttpRequest instrumentation. When set to true network events are not added to the span.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Running npm run test:browser will run the newly added test as part of the suite:

...
when network events are ignored
  ✓ should NOT add network events

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@MustafaHaddara MustafaHaddara requested a review from a team as a code owner March 21, 2024 19:45
Copy link

linux-foundation-easycla bot commented Mar 21, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: MustafaHaddara / name: Mustafa Haddara (9fce974)

@MustafaHaddara MustafaHaddara force-pushed the mhaddara/add-ignoreNetworkEvents-xhr branch from e0c6e5d to 9af69ae Compare March 21, 2024 19:46
Copy link

codecov bot commented Mar 25, 2024

Codecov Report

Merging #4571 (9fce974) into main (f6a075b) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4571   +/-   ##
=======================================
  Coverage   92.84%   92.84%           
=======================================
  Files         328      328           
  Lines        9494     9496    +2     
  Branches     2040     2042    +2     
=======================================
+ Hits         8815     8817    +2     
  Misses        679      679           
Files Coverage Δ
...emetry-instrumentation-xml-http-request/src/xhr.ts 97.63% <100.00%> (+0.02%) ⬆️

Copy link
Member

@JamieDanielson JamieDanielson left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for adding this!

@pichlermarc pichlermarc merged commit 900b7d8 into open-telemetry:main Mar 28, 2024
21 checks passed
@MustafaHaddara MustafaHaddara deleted the mhaddara/add-ignoreNetworkEvents-xhr branch March 28, 2024 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants