Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 69b8a41

Browse files
author
Nir Hadassi
authored
chore: upgrade to opentelemetry 0.21.0 (#130)
1 parent dc10948 commit 69b8a41

File tree

22 files changed

+130
-95
lines changed

22 files changed

+130
-95
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The instrumentations in this repo are:
2929
- strictly complies with [open telemetry semantic conventions](https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/trace/semantic_conventions)
3030
- up to date with latest SDK version
3131

32-
**Compatible with [SDK v0.20.0](https://github.com/open-telemetry/opentelemetry-js/releases/tag/v0.20.0)**
32+
**Compatible with [SDK v0.21.0](https://github.com/open-telemetry/opentelemetry-js/releases/tag/v0.21.0)**
3333
## Instrumentations
3434
| Instrumentation Package | Instrumented Lib | NPM |
3535
| --- | --- | --- |
@@ -52,10 +52,10 @@ The instrumentations in this repo are:
5252

5353

5454
## Compatability Table
55-
**Tested and verified against otel v0.20.0**
5655

5756
| Instrumentations Version | OpenTelemetry Version |
5857
| --- | --- |
58+
| 0.21.x | 0.21.0 |
5959
| 0.5.x | 0.20.0 |
6060
| 0.4.x | 0.19.0 |
6161
| 0.3.x | 0.18.0 |

detectors/node/resource-detector-deployment/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@
3232
"url": "https://github.com/aspecto-io/opentelemetry-ext-js/issues"
3333
},
3434
"peerDependencies": {
35-
"@opentelemetry/api": "^0.20.0"
35+
"@opentelemetry/api": "^0.21.0"
3636
},
3737
"dependencies": {
38-
"@opentelemetry/resources": "^0.20.0",
39-
"@opentelemetry/semantic-conventions": "^0.20.0",
38+
"@opentelemetry/resources": "^0.21.0",
39+
"@opentelemetry/semantic-conventions": "^0.21.0",
4040
"opentelemetry-resource-detector-sync-api": "^0.5.0"
4141
},
4242
"devDependencies": {
43-
"@opentelemetry/api": "^0.20.0",
43+
"@opentelemetry/api": "^0.21.0",
4444
"@types/mocha": "^8.2.2",
4545
"expect": "^26.6.2",
4646
"mocha": "^8.4.0",
47-
"opentelemetry-instrumentation-mocha": "0.0.1-rc.1",
47+
"opentelemetry-instrumentation-mocha": "0.0.1-rc.2",
4848
"ts-node": "^9.1.1",
4949
"typescript": "^4.0.5"
5050
},

detectors/node/resource-detector-service/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@
3232
"url": "https://github.com/aspecto-io/opentelemetry-ext-js/issues"
3333
},
3434
"peerDependencies": {
35-
"@opentelemetry/api": "^0.20.0"
35+
"@opentelemetry/api": "^0.21.0"
3636
},
3737
"dependencies": {
38-
"@opentelemetry/resources": "^0.20.0",
39-
"@opentelemetry/semantic-conventions": "^0.20.0",
38+
"@opentelemetry/resources": "^0.21.0",
39+
"@opentelemetry/semantic-conventions": "^0.21.0",
4040
"opentelemetry-resource-detector-sync-api": "^0.5.0",
4141
"uuid": "^8.3.2"
4242
},
4343
"devDependencies": {
44-
"@opentelemetry/api": "^0.20.0",
44+
"@opentelemetry/api": "^0.21.0",
4545
"@types/mocha": "^8.2.2",
4646
"expect": "^26.6.2",
4747
"mocha": "^8.4.0",
48-
"opentelemetry-instrumentation-mocha": "0.0.1-rc.1",
48+
"opentelemetry-instrumentation-mocha": "0.0.1-rc.2",
4949
"ts-node": "^9.1.1",
5050
"typescript": "^4.0.5"
5151
},

detectors/resource-detector-sync-api/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
"url": "https://github.com/aspecto-io/opentelemetry-ext-js/issues"
3030
},
3131
"peerDependencies": {
32-
"@opentelemetry/api": "^0.20.0"
32+
"@opentelemetry/api": "^0.21.0"
3333
},
3434
"dependencies": {
35-
"@opentelemetry/resources": "^0.20.0"
35+
"@opentelemetry/resources": "^0.21.0"
3636
},
3737
"devDependencies": {
3838
"ts-node": "^9.1.1",

packages/instrumentation-amqplib/package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,16 @@
3636
"bugs": {
3737
"url": "https://github.com/aspecto-io/opentelemetry-ext-js/issues"
3838
},
39+
"peerDependencies": {
40+
"@opentelemetry/api": "^0.21.0"
41+
},
3942
"dependencies": {
40-
"@opentelemetry/api": "^0.20.0",
41-
"@opentelemetry/instrumentation": "^0.20.0",
42-
"@opentelemetry/semantic-conventions": "^0.20.0"
43+
"@opentelemetry/instrumentation": "^0.21.0",
44+
"@opentelemetry/semantic-conventions": "^0.21.0"
4345
},
4446
"devDependencies": {
45-
"@opentelemetry/core": "^0.20.0",
47+
"@opentelemetry/api": "^0.21.0",
48+
"@opentelemetry/core": "^0.21.0",
4649
"@types/amqplib": "^0.5.17",
4750
"@types/lodash": "^4.14.168",
4851
"@types/mocha": "^8.2.2",
@@ -51,7 +54,7 @@
5154
"expect": "^26.6.2",
5255
"lodash": "^4.17.21",
5356
"mocha": "^8.4.0",
54-
"opentelemetry-instrumentation-mocha": "^0.0.1-rc.1",
57+
"opentelemetry-instrumentation-mocha": "0.0.1-rc.2",
5558
"opentelemetry-instrumentation-testing-utils": "^0.5.1",
5659
"sinon": "^9.2.4",
5760
"test-all-versions": "^5.0.1",

packages/instrumentation-amqplib/test/amqplib-callbacks.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ describe('amqplib instrumentation callback model', function () {
3232
beforeEach((done) => {
3333
instrumentation.enable();
3434
conn.createChannel(
35-
context.bind((err, c) => {
35+
context.bind(context.active(), (err, c) => {
3636
channel = c;
3737
// install an error handler, otherwise when we have tests that create error on the channel,
3838
// it throws and crash process
3939
channel.on('error', () => {});
4040
channel.assertQueue(
4141
queueName,
4242
{ durable: false },
43-
context.bind((err, ok) => {
43+
context.bind(context.active(), (err, ok) => {
4444
channel.purgeQueue(
4545
queueName,
46-
context.bind((err, ok) => {
46+
context.bind(context.active(), (err, ok) => {
4747
done();
4848
})
4949
);

packages/instrumentation-aws-sdk/package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,27 @@
3434
"bugs": {
3535
"url": "https://github.com/aspecto-io/opentelemetry-ext-js/issues"
3636
},
37+
"peerDependencies": {
38+
"@opentelemetry/api": "^0.21.0"
39+
},
3740
"dependencies": {
38-
"@opentelemetry/api": "^0.20.0",
39-
"@opentelemetry/core": "^0.20.0",
40-
"@opentelemetry/instrumentation": "^0.20.0",
41-
"@opentelemetry/semantic-conventions": "^0.20.0",
41+
"@opentelemetry/core": "^0.21.0",
42+
"@opentelemetry/instrumentation": "^0.21.0",
43+
"@opentelemetry/semantic-conventions": "^0.21.0",
4244
"opentelemetry-propagation-utils": "^0.7.1"
4345
},
4446
"devDependencies": {
4547
"@aws-sdk/client-s3": "3.13.1",
4648
"@aws-sdk/client-sqs": "3.13.1",
4749
"@aws-sdk/types": "3.13.1",
48-
"@opentelemetry/tracing": "^0.20.0",
50+
"@opentelemetry/api": "^0.21.0",
51+
"@opentelemetry/tracing": "^0.21.0",
4952
"@types/mocha": "^8.2.2",
5053
"aws-sdk": "^2.780.0",
5154
"expect": "^26.6.2",
5255
"mocha": "^8.4.0",
5356
"nock": "^13.0.11",
54-
"opentelemetry-instrumentation-mocha": "^0.0.1-rc.1",
57+
"opentelemetry-instrumentation-mocha": "0.0.1-rc.2",
5558
"opentelemetry-instrumentation-testing-utils": "^0.5.1",
5659
"test-all-versions": "^5.0.1",
5760
"ts-node": "^9.1.1",

packages/instrumentation-aws-sdk/src/aws-sdk.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,31 +99,31 @@ export class AwsInstrumentation extends InstrumentationBase<typeof AWS> {
9999
}
100100

101101
protected patchV3ConstructStack(moduleExports, moduleVersion: string) {
102-
diag.debug(`applying patch to aws-sdk v3 constructStack`);
102+
diag.debug(`aws-sdk instrumentation: applying patch to aws-sdk v3 constructStack`);
103103
this._wrap(moduleExports, 'constructStack', this._getV3ConstructStackPatch.bind(this, moduleVersion));
104104
return moduleExports;
105105
}
106106

107107
protected unpatchV3ConstructStack(moduleExports) {
108-
diag.debug(`applying unpatch to aws-sdk v3 constructStack`);
108+
diag.debug(`aws-sdk instrumentation: applying unpatch to aws-sdk v3 constructStack`);
109109
this._unwrap(moduleExports, 'constructStack');
110110
return moduleExports;
111111
}
112112

113113
protected patchV3SmithyClient(moduleExports) {
114-
diag.debug(`applying patch to aws-sdk v3 client send`);
114+
diag.debug(`aws-sdk instrumentation: applying patch to aws-sdk v3 client send`);
115115
this._wrap(moduleExports.Client.prototype, 'send', this._getV3SmithyClientSendPatch.bind(this));
116116
return moduleExports;
117117
}
118118

119119
protected unpatchV3SmithyClient(moduleExports) {
120-
diag.debug(`applying patch to aws-sdk v3 constructStack`);
120+
diag.debug(`aws-sdk instrumentation: applying patch to aws-sdk v3 constructStack`);
121121
this._unwrap(moduleExports.Client.prototype, 'send');
122122
return moduleExports;
123123
}
124124

125125
protected patchV2(moduleExports: typeof AWS, moduleVersion: string) {
126-
diag.debug(`applying patch to ${AwsInstrumentation.component}`);
126+
diag.debug(`aws-sdk instrumentation: applying patch to ${AwsInstrumentation.component}`);
127127
this.unpatchV2(moduleExports);
128128
this._wrap(moduleExports?.Request.prototype, 'send', this._getRequestSendPatch.bind(this, moduleVersion));
129129
this._wrap(moduleExports?.Request.prototype, 'promise', this._getRequestPromisePatch.bind(this, moduleVersion));
@@ -405,7 +405,7 @@ export class AwsInstrumentation extends InstrumentationBase<typeof AWS> {
405405
const span = self._startAwsV2Span(awsV2Request, requestMetadata, normalizedRequest, moduleVersion);
406406
awsV2Request[self.REQUEST_SPAN_KEY] = span;
407407
const activeContextWithSpan = trace.setSpan(context.active(), span);
408-
const callbackWithContext = context.bind(callback, activeContextWithSpan);
408+
const callbackWithContext = context.bind(activeContextWithSpan, callback);
409409

410410
self._callUserPreRequestHook(span, normalizedRequest);
411411
self._registerV2CompletedEvent(span, awsV2Request, normalizedRequest, activeContextWithSpan);

packages/instrumentation-aws-sdk/src/services/sqs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export class SqsServiceExtension implements ServiceExtension {
160160
propagation.inject(context.active(), attributes, sqsContextSetter);
161161
} else {
162162
diag.warn(
163-
'OpenTelemetry aws-sdk instrumentation cannot set context propagation on SQS message due to maximum amount of MessageAttributes'
163+
'aws-sdk instrumentation: cannot set context propagation on SQS message due to maximum amount of MessageAttributes'
164164
);
165165
}
166166
return attributes;

packages/instrumentation-aws-sdk/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ export const bindPromise = (
5353
): Promise<any> => {
5454
const origThen = target.then;
5555
target.then = function (onFulfilled, onRejected) {
56-
const newOnFulfilled = context.bind(onFulfilled, contextForCallbacks);
57-
const newOnRejected = context.bind(onRejected, contextForCallbacks);
56+
const newOnFulfilled = context.bind(contextForCallbacks, onFulfilled);
57+
const newOnRejected = context.bind(contextForCallbacks, onRejected);
5858
const patchedPromise = origThen.call(this, newOnFulfilled, newOnRejected);
5959
return rebindCount > 1 ? bindPromise(patchedPromise, contextForCallbacks, rebindCount - 1) : patchedPromise;
6060
};

0 commit comments

Comments
 (0)