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

improv(instrumentation-http): supressInstrumentation when we get a request on ignoredPath [#1831] #1838

Merged

Conversation

vmarchaud
Copy link
Member

Fixes #1831

@codecov
Copy link

codecov bot commented Jan 17, 2021

Codecov Report

Merging #1838 (1c2ab82) into master (f43855d) will decrease coverage by 0.19%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1838      +/-   ##
==========================================
- Coverage   92.60%   92.41%   -0.20%     
==========================================
  Files         174      170       -4     
  Lines        6048     5734     -314     
  Branches     1288     1236      -52     
==========================================
- Hits         5601     5299     -302     
+ Misses        447      435      -12     
Impacted Files Coverage Δ
...ges/opentelemetry-instrumentation-http/src/http.ts 95.54% <100.00%> (+0.05%) ⬆️
packages/opentelemetry-plugin-http/src/http.ts 97.32% <100.00%> (+0.04%) ⬆️
...ntelemetry-web/src/enums/PerformanceTimingNames.ts 100.00% <0.00%> (ø)
...s/opentelemetry-instrumentation-fetch/src/fetch.ts
...-instrumentation-fetch/src/enums/AttributeNames.ts
...mentation-xml-http-request/src/enums/EventNames.ts
...emetry-instrumentation-xml-http-request/src/xhr.ts
packages/opentelemetry-web/src/utils.ts 94.70% <0.00%> (+0.07%) ⬆️
...emetry-core/src/platform/node/RandomIdGenerator.ts 93.75% <0.00%> (+6.25%) ⬆️

@Flarna
Copy link
Member

Flarna commented Jan 18, 2021

Maybe a simple regression test should be added to ensure that this doesn't get removed per accident.

@vmarchaud
Copy link
Member Author

Maybe a simple regression test should be added to ensure that this doesn't get removed per accident.

That's why i added https://github.com/open-telemetry/opentelemetry-js/pull/1838/files#diff-ce862d1183e8ab52e6c94e5cc3022280fe213394a9b88e7f473f16620db344efR213, it create a "child" span within the request so if suppressInstrumentation isnt used, tests will fails since they expect to have 0 span.

@vmarchaud vmarchaud force-pushed the supress-instrumentation-ignored-option branch from df17763 to 1c2ab82 Compare January 18, 2021 18:08
@vmarchaud vmarchaud requested a review from Flarna January 18, 2021 18:15
@dyladan dyladan added the enhancement New feature or request label Jan 19, 2021
@dyladan dyladan merged commit 2fcb76d into open-telemetry:master Jan 20, 2021
@obecny
Copy link
Member

obecny commented Jan 20, 2021

I think added changes are not covered with unit tests.

@dyladan
Copy link
Member

dyladan commented Jan 20, 2021

I think added changes are not covered with unit tests.

It is tested here https://github.com/open-telemetry/opentelemetry-js/pull/1838/files#diff-ce862d1183e8ab52e6c94e5cc3022280fe213394a9b88e7f473f16620db344efR213. Without this change, that change to the test would cause it to fail because it creates a span that would not be ignored as a child of an ignored path.

@obecny
Copy link
Member

obecny commented Jan 20, 2021

I think added changes are not covered with unit tests.

It is tested here https://github.com/open-telemetry/opentelemetry-js/pull/1838/files#diff-ce862d1183e8ab52e6c94e5cc3022280fe213394a9b88e7f473f16620db344efR213. Without this change, that change to the test would cause it to fail because it creates a span that would not be ignored as a child of an ignored path.

I would expect some simple test with checking that the span hasn't been exported, hard to say where is such unit test something like this it('should not export supressed span', ()=>{}); and after reverting the code this test should be failing.

No unit test has been added, just modification of before block, if anything fails it won't tell you why it failed - at least from all modified code this doesn't look so.

@vmarchaud
Copy link
Member Author

No unit test has been added, just modification of before block, if anything fails it won't tell you why it failed - at least from all modified code this doesn't look so.

I don't agree, no unit test has been added because a test for the feature that the improv is on (when we ignore paths in the config) was already existing. I don't see the advantage of having multiple individual test for the same feature instead of one that test everything.

if anything fails it won't tell you why it failed

That's generally a "problem" with the tests we write, there are no description of each assert. It forces you to debug manually the test (one could argue that you must do this in every case), at which point it's easy to find out which span is exported.

@obecny
Copy link
Member

obecny commented Jan 20, 2021

That's generally a "problem" with the tests we write, there are no description of each assert. It forces you to debug manually the test (one could argue that you must do this in every case), at which point it's easy to find out which span is exported.

That is exactly what I'm telling, having a simple unit test as I described would be a perfect description and documentation of the changed piece of code. This is a 5 minute and will save much more minutes in future for any1 who will be modifying this part of code. Unit test will fail and it will tell you exactly why.

@vmarchaud
Copy link
Member Author

That is exactly what I'm telling, having a simple unit test as I described would be a perfect description and documentation of the changed piece of code. This is a 5 minute and will save much more minutes in future for any1 who will be modifying this part of code. Unit test will fail and it will tell you exactly why.

I think you misundestood what i said, i meant that it's much better to document what assert are supposed to test instead of having multiple "simple" unit test

pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request Dec 15, 2023
…en-telemetry#1838)

* test: fix TAV tests for @cucumber/cucumber and @aws-sdk/client-s3

- Switch to 'npm run --ws test-all-versions ...' for running TAV tests,
  instead of 'lerna run test-all-versions ...' because nx sets
  'npm_config_legacy_peer_deps=true' which breaks
  '@cucumber/cucumber@9.1.2' install and could break other installs by
  ignoring 'peerDependencies'.
- Skip the bad '@aws-sdk/client-s3@3.377.0' release in TAV tests.

Also:
- Reduce the number of versions of 'aws-sdk' and '@aws-sdk/*' packages
  test in TAV tests from 249, 143, and 132 versions currently, to 7
  each.
- Add a top-level `npm run test-all-versions` script to run that script
  in all packages that have one. This is the equivalent of the
  "test-all-versions.yml" CI workflow.

Fixes: open-telemetry#1828
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[instrumentation] Apply suppressInstrumention to ignored paths
5 participants