Skip to content

Commit

Permalink
feat: add InstrumentationLibrary class
Browse files Browse the repository at this point in the history
  • Loading branch information
mwear committed Jun 9, 2020
1 parent 837322f commit 3e41a04
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/opentelemetry-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
"test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts --exclude 'test/platform/browser/**/*.ts'",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/platform/browser/**/*.ts'",
"test:browser": "nyc karma start --single-run",
"tdd": "npm run tdd:node",
"tdd:node": "npm run test -- --watch-extensions ts --watch",
Expand Down
19 changes: 19 additions & 0 deletions packages/opentelemetry-core/src/InstrumentationLibrary.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*!
* Copyright 2020, 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.
*/

export class InstrumentationLibrary {
constructor(readonly name: string, readonly version: string) {}
}
1 change: 1 addition & 0 deletions packages/opentelemetry-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export * from './common/NoopLogger';
export * from './common/time';
export * from './common/types';
export * from './ExportResult';
export * from './InstrumentationLibrary';
export * from './version';
export * from './context/context';
export * from './context/propagation/B3Propagator';
Expand Down
26 changes: 26 additions & 0 deletions packages/opentelemetry-core/test/InstrumentationLibrary.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*!
* Copyright 2020, 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.
*/

import * as assert from 'assert';
import { InstrumentationLibrary } from '../src/InstrumentationLibrary';

describe('InstrumentationLibrary', () => {
it('should have a name and version', () => {
const lib = new InstrumentationLibrary('libName', '0.0.1');
assert.strictEqual(lib.name, 'libName');
assert.strictEqual(lib.version, '0.0.1');
});
});

0 comments on commit 3e41a04

Please sign in to comment.