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: implement native node fetch instrumentation #483

Open
wants to merge 71 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
39ffc22
fix: split http instrumentation to core logic and http lib integration
sagivoululumigo May 8, 2024
0b36ed7
fix: broken ut
sagivoululumigo May 8, 2024
ca63391
fix: broken ut
sagivoululumigo May 8, 2024
d326aad
fix: broken ut
sagivoululumigo May 8, 2024
e07d28c
fix: wrong and missing type hints
sagivoululumigo May 8, 2024
183ca42
fix: ts type hinting error
sagivoululumigo May 9, 2024
53ae711
test: missing coverage cases
sagivoululumigo May 9, 2024
9934e55
fix: commented out code deleted
sagivoululumigo May 9, 2024
80a9d7b
test: missing test coverage
sagivoululumigo May 9, 2024
3e58a27
fix: typo
sagivoululumigo May 9, 2024
7974c42
fix: redundant lint ignore comment
sagivoululumigo May 9, 2024
98ef523
test: add w3c headers doesn't effect unrelated headers
sagivoululumigo May 9, 2024
6a93130
test: better test name
sagivoululumigo May 9, 2024
508ed82
docs: remove old comment
sagivoululumigo May 9, 2024
6893f22
fix: simplify statement
sagivoululumigo May 9, 2024
bd02081
fix: http tracing headers not added when only start request span is c…
sagivoululumigo May 12, 2024
e711092
fix: ts type defined at start of file
sagivoululumigo May 12, 2024
72f257c
chore: testing jest coverage settings
sagivoululumigo May 12, 2024
f215b46
chore: remove testing commit
sagivoululumigo May 12, 2024
76167e8
feat: instrument undici library (work in progress)
sagivoululumigo May 13, 2024
f4dfa92
feat: instrument undici library
sagivoululumigo May 15, 2024
255772f
fix: wrong undici import name
sagivoululumigo May 15, 2024
49e54a5
feat: instrument native fetch directly
sagivoululumigo May 19, 2024
23559ea
chore: fetch instrumentor more readable
sagivoululumigo May 20, 2024
d5be678
fix: simplify fetch promise hooking
sagivoululumigo May 20, 2024
20e237e
fix: fetch hooks should be failsafe
sagivoululumigo May 21, 2024
9957082
test: ut fetch using node 18
sagivoululumigo May 21, 2024
11e4fba
test: install mvn for ut running node 18
sagivoululumigo May 22, 2024
2af7339
test: install mvn for ut running node 18
sagivoululumigo May 22, 2024
44809ab
test: install mvn for ut running node 18
sagivoululumigo May 22, 2024
1106bbf
test: install mvn for ut running node 18
sagivoululumigo May 22, 2024
93da88c
test: install mvn for ut running node 18
sagivoululumigo May 23, 2024
50f8928
test: install mvn for ut running node 18
sagivoululumigo May 23, 2024
9c06267
test: install mvn for ut running node 18
sagivoululumigo May 23, 2024
cc9b552
test: install mvn for ut running node 18
sagivoululumigo May 23, 2024
f0e1097
test: install mvn for ut running node 18
sagivoululumigo May 23, 2024
f8c414b
test: install mvn for ut running node 18
sagivoululumigo May 23, 2024
b1f6c16
test: install mvn for ut running node 18
sagivoululumigo May 23, 2024
ac57321
ci: run ut on node 18
sagivoululumigo May 23, 2024
0968a75
ci: run only node 18 tests on node 18
sagivoululumigo May 23, 2024
bb5af0d
ci: run only node 18 tests on node 18
sagivoululumigo May 23, 2024
80358aa
ci: run only node 18 tests on node 18
sagivoululumigo May 23, 2024
76d860a
ci: run only node 18 tests on node 18
sagivoululumigo May 23, 2024
8f89b22
fix: skip unhandled promise rejection tests when node grater than 14
sagivoululumigo May 23, 2024
a93b74e
test: ut basic fetch http calls
sagivoululumigo May 26, 2024
cdd3553
test: better test name
sagivoululumigo May 26, 2024
2a03698
test: more fetch cases
sagivoululumigo May 26, 2024
f6a8d5a
test: fix broken http lib ut
sagivoululumigo May 26, 2024
9ce6a12
fix: fetch instrumentation on blocked hosts crash
sagivoululumigo May 26, 2024
8d594ca
docs: remove old comments
sagivoululumigo May 26, 2024
d992e55
fix: support more fetch request args formats
sagivoululumigo May 26, 2024
2058679
fix: parse fetch args explicitly using their types, not as an array o…
sagivoululumigo May 27, 2024
9f945a3
test: fetch ut
sagivoululumigo May 27, 2024
1e1cd74
fix: removed unused dev dep
sagivoululumigo May 27, 2024
5ad879f
fix: log when unsupported form data req body is parsed
sagivoululumigo May 27, 2024
7a3b212
fix: remove browser linting config added by mistake
sagivoululumigo May 28, 2024
622b379
fix: better name for safe execute func
sagivoululumigo May 28, 2024
b9662ac
fix: always return args in before fetch hook
sagivoululumigo May 28, 2024
99aab76
fix: abbreviate logic condition
sagivoululumigo May 28, 2024
f39542f
fix: abbreviate logic condition
sagivoululumigo May 28, 2024
b6b906d
fix: ignore linting errors due to node 14 and 18 incompatibilities in…
sagivoululumigo May 28, 2024
766391c
fix: reslove merge conflict
sagivoululumigo Jun 9, 2024
8e8f85c
ci: remove redundant flag
sagivoululumigo Jun 9, 2024
a9f115e
ci: ignore fetch coverage for node 14 unit tests
sagivoululumigo Jun 9, 2024
4698427
Merge branch 'master' into RD-12715-implement-undici-instrumentation
sagivoululumigo Jul 1, 2024
d6db87b
fix: package-lock.json not updated with new dev package
sagivoululumigo Jul 1, 2024
3470d48
ci: ignore fetch coverage when running on node 14
sagivoululumigo Jul 1, 2024
30b0ea3
ci: ignore fetch coverage when running on node 14
sagivoululumigo Jul 1, 2024
41e71a5
ci: remove redundant flag
sagivoululumigo Jul 1, 2024
5d77002
ci: remove codecov for node18 tests
sagivoululumigo Jul 1, 2024
c90d081
ci: remove codecov for node18 tests
sagivoululumigo Jul 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ workflows:
branches:
ignore: master

