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

Commit acdc802

Browse files
mottibecMotti Bechhofer
and
Motti Bechhofer
authored
upgrade otel versions (#272)
* try to upgrade otel versions * run prettier * fix all ts errors * prettier * fix build and test * update aspecto-opentelemetry-instrumentation-mocha * update node version * update ts and skipLibCheck * update ts-node * fix tests * change neo4j docker version --------- Co-authored-by: Motti Bechhofer <[email protected]>
1 parent 3be217b commit acdc802

File tree

45 files changed

+592
-461
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+592
-461
lines changed

.github/workflows/daily-test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ jobs:
2424
- 27017:27017
2525

2626
neo4j:
27-
image: neo4j:4.2.3
27+
image: neo4j:4.4.34
2828
ports:
2929
- 7474:7474
3030
- 11011:7687
3131
env:
32-
NEO4J_AUTH: neo4j/test
32+
NEO4J_AUTH: neo4j/your_password
3333

3434

3535
steps:

.github/workflows/test.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ jobs:
2323
- 27017:27017
2424

2525
neo4j:
26-
image: neo4j:4.2.3
26+
image: neo4j:4.4.34
2727
ports:
2828
- 7474:7474
2929
- 11011:7687
3030
env:
31-
NEO4J_AUTH: neo4j/test
31+
NEO4J_AUTH: neo4j/your_password
3232

3333
steps:
3434

@@ -39,10 +39,10 @@ jobs:
3939
- name: Fetch all history for all tags and branches
4040
run: git fetch
4141

42-
- name: Use Node.js 14
42+
- name: Use Node.js 18
4343
uses: actions/setup-node@v1
4444
with:
45-
node-version: 14
45+
node-version: 18
4646

4747
- name: Install Dependencies
4848
run: yarn install

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@
3333
"url": "https://github.com/aspecto-io/opentelemetry-ext-js/issues"
3434
},
3535
"peerDependencies": {
36-
"@opentelemetry/api": "^1.6.0"
36+
"@opentelemetry/api": "^1.8.0"
3737
},
3838
"dependencies": {
39-
"@opentelemetry/resources": "~1.17.1",
40-
"@opentelemetry/semantic-conventions": "^1.17.1",
39+
"@opentelemetry/resources": "~1.24.1",
40+
"@opentelemetry/semantic-conventions": "^1.24.1",
4141
"opentelemetry-resource-detector-sync-api": "^0.29.0"
4242
},
4343
"devDependencies": {
44-
"@opentelemetry/api": "^1.6.0",
44+
"@opentelemetry/api": "^1.8.0",
4545
"@types/mocha": "^8.2.2",
4646
"expect": "^26.6.2",
4747
"mocha": "^8.4.0",
48-
"opentelemetry-instrumentation-mocha": "0.0.7-alpha.1",
49-
"ts-node": "^9.1.1",
50-
"typescript": "4.3.4"
48+
"aspecto-opentelemetry-instrumentation-mocha": "0.0.9-alpha.0",
49+
"ts-node": "^10.9.2",
50+
"typescript": "5.4.5"
5151
},
5252
"mocha": {
5353
"extension": [
@@ -56,7 +56,7 @@
5656
"spec": "test/**/*.spec.ts",
5757
"require": [
5858
"ts-node/register",
59-
"opentelemetry-instrumentation-mocha"
59+
"aspecto-opentelemetry-instrumentation-mocha"
6060
]
6161
}
6262
}

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,24 @@
3434
"url": "https://github.com/aspecto-io/opentelemetry-ext-js/issues"
3535
},
3636
"peerDependencies": {
37-
"@opentelemetry/api": "^1.6.0"
37+
"@opentelemetry/api": "^1.8.0"
3838
},
3939
"dependencies": {
40-
"@opentelemetry/resources": "~1.17.1",
41-
"@opentelemetry/semantic-conventions": "^1.17.1",
40+
"@opentelemetry/resources": "~1.24.1",
41+
"@opentelemetry/semantic-conventions": "^1.24.1",
4242
"opentelemetry-resource-detector-sync-api": "^0.29.0",
4343
"uuid": "^8.3.2"
4444
},
4545
"devDependencies": {
46-
"@opentelemetry/api": "^1.6.0",
46+
"@opentelemetry/api": "^1.8.0",
4747
"@types/mocha": "^8.2.2",
4848
"@types/node": "^14.0.0",
4949
"expect": "^26.6.2",
5050
"mocha": "^8.4.0",
51-
"opentelemetry-instrumentation-mocha": "0.0.7-alpha.1",
51+
"aspecto-opentelemetry-instrumentation-mocha": "0.0.9-alpha.0",
5252
"sinon": "^11.1.1",
53-
"ts-node": "^9.1.1",
54-
"typescript": "4.3.4"
53+
"ts-node": "^10.9.2",
54+
"typescript": "5.4.5"
5555
},
5656
"mocha": {
5757
"extension": [
@@ -60,7 +60,7 @@
6060
"spec": "test/**/*.spec.ts",
6161
"require": [
6262
"ts-node/register",
63-
"opentelemetry-instrumentation-mocha"
63+
"aspecto-opentelemetry-instrumentation-mocha"
6464
]
6565
}
6666
}

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@
3333
"url": "https://github.com/aspecto-io/opentelemetry-ext-js/issues"
3434
},
3535
"peerDependencies": {
36-
"@opentelemetry/api": "^1.6.0"
36+
"@opentelemetry/api": "^1.8.0"
3737
},
3838
"dependencies": {
39-
"@opentelemetry/resources": "~1.17.1",
40-
"@opentelemetry/semantic-conventions": "^1.17.1",
39+
"@opentelemetry/resources": "~1.24.1",
40+
"@opentelemetry/semantic-conventions": "^1.24.1",
4141
"opentelemetry-resource-detector-sync-api": "^0.29.0",
4242
"uuid": "^8.3.2"
4343
},
4444
"devDependencies": {
45-
"@opentelemetry/api": "^1.6.0",
45+
"@opentelemetry/api": "^1.8.0",
4646
"@types/mocha": "^8.2.2",
4747
"expect": "^26.6.2",
4848
"mocha": "^8.4.0",
49-
"opentelemetry-instrumentation-mocha": "0.0.7-alpha.1",
50-
"ts-node": "^9.1.1",
51-
"typescript": "4.3.4"
49+
"aspecto-opentelemetry-instrumentation-mocha": "0.0.9-alpha.0",
50+
"ts-node": "^10.9.2",
51+
"typescript": "5.4.5"
5252
},
5353
"mocha": {
5454
"extension": [
@@ -57,7 +57,7 @@
5757
"spec": "test/**/*.spec.ts",
5858
"require": [
5959
"ts-node/register",
60-
"opentelemetry-instrumentation-mocha"
60+
"aspecto-opentelemetry-instrumentation-mocha"
6161
]
6262
}
6363
}

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
"url": "https://github.com/aspecto-io/opentelemetry-ext-js/issues"
3131
},
3232
"peerDependencies": {
33-
"@opentelemetry/api": "^1.6.0"
33+
"@opentelemetry/api": "^1.8.0"
3434
},
3535
"dependencies": {
36-
"@opentelemetry/resources": "~1.17.1"
36+
"@opentelemetry/resources": "~1.24.1"
3737
},
3838
"devDependencies": {
39-
"@opentelemetry/api": "^1.6.0",
40-
"ts-node": "^9.1.1",
41-
"typescript": "4.3.4"
39+
"@opentelemetry/api": "^1.8.0",
40+
"ts-node": "^10.9.2",
41+
"typescript": "5.4.5"
4242
}
4343
}

