Skip to content

Commit 03fc4be

Browse files
authored
build: added @grpc/grpc-js 1.10 and skipped mali (#1099)
refs INSTA-744 refs malijs/mali#376
1 parent 41c5802 commit 03fc4be

File tree

7 files changed

+309
-262
lines changed

7 files changed

+309
-262
lines changed

package-lock.json

+16-40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
"@elastic/elasticsearch-v7.9.0": "npm:@elastic/[email protected]",
9292
"@google-cloud/pubsub": "^4.3.3",
9393
"@google-cloud/storage": "^7.9.0",
94-
"@grpc/grpc-js": "1.9.4",
94+
"@grpc/grpc-js": "1.10.6",
95+
"@grpc/grpc-js-v1": "npm:@grpc/[email protected]",
9596
"@grpc/proto-loader": "^0.7.10",
9697
"@hapi/hapi": "^21.3.7",
9798
"@ibm/tekton-lint": "^1.0.0-beta.9",

packages/collector/test/tracing/protocols/grpc-js/client.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ process.on('SIGTERM', () => {
1010
process.exit(0);
1111
});
1212

13+
require('./mockVersion');
1314
const port = require('../../../test_util/app-port')();
1415

1516
require('../../../..')();

packages/collector/test/tracing/protocols/grpc-js/maliServer.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ process.on('SIGTERM', () => {
1010
process.exit(0);
1111
});
1212

13+
require('./mockVersion');
1314
const port = require('../../../test_util/app-port')();
1415

1516
require('../../../..')();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* (c) Copyright IBM Corp. 2024
3+
*/
4+
5+
'use strict';
6+
7+
const mock = require('mock-require');
8+
const requireHook = require('../../../../../core/src/util/requireHook');
9+
10+
const INSTANA_GRPC_VERSION = process.env.INSTANA_GRPC_VERSION;
11+
const GRPC_REQUIRE =
12+
process.env.INSTANA_GRPC_VERSION === 'latest' ? '@grpc/grpc-js' : `@grpc/grpc-js-${INSTANA_GRPC_VERSION}`;
13+
14+
if (GRPC_REQUIRE !== '@grpc/grpc-js') {
15+
mock('@grpc/grpc-js', GRPC_REQUIRE);
16+
}
17+
18+
const originalOnFileLoad = requireHook.onFileLoad;
19+
requireHook.onFileLoad = function onFileLoad() {
20+
if (
21+
arguments[0].source === '\\/@grpc\\/grpc-js\\/build\\/src\\/server\\.js' ||
22+
arguments[0].source === '\\/@grpc\\/grpc-js\\/build\\/src\\/client\\.js'
23+
) {
24+
const str = arguments[0].source.replace('@grpc\\/grpc-js', GRPC_REQUIRE);
25+
const reg = new RegExp(str, '');
26+
arguments[0] = reg;
27+
return originalOnFileLoad.apply(this, arguments);
28+
}
29+
30+
return originalOnFileLoad.apply(this, arguments);
31+
};

packages/collector/test/tracing/protocols/grpc-js/server.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ process.on('SIGTERM', () => {
1010
process.exit(0);
1111
});
1212

13+
require('./mockVersion');
1314
const port = require('../../../test_util/app-port')();
1415

1516
require('../../../..')();

0 commit comments

Comments
 (0)