Skip to content

Commit 43daf20

Browse files
committed
wip: address pr comments
1 parent 0bff27e commit 43daf20

File tree

7 files changed

+316
-517
lines changed

7 files changed

+316
-517
lines changed

packages/opentelemetry-instrumentation-typed-express-router/examples/simple-express-app.js

Lines changed: 0 additions & 82 deletions
This file was deleted.

packages/opentelemetry-instrumentation-typed-express-router/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55
export * from './instrumentation';
66
export * from './types';
77
export { ApiTsAttributes } from './utils';
8-
export { VERSION } from './version';

packages/opentelemetry-instrumentation-typed-express-router/src/instrumentation.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import {
99
import { context, SpanKind } from '@opentelemetry/api';
1010

1111
import { TypedExpressRouterInstrumentationConfig, kPatched } from './types';
12-
import { VERSION } from './version';
12+
const { version } = require('../package.json');
1313
import { ApiTsAttributes, handleGenericError } from './utils';
1414

1515
/**
1616
* OpenTelemetry instrumentation for @api-ts/typed-express-router
1717
*/
1818
export class TypedExpressRouterInstrumentation extends InstrumentationBase<TypedExpressRouterInstrumentationConfig> {
1919
constructor(config: TypedExpressRouterInstrumentationConfig = {}) {
20-
super('opentelemetry-instrumentation-typed-express-router', VERSION, config);
20+
super('opentelemetry-instrumentation-typed-express-router', version, config);
2121
}
2222

2323
protected init() {
@@ -27,7 +27,6 @@ export class TypedExpressRouterInstrumentation extends InstrumentationBase<Typed
2727
['>=0.0.0'],
2828
(moduleExports: any, moduleVersion) => {
2929
this._diag.debug(`Patching @api-ts/typed-express-router@${moduleVersion}`);
30-
3130
// Patch wrapRouter function which is responsible for creating the router
3231
if (typeof moduleExports.wrapRouter === 'function') {
3332
const original = moduleExports.wrapRouter;
@@ -91,7 +90,6 @@ export class TypedExpressRouterInstrumentation extends InstrumentationBase<Typed
9190
*/
9291
private _patchWrapRouter(original: Function) {
9392
const instrumentation = this;
94-
9593
const patched = function (this: unknown, ...args: any[]) {
9694
// Call the original wrapRouter function
9795
const wrappedRouter = original.apply(this, args);

packages/opentelemetry-instrumentation-typed-express-router/src/version.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/opentelemetry-instrumentation-typed-express-router/test/instrumentation.test.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,6 @@ import { test } from 'node:test';
66
import assert from 'node:assert';
77
import { TypedExpressRouterInstrumentation } from '../src';
88

9-
// Setup for all tests but not used in simple tests
10-
// Kept for reference when adding more complex tests
11-
/*
12-
function setupTracing() {
13-
const provider = new NodeTracerProvider();
14-
const memoryExporter = new InMemorySpanExporter();
15-
provider.register();
16-
17-
return {
18-
provider,
19-
memoryExporter,
20-
getSpans: () => memoryExporter.getFinishedSpans(),
21-
resetSpans: () => memoryExporter.reset(),
22-
};
23-
};
24-
*/
25-
269
test('TypedExpressRouterInstrumentation constructor', async () => {
2710
// Test that the instrumentation can be instantiated without error
2811
const instrumentation = new TypedExpressRouterInstrumentation();
@@ -53,7 +36,3 @@ test('TypedExpressRouterInstrumentation enable/disable', async () => {
5336
instrumentation.disable();
5437
assert.strictEqual(instrumentation.isEnabled(), false);
5538
});
56-
57-
// Note: We cannot test the actual patching functionality in isolation
58-
// because it requires a real typed-express-router module.
59-
// Integration tests will cover this part.

0 commit comments

Comments
 (0)