- test-18:
context: common
filters:
branches:
ignore: master

- lumigo-orb/is_environment_available:
context: common
filters:
Expand Down Expand Up @@ -64,6 +70,7 @@ workflows:
context: common
requires:
- test
- test-18
- lumigo-orb/integration-test-parallel

- deploy:
Expand Down Expand Up @@ -107,11 +114,49 @@ jobs:
command: npm run lint
- run:
name: code-coverage
command: npm test --coverage && codecov
command: npm test && codecov
- store_artifacts:
path: coverage
prefix: coverage

test-18:
docker:
- image: node:18.20.3-bookworm-slim
environment:
- TZ: Asia/Jerusalem
- NODE_OPTIONS: --max_old_space_size=1500
resource_class: medium+
working_directory: ~/lumigo-node
steps:
- run:
name: show current node version
command: node --version
- run:
name: install openssl
command: apt-get update -y && apt-get install -y openssl
- checkout
- run:
name: install npm dependencies
command: npm install --legacy-peer-deps
- run:
name: install-npm-inner
command: |
pushd auto-instrument-handler
npm install
popd
- run:
name: prettier
command: npm run prettier:ci
- run:
name: check types
command: npm run check-types
- run:
name: test
command: npm test
- run:
name: eslint
command: npm run lint

deploy:
<<: *defaults
environment:
Expand Down
44 changes: 31 additions & 13 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
module.exports = {
collectCoverage: true,
collectCoverageFrom: [
module.exports = () => {
const [NODE_MAJOR_VERSION] = process.versions.node.split('.').map(Number);
let collectCoverageFrom = [
'**/src/**/**/**/**.js',
'**/src/**/**/**/**.ts',
'!./src/tools/xmlToJson.js',
'!./src/testdata/functions/**/**.js',
'!./d_example/**/**',
],
coverageDirectory: './coverage/',
coverageThreshold: {
];
let coverageThreshold = {
global: {
lines: 99.7,
},
},
modulePaths: ['<rootDir>/dist'],
roots: ['<rootDir>/src'],
setupFilesAfterEnv: ['./testUtils/jest.setup.js'],
globalSetup: './testUtils/prismaSetup.js',
silent: true,
watchPathIgnorePatterns: ['globalConfig'],
};

if (NODE_MAJOR_VERSION < 18) {
// fetch is not supported in Node.js versions lower than 18,
// so no need to check coverage for that version
collectCoverageFrom.push('!./src/hooks/fetch.ts');
}

if (NODE_MAJOR_VERSION > 14) {
// Some of our unit tests don't work on Node.js grater than 14,
// so the coverage is lower when running with these versions
coverageThreshold.global.lines = 98.4;
}

return {
collectCoverage: true,
collectCoverageFrom: collectCoverageFrom,
coverageDirectory: './coverage/',
coverageThreshold: coverageThreshold,
modulePaths: ['<rootDir>/dist'],
roots: ['<rootDir>/src'],
setupFilesAfterEnv: ['./testUtils/jest.setup.js'],
globalSetup: './testUtils/prismaSetup.js',
silent: true,
watchPathIgnorePatterns: ['globalConfig'],
};
};
Loading