lerna.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"packages": ["packages/*", "detectors/*", "detectors/node/*", "propagators/*", "examples/*"],
33
"version": "independent",
4-
"npmClient": "yarn",
5-
"useWorkspaces": true
4+
"npmClient": "yarn"
65
}

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
"test:ci:all": "lerna run test:ci --parallel",
99
"build": "lerna run build",
1010
"build:ci": "lerna run build",
11-
"postinstall": "lerna bootstrap",
1211
"prettier": "prettier --config .prettierrc.yml --write --ignore-unknown \"**/*\"",
13-
"prettier:check": "npx prettier@2.3.2 --config .prettierrc.yml --check --ignore-unknown \"**/*\"",
12+
"prettier:check": "npx [email protected].5 --config .prettierrc.yml --check --ignore-unknown \"**/*\"",
1413
"version:update": "lerna run version:update",
1514
"version": "git add packages/**/version.ts",
1615
"publish:ci": "lerna publish --yes --allow-branch master --create-release github --conventionalCommits",
1716
"publish:ci:prerelease": "lerna publish --yes --no-git-tag-version --no-push --no-changelog --dist-tag alpha"
1817
},
1918
"devDependencies": {
20-
"lerna": "^3.22.1",
21-
"prettier": "2.3.2"
19+
"@types/node": "^20.12.12",
20+
"lerna": "^8.1.3",
21+
"prettier": "3.2.5"
2222
},
2323
"workspaces": [
2424
"packages/*",

packages/instrumentation-elasticsearch/package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,28 @@
4242
"url": "https://github.com/aspecto-io/opentelemetry-ext-js/issues"
4343
},
4444
"peerDependencies": {
45-
"@opentelemetry/api": "^1.6.0"
45+
"@opentelemetry/api": "^1.8.0"
4646
},
4747
"dependencies": {
48-
"@opentelemetry/core": "^1.17.1",
49-
"@opentelemetry/instrumentation": "^0.44.0",
50-
"@opentelemetry/semantic-conventions": "^1.17.1"
48+
"@opentelemetry/core": "^1.24.1",
49+
"@opentelemetry/instrumentation": "^0.51.1",
50+
"@opentelemetry/semantic-conventions": "^1.24.1"
5151
},
5252
"devDependencies": {
5353
"@elastic/elasticsearch": "^7.8.0",
54-
"@opentelemetry/api": "^1.6.0",
55-
"@opentelemetry/contrib-test-utils": "^0.34.2",
54+
"@opentelemetry/api": "^1.8.0",
55+
"@opentelemetry/contrib-test-utils": "^0.39.0",
5656
"@types/chai": "^4.2.15",
5757
"@types/mocha": "^8.2.2",
5858
"chai": "^4.3.0",
5959
"expect": "^26.6.2",
6060
"mocha": "^8.4.0",
6161
"nock": "^13.0.9",
62-
"opentelemetry-instrumentation-mocha": "0.0.7-alpha.1",
62+
"aspecto-opentelemetry-instrumentation-mocha": "0.0.9-alpha.0",
6363
"sinon": "^9.2.4",
6464
"test-all-versions": "^5.0.1",
65-
"ts-node": "^9.1.1",
66-
"typescript": "4.3.4"
65+
"ts-node": "^10.9.2",
66+
"typescript": "5.4.5"
6767
},
6868
"mocha": {
6969
"extension": [
@@ -72,7 +72,7 @@
7272
"spec": "test/**/*.spec.ts",
7373
"require": [
7474
"ts-node/register",
75-
"opentelemetry-instrumentation-mocha"
75+
"aspecto-opentelemetry-instrumentation-mocha"
7676
]
7777
}
7878
}

