From 6667f94bf22b87ffb8acad131a02d028d8ebdaa9 Mon Sep 17 00:00:00 2001 From: Chi Ma Date: Wed, 5 Jul 2023 12:47:08 +0700 Subject: [PATCH 1/6] feat(express): Skip update HTTP's span name and update RpcMetadata's route instead --- .../README.md | 2 +- .../src/instrumentation.ts | 20 +- .../src/types.ts | 2 +- .../test/custom-config.test.ts | 18 +- .../test/express.test.ts | 185 +++++++++--------- .../test/hooks.test.ts | 34 +--- .../test/ignore-all.test.ts | 12 +- 7 files changed, 117 insertions(+), 156 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-express/README.md b/plugins/node/opentelemetry-instrumentation-express/README.md index 7c937e8e98..6eba2b6c67 100644 --- a/plugins/node/opentelemetry-instrumentation-express/README.md +++ b/plugins/node/opentelemetry-instrumentation-express/README.md @@ -76,7 +76,7 @@ Express instrumentation has few options available to choose from. You can set th `spanNameHook` is invoked with 2 arguments: -- `info: ExpressRequestInfo` containing the incoming Express.js request, the current route handler creating a span and `ExpressLayerType` - the type of the handling layer or undefined when renaming the root HTTP instrumentation span. +- `info: ExpressRequestInfo` containing the incoming Express.js request, the current route handler creating a span and `ExpressLayerType` - the type of the handling layer. - `defaultName: string` - original name proposed by the instrumentation. #### Ignore a whole Express route diff --git a/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts index 2fda3891fd..ef2140f309 100644 --- a/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { setRPCMetadata, getRPCMetadata, RPCType } from '@opentelemetry/core'; +import { getRPCMetadata, RPCType } from '@opentelemetry/core'; import { trace, context, diag, SpanAttributes } from '@opentelemetry/api'; import type * as express from 'express'; import { ExpressInstrumentationConfig, ExpressRequestInfo } from './types'; @@ -202,14 +202,7 @@ export class ExpressInstrumentation extends InstrumentationBase< ExpressLayerType.REQUEST_HANDLER && rpcMetadata?.type === RPCType.HTTP ) { - const name = instrumentation._getSpanName( - { - request: req, - route, - }, - `${req.method} ${route.length > 0 ? route : '/'}` - ); - rpcMetadata.span.updateName(name); + rpcMetadata.route = route || '/'; } // verify against the config if the layer should be ignored @@ -270,13 +263,6 @@ export class ExpressInstrumentation extends InstrumentationBase< // verify we have a callback const args = Array.from(arguments); const callbackIdx = args.findIndex(arg => typeof arg === 'function'); - const newContext = - rpcMetadata?.type === RPCType.HTTP - ? setRPCMetadata( - context.active(), - Object.assign(rpcMetadata, { route: route }) - ) - : context.active(); if (callbackIdx >= 0) { arguments[callbackIdx] = function () { if (spanHasEnded === false) { @@ -288,7 +274,7 @@ export class ExpressInstrumentation extends InstrumentationBase< (req[_LAYERS_STORE_PROPERTY] as string[]).pop(); } const callback = args[callbackIdx] as Function; - return context.bind(newContext, callback).apply(this, arguments); + return callback.apply(this, arguments); }; } const result = original.apply(this, arguments); diff --git a/plugins/node/opentelemetry-instrumentation-express/src/types.ts b/plugins/node/opentelemetry-instrumentation-express/src/types.ts index d8498e3b93..51bb46913f 100644 --- a/plugins/node/opentelemetry-instrumentation-express/src/types.ts +++ b/plugins/node/opentelemetry-instrumentation-express/src/types.ts @@ -27,7 +27,7 @@ export type ExpressRequestInfo = { /** * If layerType is undefined, SpanNameHook is being invoked to rename the original root HTTP span. */ - layerType?: ExpressLayerType; + layerType: ExpressLayerType; }; export type SpanNameHook = ( diff --git a/plugins/node/opentelemetry-instrumentation-express/test/custom-config.test.ts b/plugins/node/opentelemetry-instrumentation-express/test/custom-config.test.ts index 7cff1c1174..d6b418c60c 100644 --- a/plugins/node/opentelemetry-instrumentation-express/test/custom-config.test.ts +++ b/plugins/node/opentelemetry-instrumentation-express/test/custom-config.test.ts @@ -23,7 +23,7 @@ import { } from '@opentelemetry/sdk-trace-base'; import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; import * as assert from 'assert'; -import { RPCType, setRPCMetadata } from '@opentelemetry/core'; +import { RPCMetadata, RPCType, setRPCMetadata } from '@opentelemetry/core'; import { ExpressLayerType } from '../src/enums/ExpressLayerType'; import { AttributeNames } from '../src/enums/AttributeNames'; import { ExpressInstrumentation, ExpressInstrumentationConfig } from '../src'; @@ -110,8 +110,9 @@ describe('ExpressInstrumentation', () => { }); it('should not repeat middleware paths in the span name', async () => { + let rpcMetadata: RPCMetadata; app.use((req, res, next) => { - const rpcMetadata = { type: RPCType.HTTP, span: rootSpan }; + rpcMetadata = { type: RPCType.HTTP, span: rootSpan }; return context.with( setRPCMetadata( trace.setSpan(context.active(), rootSpan), @@ -139,8 +140,6 @@ describe('ExpressInstrumentation', () => { assert.strictEqual(response, 'ok'); rootSpan.end(); - const spans = memoryExporter.getFinishedSpans(); - const requestHandlerSpan = memoryExporter .getFinishedSpans() .find(span => span.name.includes('request handler')); @@ -154,8 +153,7 @@ describe('ExpressInstrumentation', () => { requestHandlerSpan?.attributes[AttributeNames.EXPRESS_TYPE], 'request_handler' ); - const exportedRootSpan = spans.find(span => span.name === 'GET /mw'); - assert.notStrictEqual(exportedRootSpan, undefined); + assert.strictEqual(rpcMetadata.route, '/mw'); } ); }); @@ -167,8 +165,9 @@ describe('ExpressInstrumentation', () => { ExpressLayerType.REQUEST_HANDLER, ], } as ExpressInstrumentationConfig); + let rpcMetadata: RPCMetadata; app.use((req, res, next) => { - const rpcMetadata = { type: RPCType.HTTP, span: rootSpan }; + rpcMetadata = { type: RPCType.HTTP, span: rootSpan }; return context.with( setRPCMetadata( trace.setSpan(context.active(), rootSpan), @@ -192,8 +191,6 @@ describe('ExpressInstrumentation', () => { assert.strictEqual(response, 'ok'); rootSpan.end(); - const spans = memoryExporter.getFinishedSpans(); - const requestHandlerSpan = memoryExporter .getFinishedSpans() .find(span => span.name.includes('request handler')); @@ -207,8 +204,7 @@ describe('ExpressInstrumentation', () => { requestHandlerSpan?.attributes[AttributeNames.EXPRESS_TYPE], 'request_handler' ); - const exportedRootSpan = spans.find(span => span.name === 'GET /'); - assert.notStrictEqual(exportedRootSpan, undefined); + assert.strictEqual(rpcMetadata?.route, '/'); } ); }); diff --git a/plugins/node/opentelemetry-instrumentation-express/test/express.test.ts b/plugins/node/opentelemetry-instrumentation-express/test/express.test.ts index 04f2826f61..79b5f29488 100644 --- a/plugins/node/opentelemetry-instrumentation-express/test/express.test.ts +++ b/plugins/node/opentelemetry-instrumentation-express/test/express.test.ts @@ -32,6 +32,8 @@ instrumentation.enable(); instrumentation.disable(); import * as express from 'express'; +import { RPCMetadata, getRPCMetadata } from '@opentelemetry/core'; +import { Server } from 'http'; describe('ExpressInstrumentation', () => { const provider = new NodeTracerProvider(); @@ -54,6 +56,11 @@ describe('ExpressInstrumentation', () => { }); describe('Instrumenting normal get operations', () => { + let server: Server, port: number; + afterEach(() => { + server?.close(); + }); + it('should create a child span for middlewares', async () => { const rootSpan = tracer.startSpan('rootSpan'); const customMiddleware: express.RequestHandler = (req, res, next) => { @@ -63,22 +70,22 @@ describe('ExpressInstrumentation', () => { return next(); }; let finishListenerCount: number | undefined; - const { server, port } = await serverWithMiddleware( - tracer, - rootSpan, - app => { - app.use(express.json()); - app.use((req, res, next) => { - res.on('finish', () => { - finishListenerCount = res.listenerCount('finish'); - }); - next(); + let rpcMetadata: RPCMetadata | undefined; + const httpServer = await serverWithMiddleware(tracer, rootSpan, app => { + app.use(express.json()); + app.use((req, res, next) => { + rpcMetadata = getRPCMetadata(context.active()); + res.on('finish', () => { + finishListenerCount = res.listenerCount('finish'); }); - for (let index = 0; index < 15; index++) { - app.use(customMiddleware); - } + next(); + }); + for (let index = 0; index < 15; index++) { + app.use(customMiddleware); } - ); + }); + server = httpServer.server; + port = httpServer.port; assert.strictEqual(memoryExporter.getFinishedSpans().length, 0); await context.with( trace.setSpan(context.active(), rootSpan), @@ -113,39 +120,34 @@ describe('ExpressInstrumentation', () => { requestHandlerSpan?.attributes[AttributeNames.EXPRESS_TYPE], 'request_handler' ); - const exportedRootSpan = memoryExporter - .getFinishedSpans() - .find(span => span.name === 'GET /toto/:id'); - assert.notStrictEqual(exportedRootSpan, undefined); + assert.strictEqual(rpcMetadata?.route, '/toto/:id'); } ); - server.close(); }); it('supports sync middlewares directly responding', async () => { const rootSpan = tracer.startSpan('rootSpan'); let finishListenerCount: number | undefined; - const { server, port } = await serverWithMiddleware( - tracer, - rootSpan, - app => { - app.use((req, res, next) => { - res.on('finish', () => { - finishListenerCount = res.listenerCount('finish'); - }); - next(); + const httpServer = await serverWithMiddleware(tracer, rootSpan, app => { + app.use((req, res, next) => { + res.on('finish', () => { + finishListenerCount = res.listenerCount('finish'); }); - const syncMiddleware: express.RequestHandler = (req, res, next) => { - for (let i = 0; i < 1000000; i++) { - continue; - } - res.status(200).end('middleware'); - }; - for (let index = 0; index < 15; index++) { - app.use(syncMiddleware); + next(); + }); + const syncMiddleware: express.RequestHandler = (req, res, next) => { + for (let i = 0; i < 1000000; i++) { + continue; } + res.status(200).end('middleware'); + }; + for (let index = 0; index < 15; index++) { + app.use(syncMiddleware); } - ); + }); + server = httpServer.server; + port = httpServer.port; + assert.strictEqual(memoryExporter.getFinishedSpans().length, 0); await context.with( trace.setSpan(context.active(), rootSpan), @@ -165,32 +167,30 @@ describe('ExpressInstrumentation', () => { ); } ); - server.close(); }); it('supports async middlewares', async () => { const rootSpan = tracer.startSpan('rootSpan'); let finishListenerCount: number | undefined; - const { server, port } = await serverWithMiddleware( - tracer, - rootSpan, - app => { - app.use((req, res, next) => { - res.on('finish', () => { - finishListenerCount = res.listenerCount('finish'); - }); - next(); + const httpServer = await serverWithMiddleware(tracer, rootSpan, app => { + app.use((req, res, next) => { + res.on('finish', () => { + finishListenerCount = res.listenerCount('finish'); }); - const asyncMiddleware: express.RequestHandler = (req, res, next) => { - setTimeout(() => { - next(); - }, 50); - }; - for (let index = 0; index < 15; index++) { - app.use(asyncMiddleware); - } + next(); + }); + const asyncMiddleware: express.RequestHandler = (req, res, next) => { + setTimeout(() => { + next(); + }, 50); + }; + for (let index = 0; index < 15; index++) { + app.use(asyncMiddleware); } - ); + }); + server = httpServer.server; + port = httpServer.port; + assert.strictEqual(memoryExporter.getFinishedSpans().length, 0); await context.with( trace.setSpan(context.active(), rootSpan), @@ -210,32 +210,30 @@ describe('ExpressInstrumentation', () => { ); } ); - server.close(); }); it('supports async middlewares directly responding', async () => { const rootSpan = tracer.startSpan('rootSpan'); let finishListenerCount: number | undefined; - const { server, port } = await serverWithMiddleware( - tracer, - rootSpan, - app => { - app.use((req, res, next) => { - res.on('finish', () => { - finishListenerCount = res.listenerCount('finish'); - }); - next(); + const httpServer = await serverWithMiddleware(tracer, rootSpan, app => { + app.use((req, res, next) => { + res.on('finish', () => { + finishListenerCount = res.listenerCount('finish'); }); - const asyncMiddleware: express.RequestHandler = (req, res, next) => { - setTimeout(() => { - res.status(200).end('middleware'); - }, 50); - }; - for (let index = 0; index < 15; index++) { - app.use(asyncMiddleware); - } + next(); + }); + const asyncMiddleware: express.RequestHandler = (req, res, next) => { + setTimeout(() => { + res.status(200).end('middleware'); + }, 50); + }; + for (let index = 0; index < 15; index++) { + app.use(asyncMiddleware); } - ); + }); + server = httpServer.server; + port = httpServer.port; + assert.strictEqual(memoryExporter.getFinishedSpans().length, 0); await context.with( trace.setSpan(context.active(), rootSpan), @@ -255,7 +253,6 @@ describe('ExpressInstrumentation', () => { ); } ); - server.close(); }); it('should not create span because there are no parent', async () => { @@ -270,33 +267,36 @@ describe('ExpressInstrumentation', () => { router.get('/:id', (req, res, next) => { return res.status(200).end('test'); }); - const { server, port } = await createServer(app); + const httpServer = await createServer(app); + server = httpServer.server; + port = httpServer.port; assert.strictEqual(memoryExporter.getFinishedSpans().length, 0); const res = await httpRequest.get(`http://localhost:${port}/toto/tata`); assert.strictEqual(memoryExporter.getFinishedSpans().length, 0); assert.strictEqual(res, 'test'); - server.close(); }); }); describe('Disabling plugin', () => { + let server: Server, port: number; + afterEach(() => { + server?.close(); + }); it('should not create new spans', async () => { instrumentation.disable(); const rootSpan = tracer.startSpan('rootSpan'); - const { server, port } = await serverWithMiddleware( - tracer, - rootSpan, - app => { - app.use(express.json()); - const customMiddleware: express.RequestHandler = (req, res, next) => { - for (let i = 0; i < 1000; i++) { - continue; - } - return next(); - }; - app.use(customMiddleware); - } - ); + const httpServer = await serverWithMiddleware(tracer, rootSpan, app => { + app.use(express.json()); + const customMiddleware: express.RequestHandler = (req, res, next) => { + for (let i = 0; i < 1000; i++) { + continue; + } + return next(); + }; + app.use(customMiddleware); + }); + server = httpServer.server; + port = httpServer.port; assert.strictEqual(memoryExporter.getFinishedSpans().length, 0); await context.with( trace.setSpan(context.active(), rootSpan), @@ -312,7 +312,6 @@ describe('ExpressInstrumentation', () => { ); } ); - server.close(); }); }); }); diff --git a/plugins/node/opentelemetry-instrumentation-express/test/hooks.test.ts b/plugins/node/opentelemetry-instrumentation-express/test/hooks.test.ts index f15a496501..90d98a356c 100644 --- a/plugins/node/opentelemetry-instrumentation-express/test/hooks.test.ts +++ b/plugins/node/opentelemetry-instrumentation-express/test/hooks.test.ts @@ -34,6 +34,7 @@ instrumentation.enable(); instrumentation.disable(); import { httpRequest, serverWithMiddleware } from './utils'; +import { RPCMetadata, getRPCMetadata } from '@opentelemetry/core'; describe('ExpressInstrumentation hooks', () => { const provider = new NodeTracerProvider(); @@ -59,12 +60,14 @@ describe('ExpressInstrumentation hooks', () => { let server: http.Server; let port: number; let rootSpan: Span; + let rpcMetadata: RPCMetadata | undefined; beforeEach(async () => { rootSpan = tracer.startSpan('rootSpan'); const httpServer = await serverWithMiddleware(tracer, rootSpan, app => { app.get('*', (req, res) => { + rpcMetadata = getRPCMetadata(context.active()); res.send('ok'); }); }); @@ -78,16 +81,8 @@ describe('ExpressInstrumentation hooks', () => { it('should rename spans', async () => { instrumentation.setConfig({ - spanNameHook: ({ request, route, layerType }, defaultName) => { - if (layerType) { - return `hook - ${route}`; - } - - if (route === '*') { - return `parent - ${request.method} ${request.url}`; - } - - return defaultName; + spanNameHook: ({ route, layerType }) => { + return `custom: ${layerType} - ${route}`; }, }); @@ -101,12 +96,7 @@ describe('ExpressInstrumentation hooks', () => { assert.strictEqual(spans.length, 2); assert.notStrictEqual( - spans.find(span => span.name === 'parent - GET /foo/3'), - undefined - ); - - assert.notStrictEqual( - spans.find(span => span.name === 'hook - *'), + spans.find(span => span.name === 'custom: request_handler - *'), undefined ); } @@ -129,11 +119,7 @@ describe('ExpressInstrumentation hooks', () => { const spans = memoryExporter.getFinishedSpans(); assert.strictEqual(spans.length, 2); - assert.notStrictEqual( - spans.find(span => span.name === 'GET *'), - undefined - ); - + assert.strictEqual(rpcMetadata?.route, '*'); assert.notStrictEqual( spans.find(span => span.name === 'request handler - *'), undefined @@ -159,11 +145,7 @@ describe('ExpressInstrumentation hooks', () => { const spans = memoryExporter.getFinishedSpans(); assert.strictEqual(spans.length, 2); - assert.notStrictEqual( - spans.find(span => span.name === 'GET *'), - undefined - ); - + assert.strictEqual(rpcMetadata?.route, '*'); assert.notStrictEqual( spans.find(span => span.name === 'request handler - *'), undefined diff --git a/plugins/node/opentelemetry-instrumentation-express/test/ignore-all.test.ts b/plugins/node/opentelemetry-instrumentation-express/test/ignore-all.test.ts index ae07b1efcf..92c7c7046b 100644 --- a/plugins/node/opentelemetry-instrumentation-express/test/ignore-all.test.ts +++ b/plugins/node/opentelemetry-instrumentation-express/test/ignore-all.test.ts @@ -22,7 +22,7 @@ import { SimpleSpanProcessor, } from '@opentelemetry/sdk-trace-base'; import * as assert from 'assert'; -import { RPCType, setRPCMetadata } from '@opentelemetry/core'; +import { RPCMetadata, RPCType, setRPCMetadata } from '@opentelemetry/core'; import { AttributeNames } from '../src/enums/AttributeNames'; import { ExpressInstrumentation, ExpressLayerType } from '../src'; import { createServer, httpRequest } from './utils'; @@ -64,13 +64,14 @@ describe('ExpressInstrumentation', () => { let server: http.Server; let port: number; let rootSpan: Span; + let rpcMetadata: RPCMetadata; beforeEach(async () => { rootSpan = tracer.startSpan('rootSpan'); const app = express(); app.use((req, res, next) => { - const rpcMetadata = { type: RPCType.HTTP, span: rootSpan }; + rpcMetadata = { type: RPCType.HTTP, span: rootSpan }; return context.with( setRPCMetadata( trace.setSpan(context.active(), rootSpan), @@ -126,17 +127,14 @@ describe('ExpressInstrumentation', () => { ); }); - it('root span name should be modified to GET /todo/:id', async () => { + it('rpcMetadata.route should be modified to /todo/:id', async () => { assert.strictEqual(memoryExporter.getFinishedSpans().length, 0); await context.with( trace.setSpan(context.active(), rootSpan), async () => { await httpRequest.get(`http://localhost:${port}/toto/tata`); rootSpan.end(); - const exportedRootSpan = memoryExporter - .getFinishedSpans() - .find(span => span.name === 'GET /toto/:id'); - assert.notStrictEqual(exportedRootSpan, undefined); + assert.strictEqual(rpcMetadata.route, '/toto/:id'); } ); }); From 1f530466ea2a7bdee1199647dd64ebaf3c970f70 Mon Sep 17 00:00:00 2001 From: Chi Ma Date: Wed, 5 Jul 2023 13:32:20 +0700 Subject: [PATCH 2/6] feat(express): simplify condition to when written to rpcMetadata.route --- .../src/instrumentation.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts index ef2140f309..0c27a8a88f 100644 --- a/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-express/src/instrumentation.ts @@ -198,8 +198,7 @@ export class ExpressInstrumentation extends InstrumentationBase< // once we reach the request handler const rpcMetadata = getRPCMetadata(context.active()); if ( - metadata.attributes[AttributeNames.EXPRESS_TYPE] === - ExpressLayerType.REQUEST_HANDLER && + type === ExpressLayerType.REQUEST_HANDLER && rpcMetadata?.type === RPCType.HTTP ) { rpcMetadata.route = route || '/'; From 19c6b010c2205716364efa117cd174053fd12123 Mon Sep 17 00:00:00 2001 From: Chi Ma Date: Wed, 5 Jul 2023 13:36:13 +0700 Subject: [PATCH 3/6] feat(express): remove comment related to layerType being undefined --- .../node/opentelemetry-instrumentation-express/src/types.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-express/src/types.ts b/plugins/node/opentelemetry-instrumentation-express/src/types.ts index 51bb46913f..a6d376face 100644 --- a/plugins/node/opentelemetry-instrumentation-express/src/types.ts +++ b/plugins/node/opentelemetry-instrumentation-express/src/types.ts @@ -24,9 +24,6 @@ export type IgnoreMatcher = string | RegExp | ((name: string) => boolean); export type ExpressRequestInfo = { request: Request; route: string; - /** - * If layerType is undefined, SpanNameHook is being invoked to rename the original root HTTP span. - */ layerType: ExpressLayerType; }; From 6300a5f21411c4540f53cd475cd722490a4be620 Mon Sep 17 00:00:00 2001 From: Chi Ma Date: Mon, 10 Jul 2023 12:00:50 +0700 Subject: [PATCH 4/6] chore: force build From 483c7f1b59d47cfb9b5583159dd0ca91c4aa95ce Mon Sep 17 00:00:00 2001 From: Chi Ma Date: Mon, 10 Jul 2023 13:50:13 +0700 Subject: [PATCH 5/6] chore: force cache key --- .github/workflows/unit-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 57c9f4e143..7f5498e2bf 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -144,7 +144,7 @@ jobs: plugins/web/*/package-lock.json propagators/*/node_modules propagators/*/package-lock.json - key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('package.json', 'detectors/node/*/package.json', 'metapackages/*/package.json', 'packages/*/package.json', 'plugins/node/*/package.json', 'plugins/web/*/package.json', 'propagators/*/package.json') }} + key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('package.json', 'detectors/node/*/package.json', 'metapackages/*/package.json', 'packages/*/package.json', 'plugins/node/*/package.json', 'plugins/web/*/package.json', 'propagators/*/package.json') }}-v2 - name: Legacy Peer Dependencies for npm 7 if: matrix.node == '16' run: npm config set legacy-peer-deps=true @@ -197,7 +197,7 @@ jobs: plugins/web/*/package-lock.json propagators/*/node_modules propagators/*/package-lock.json - key: ${{ runner.os }}${{ matrix.node }}-browser-${{ hashFiles('package.json', 'detectors/node/*/package.json', 'metapackages/*/package.json', 'packages/*/package.json', 'plugins/node/*/package.json', 'plugins/web/*/package.json', 'propagators/*/package.json') }} + key: ${{ runner.os }}${{ matrix.node }}-browser-${{ hashFiles('package.json', 'detectors/node/*/package.json', 'metapackages/*/package.json', 'packages/*/package.json', 'plugins/node/*/package.json', 'plugins/web/*/package.json', 'propagators/*/package.json') }}-v2 - name: Install Root Dependencies run: npm install --ignore-scripts - name: Bootstrap Dependencies From 63fe62aeb764c466326a3e199e3405f51fb3e00d Mon Sep 17 00:00:00 2001 From: Chi Ma Date: Mon, 10 Jul 2023 14:35:50 +0700 Subject: [PATCH 6/6] Revert "chore: force cache key" This reverts commit 483c7f1b59d47cfb9b5583159dd0ca91c4aa95ce. --- .github/workflows/unit-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 7f5498e2bf..57c9f4e143 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -144,7 +144,7 @@ jobs: plugins/web/*/package-lock.json propagators/*/node_modules propagators/*/package-lock.json - key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('package.json', 'detectors/node/*/package.json', 'metapackages/*/package.json', 'packages/*/package.json', 'plugins/node/*/package.json', 'plugins/web/*/package.json', 'propagators/*/package.json') }}-v2 + key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('package.json', 'detectors/node/*/package.json', 'metapackages/*/package.json', 'packages/*/package.json', 'plugins/node/*/package.json', 'plugins/web/*/package.json', 'propagators/*/package.json') }} - name: Legacy Peer Dependencies for npm 7 if: matrix.node == '16' run: npm config set legacy-peer-deps=true @@ -197,7 +197,7 @@ jobs: plugins/web/*/package-lock.json propagators/*/node_modules propagators/*/package-lock.json - key: ${{ runner.os }}${{ matrix.node }}-browser-${{ hashFiles('package.json', 'detectors/node/*/package.json', 'metapackages/*/package.json', 'packages/*/package.json', 'plugins/node/*/package.json', 'plugins/web/*/package.json', 'propagators/*/package.json') }}-v2 + key: ${{ runner.os }}${{ matrix.node }}-browser-${{ hashFiles('package.json', 'detectors/node/*/package.json', 'metapackages/*/package.json', 'packages/*/package.json', 'plugins/node/*/package.json', 'plugins/web/*/package.json', 'propagators/*/package.json') }} - name: Install Root Dependencies run: npm install --ignore-scripts - name: Bootstrap Dependencies