Skip to content

Commit

Permalink
build: added @grpc/grpc-js 1.10 and skipped mali
Browse files Browse the repository at this point in the history
refs INSTA-744
refs malijs/mali#376
  • Loading branch information
kirrg001 committed Apr 5, 2024
1 parent 41c5802 commit a3be743
Show file tree
Hide file tree
Showing 7 changed files with 309 additions and 262 deletions.
56 changes: 16 additions & 40 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
"@elastic/elasticsearch-v7.9.0": "npm:@elastic/elasticsearch@7.9.0",
"@google-cloud/pubsub": "^4.3.3",
"@google-cloud/storage": "^7.9.0",
"@grpc/grpc-js": "1.9.4",
"@grpc/grpc-js": "1.10.6",
"@grpc/grpc-js-v1": "npm:@grpc/grpc-js@1.9.4",
"@grpc/proto-loader": "^0.7.10",
"@hapi/hapi": "^21.3.7",
"@ibm/tekton-lint": "^1.0.0-beta.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ process.on('SIGTERM', () => {
process.exit(0);
});

require('./mockVersion');
const port = require('../../../test_util/app-port')();

require('../../../..')();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ process.on('SIGTERM', () => {
process.exit(0);
});

require('./mockVersion');
const port = require('../../../test_util/app-port')();

require('../../../..')();
Expand Down
31 changes: 31 additions & 0 deletions packages/collector/test/tracing/protocols/grpc-js/mockVersion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* (c) Copyright IBM Corp. 2024
*/

'use strict';

const mock = require('mock-require');
const requireHook = require('../../../../../core/src/util/requireHook');

const INSTANA_GRPC_VERSION = process.env.INSTANA_GRPC_VERSION;
const GRPC_REQUIRE =
process.env.INSTANA_GRPC_VERSION === 'latest' ? '@grpc/grpc-js' : `@grpc/grpc-js-${INSTANA_GRPC_VERSION}`;

if (GRPC_REQUIRE !== '@grpc/grpc-js') {
mock('@grpc/grpc-js', GRPC_REQUIRE);
}

const originalOnFileLoad = requireHook.onFileLoad;
requireHook.onFileLoad = function onFileLoad() {
if (
arguments[0].source === '\\/@grpc\\/grpc-js\\/build\\/src\\/server\\.js' ||
arguments[0].source === '\\/@grpc\\/grpc-js\\/build\\/src\\/client\\.js'
) {
const str = arguments[0].source.replace('@grpc\\/grpc-js', GRPC_REQUIRE);
const reg = new RegExp(str, '');
arguments[0] = reg;
return originalOnFileLoad.apply(this, arguments);
}

return originalOnFileLoad.apply(this, arguments);
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ process.on('SIGTERM', () => {
process.exit(0);
});

require('./mockVersion');
const port = require('../../../test_util/app-port')();

require('../../../..')();
Expand Down
Loading

0 comments on commit a3be743

Please sign in to comment.