Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
43fd59e
docs: add example for esm-http-ts
JamieDanielson Mar 21, 2023
e5215fe
fix: use instr version not node version
JamieDanielson Mar 21, 2023
3c51c6d
deps: add import-in-the-middle
JamieDanielson Mar 21, 2023
8444af3
feat: add iitm for esm instr
JamieDanielson Mar 21, 2023
e4478d9
docs: add readme notes from valentin
JamieDanielson Mar 21, 2023
1434b27
wip: add test based on valentin's test
JamieDanielson Mar 21, 2023
a533f9f
remove changes to ritm init
JamieDanielson Mar 22, 2023
a43089b
update example - use build dir, add readme
JamieDanielson Mar 22, 2023
85a2e8f
add changelog entry
JamieDanielson Mar 22, 2023
e0b5c44
dont use ritm singleton for iitm
JamieDanielson Mar 23, 2023
63477c5
fix up call for new iitm
JamieDanielson Mar 23, 2023
1188c02
Merge branch 'main' into esm-support
JamieDanielson Mar 23, 2023
33e544c
Merge branch 'main' into esm-support
lizthegrey Mar 28, 2023
bfe51f5
wrap function refactor
pkanal Mar 31, 2023
7110c37
clean up
pkanal Apr 3, 2023
3ddb3a9
Merge pull request #1 from honeycombio/purvi/esm-tests
JamieDanielson Apr 4, 2023
3f3d9a2
Merge branch 'main' into esm-support
JamieDanielson Apr 4, 2023
2936a16
update changelog: it takes a village
JamieDanielson Apr 4, 2023
4a10129
small cleanup on test
JamieDanielson Apr 4, 2023
50363c5
version should be node version, not instr version
JamieDanielson Apr 5, 2023
c9922c3
run lint:fix for prettier error
JamieDanielson Apr 5, 2023
b722486
Merge pull request #2 from honeycombio/jamie.http-node-version
pkanal Apr 5, 2023
4ac1ee1
base unwrap functionality
pkanal Apr 5, 2023
a346531
move esm specific wrap logic to node class
pkanal Apr 5, 2023
1ca6b55
fix types
pkanal Apr 6, 2023
4401576
add masswrap & massunwrap
pkanal Apr 6, 2023
86b6837
handle edge cases for masswrap and massunwrap
pkanal Apr 6, 2023
da694c7
Merge pull request #3 from honeycombio/purvi.unwrap
JamieDanielson Apr 7, 2023
1612855
Merge branch 'main' into esm-support
JamieDanielson Apr 7, 2023
e924c99
Ship shimmer types (#5)
pkanal Apr 25, 2023
b894bcd
Merge branch 'main' into esm-support
pkanal Apr 25, 2023
68c43c9
use --experimental-meta-resolve option with hook file (#8)
pkanal Apr 26, 2023
a2a74f8
Merge branch 'main' into esm-support
pkanal May 1, 2023
a529c8c
fix markdown
pkanal May 1, 2023
ddc8dc5
Merge branch 'main' into esm-support
pkanal May 3, 2023
42eb5ba
address PR feedback (#9)
pkanal May 3, 2023
4f71df8
Update experimental/packages/opentelemetry-instrumentation/hook.js
pkanal May 5, 2023
6a052b1
Update experimental/packages/opentelemetry-instrumentation/hook.mjs
pkanal May 5, 2023
58d34c0
change back to process.versions.node (#10)
pkanal May 5, 2023
33409da
address pr feedback (#11)
pkanal May 9, 2023
1f017b0
remove `--experimental-import-meta-resolve` flag (#12)
pkanal May 10, 2023
16109d3
Merge branch 'main' into esm-support
JamieDanielson May 10, 2023
bcaef1c
Merge branch 'main' into esm-support
JamieDanielson May 11, 2023
c590efc
Merge branch 'main' into esm-support
JamieDanielson May 12, 2023
59047bd
remove import limitation from README
pkanal May 12, 2023
0167a10
add esm example to examples readme
pkanal May 12, 2023
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
Prev Previous commit
Next Next commit
wip: add test based on valentin's test
doesn't currently work with iitm register
  • Loading branch information
JamieDanielson committed Mar 21, 2023
commit 1434b27697a382a2a7da506fae5fe75b48b28604
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
"tdd": "npm run tdd:node",
"tdd:node": "npm run test -- --watch-extensions ts --watch",
"tdd:browser": "karma start",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'",
"test:cjs": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'",
"test:esm": "nyc node --experimental-loader=import-in-the-middle/hook.mjs ../../../node_modules/mocha/bin/mocha 'test/node/*.test.mjs' test/node/*.test.mjs",
"test": "npm run test:cjs && npm run test:esm",
"test:browser": "nyc karma start --single-run",
"version": "node ../../../scripts/version-update.js",
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import * as assert from 'assert';
import {
InstrumentationBase,
InstrumentationNodeModuleDefinition,
} from '../../build/src/index.js';

describe('when loading esm module', () => {
it('should patch module file', async () => {
class TestInstrumentation extends InstrumentationBase {
constructor() {
super('test-esm-instrumentation', '0.0.1');
}
init() {
console.log('test-esm-instrumentation initialized!');
return new InstrumentationNodeModuleDefinition(
'test-esm-module',
['*'],
moduleExports => {
console.log('patch');
moduleExports.testConstant = 43;
}
);
}
}
const instrumentation = new TestInstrumentation();
instrumentation.enable();
// const exported = await import('test-esm-module');
// assert.deepEqual(exported.testConstant, 43);

// error from import-in-the-middle register
// TypeError: setters.get(...)[name] is not a function
});
});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.