packages/instrumentation-elasticsearch/src/elasticsearch.ts

+11-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from '@opentelemetry/instrumentation';
1111
import { VERSION } from './version';
1212
import { AttributeNames } from './enums';
13-
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
13+
import { SEMATTRS_DB_OPERATION, SEMATTRS_DB_STATEMENT, SemanticAttributes } from '@opentelemetry/semantic-conventions';
1414
import {
1515
startSpan,
1616
onError,
@@ -21,7 +21,7 @@ import {
2121
} from './utils';
2222
import { ELASTICSEARCH_API_FILES } from './helpers';
2323

24-
export class ElasticsearchInstrumentation extends InstrumentationBase<typeof elasticsearch> {
24+
export class ElasticsearchInstrumentation extends InstrumentationBase {
2525
static readonly component = '@elastic/elasticsearch';
2626

2727
protected override _config: ElasticsearchInstrumentationConfig;
@@ -36,18 +36,18 @@ export class ElasticsearchInstrumentation extends InstrumentationBase<typeof ela
3636
this._config = Object.assign({}, config);
3737
}
3838

39-
protected init(): InstrumentationModuleDefinition<typeof elasticsearch> {
39+
protected init(): InstrumentationModuleDefinition {
4040
const apiModuleFiles = ELASTICSEARCH_API_FILES.map(
4141
({ path, operationClassName }) =>
42-
new InstrumentationNodeModuleFile<any>(
42+
new InstrumentationNodeModuleFile(
4343
`@elastic/elasticsearch/api/${path}`,
4444
['>=5 <8'],
4545
this.patch.bind(this, operationClassName),
4646
this.unpatch.bind(this)
4747
)
4848
);
4949

50-
const module = new InstrumentationNodeModuleDefinition<typeof elasticsearch>(
50+
const module = new InstrumentationNodeModuleDefinition(
5151
ElasticsearchInstrumentation.component,
5252
['*'],
5353
undefined,
@@ -120,11 +120,13 @@ export class ElasticsearchInstrumentation extends InstrumentationBase<typeof ela
120120
const span = startSpan({
121121
tracer: self.tracer,
122122
attributes: {
123-
[SemanticAttributes.DB_OPERATION]: operation,
123+
[SEMATTRS_DB_OPERATION]: operation,
124124
[AttributeNames.ELASTICSEARCH_INDICES]: getIndexName(params),
125-
[SemanticAttributes.DB_STATEMENT]: (
126-
self._config.dbStatementSerializer || defaultDbStatementSerializer
127-
)(operation, params, options),
125+
[SEMATTRS_DB_STATEMENT]: (self._config.dbStatementSerializer || defaultDbStatementSerializer)(
126+
operation,
127+
params,
128+
options
129+
),
128130
},
129131
});
130132
self._addModuleVersionIfNeeded(span);

packages/instrumentation-elasticsearch/src/utils.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { Tracer, SpanAttributes, SpanStatusCode, diag, Span, SpanKind } from '@opentelemetry/api';
22
import { DbStatementSerializer, ResponseHook } from './types';
33
import { safeExecuteInTheMiddle } from '@opentelemetry/instrumentation';
4-
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
4+
import {
5+
SEMATTRS_DB_SYSTEM,
6+
SEMATTRS_NET_PEER_NAME,
7+
SEMATTRS_NET_PEER_PORT,
8+
SEMATTRS_NET_TRANSPORT,
9+
} from '@opentelemetry/semantic-conventions';
510
import { ApiResponse } from '@elastic/elasticsearch/lib/Transport';
611

712
interface StartSpanPayload {
@@ -27,7 +32,7 @@ export function startSpan({ tracer, attributes }: StartSpanPayload): Span {
2732
return tracer.startSpan('elasticsearch.request', {
2833
kind: SpanKind.CLIENT,
2934
attributes: {
30-
[SemanticAttributes.DB_SYSTEM]: 'elasticsearch',
35+
[SEMATTRS_DB_SYSTEM]: 'elasticsearch',
3136
...attributes,
3237
},
3338
});
@@ -60,9 +65,9 @@ export function getNetAttributes(url: string): SpanAttributes {
6065
const { port, protocol, hostname } = new URL(url);
6166

6267
return {
63-
[SemanticAttributes.NET_TRANSPORT]: 'IP.TCP',
64-
[SemanticAttributes.NET_PEER_NAME]: hostname,
65-
[SemanticAttributes.NET_PEER_PORT]: getPort(port, protocol),
68+
[SEMATTRS_NET_TRANSPORT]: 'IP.TCP',
69+
[SEMATTRS_NET_PEER_NAME]: hostname,
70+
[SEMATTRS_NET_PEER_PORT]: getPort(port, protocol),
6671
};
6772
}
6873

packages/instrumentation-elasticsearch/test/utils.spec.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import { stub, assert, spy } from 'sinon';
33
import { expect } from 'chai';
44
import * as Utils from '../src/utils';
55
import { SpanKind, SpanStatusCode } from '@opentelemetry/api';
6-
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
6+
import {
7+
SEMATTRS_DB_SYSTEM,
8+
SEMATTRS_NET_PEER_NAME,
9+
SEMATTRS_NET_PEER_PORT,
10+
SEMATTRS_NET_TRANSPORT,
11+
} from '@opentelemetry/semantic-conventions';
712

813
describe('elasticsearch utils', () => {
914
const spanMock = {
@@ -92,15 +97,15 @@ describe('elasticsearch utils', () => {
9297
const attributes = Utils.getNetAttributes(url);
9398

9499
it('should get hostname from url', () => {
95-
expect(attributes[SemanticAttributes.NET_PEER_NAME]).to.equal('localhost');
100+
expect(attributes[SEMATTRS_NET_PEER_NAME]).to.equal('localhost');
96101
});
97102

98103
it('should get hostname from url', () => {
99-
expect(attributes[SemanticAttributes.NET_PEER_PORT]).to.equal('9200');
104+
expect(attributes[SEMATTRS_NET_PEER_PORT]).to.equal('9200');
100105
});
101106

102107
it('should set net.transport', () => {
103-
expect(attributes[SemanticAttributes.NET_TRANSPORT]).to.equal('IP.TCP');
108+
expect(attributes[SEMATTRS_NET_TRANSPORT]).to.equal('IP.TCP');
104109
});
105110
});
106111

@@ -190,7 +195,7 @@ describe('elasticsearch utils', () => {
190195

191196
expect(operation).to.equal('elasticsearch.request');
192197
expect(options.kind).to.equal(SpanKind.CLIENT);
193-
expect(options.attributes[SemanticAttributes.DB_SYSTEM]).to.equal('elasticsearch');
198+
expect(options.attributes[SEMATTRS_DB_SYSTEM]).to.equal('elasticsearch');
194199
expect(options.attributes.testAttribute).to.equal('testValue');
195200
});
196201
});

0 commit comments

Comments
 (0)