Skip to content

Commit

Permalink
Merge 0006802 into cbc5c52
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkuba authored Sep 19, 2023
2 parents cbc5c52 + 0006802 commit 39688a8
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/

### :house: (Internal)

* test: added a performance benchmark test for span creation [#4105](https://github.com/open-telemetry/opentelemetry-js/pull/4105)

## 1.17.0

### :bug: (Bug Fix)
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"test:browser": "lerna run test:browser",
"test:webworker": "lerna run test:webworker",
"test:backcompat": "lerna run test:backcompat",
"test:bench": "lerna run test:bench",
"bootstrap": "lerna bootstrap --hoist --nohoist='zone.js'",
"changelog": "lerna-changelog",
"codecov": "lerna run codecov",
Expand Down Expand Up @@ -65,6 +66,7 @@
"devDependencies": {
"@typescript-eslint/eslint-plugin": "5.59.11",
"@typescript-eslint/parser": "5.59.11",
"benchmark": "2.1.4",
"eslint": "8.44.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-header": "3.1.1",
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-sdk-trace-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'",
"test:browser": "karma start --single-run",
"test:webworker": "karma start karma.worker.js --single-run",
"test:bench": "node test/performance/benchmark/index.js",
"tdd": "npm run tdd:node",
"tdd:node": "npm run test -- --watch-extensions ts --watch",
"tdd:browser": "karma start",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

require('./span');
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const Benchmark = require('benchmark');
const { BasicTracerProvider } = require('../../../build/src');

const tracerProvider = new BasicTracerProvider();
const tracer = tracerProvider.getTracer('test')

const suite = new Benchmark.Suite();

suite.on('cycle', event => {
console.log(String(event.target));
});

suite.add('create spans (10 attributes)', function() {
const span = tracer.startSpan('span');
span.setAttribute('aaaaaaaaaaaaaaaaaaaa', 'aaaaaaaaaaaaaaaaaaaa');
span.setAttribute('bbbbbbbbbbbbbbbbbbbb', 'aaaaaaaaaaaaaaaaaaaa');
span.setAttribute('cccccccccccccccccccc', 'aaaaaaaaaaaaaaaaaaaa');
span.setAttribute('dddddddddddddddddddd', 'aaaaaaaaaaaaaaaaaaaa');
span.setAttribute('eeeeeeeeeeeeeeeeeeee', 'aaaaaaaaaaaaaaaaaaaa');
span.setAttribute('ffffffffffffffffffff', 'aaaaaaaaaaaaaaaaaaaa');
span.setAttribute('gggggggggggggggggggg', 'aaaaaaaaaaaaaaaaaaaa');
span.setAttribute('hhhhhhhhhhhhhhhhhhhh', 'aaaaaaaaaaaaaaaaaaaa');
span.setAttribute('iiiiiiiiiiiiiiiiiiii', 'aaaaaaaaaaaaaaaaaaaa');
span.setAttribute('jjjjjjjjjjjjjjjjjjjj', 'aaaaaaaaaaaaaaaaaaaa');
});

suite.run();

0 comments on commit 39688a8

Please sign in to comment.