From 298e9f614c992015582da025222ac822c05f2c8c Mon Sep 17 00:00:00 2001 From: Ramya Rao Date: Fri, 2 Aug 2019 20:16:00 -0700 Subject: [PATCH] New package core-tracing (#4649) --- .docsettings.yml | 1 + common/config/rush/pnpm-lock.yaml | 183 +++++++++--- rush.json | 4 + sdk/core/core-tracing/Changelog.md | 3 + sdk/core/core-tracing/LICENSE.txt | 21 ++ sdk/core/core-tracing/README.md | 23 ++ sdk/core/core-tracing/api-extractor.json | 32 ++ .../lib/implementations/noop/spanNoOpImpl.ts | 33 +++ .../implementations/noop/tracerNoOpImpl.ts | 25 ++ sdk/core/core-tracing/lib/index.ts | 29 ++ sdk/core/core-tracing/lib/interfaces/Event.ts | 25 ++ .../core-tracing/lib/interfaces/Sampler.ts | 37 +++ .../lib/interfaces/SpanOptions.ts | 43 +++ .../core-tracing/lib/interfaces/TimedEvent.ts | 25 ++ .../core-tracing/lib/interfaces/attributes.ts | 20 ++ sdk/core/core-tracing/lib/interfaces/link.ts | 29 ++ sdk/core/core-tracing/lib/interfaces/span.ts | 117 ++++++++ .../lib/interfaces/span_context.ts | 66 +++++ .../core-tracing/lib/interfaces/span_kind.ts | 50 ++++ .../core-tracing/lib/interfaces/status.ts | 165 +++++++++++ .../lib/interfaces/trace_options.ts | 27 ++ .../lib/interfaces/trace_state.ts | 63 ++++ .../core-tracing/lib/interfaces/tracer.ts | 92 ++++++ .../lib/plugins/noop/noOpSpanPlugin.ts | 52 ++++ .../lib/plugins/noop/noOpTracePlugin.ts | 35 +++ .../opencensus/openCensusSpanPlugin.ts | 61 ++++ .../opencensus/openCensusTracePlugin.ts | 47 +++ sdk/core/core-tracing/lib/tracerProxy.ts | 26 ++ .../lib/utils/supportedPlugins.ts | 4 + sdk/core/core-tracing/package.json | 95 ++++++ .../core-tracing/review/core-tracing.api.md | 274 ++++++++++++++++++ sdk/core/core-tracing/rollup.base.config.js | 103 +++++++ sdk/core/core-tracing/rollup.config.js | 14 + sdk/core/core-tracing/rollup.test.config.js | 3 + sdk/core/core-tracing/tsconfig.json | 61 ++++ 35 files changed, 1841 insertions(+), 47 deletions(-) create mode 100644 sdk/core/core-tracing/Changelog.md create mode 100644 sdk/core/core-tracing/LICENSE.txt create mode 100644 sdk/core/core-tracing/README.md create mode 100644 sdk/core/core-tracing/api-extractor.json create mode 100644 sdk/core/core-tracing/lib/implementations/noop/spanNoOpImpl.ts create mode 100644 sdk/core/core-tracing/lib/implementations/noop/tracerNoOpImpl.ts create mode 100644 sdk/core/core-tracing/lib/index.ts create mode 100644 sdk/core/core-tracing/lib/interfaces/Event.ts create mode 100644 sdk/core/core-tracing/lib/interfaces/Sampler.ts create mode 100644 sdk/core/core-tracing/lib/interfaces/SpanOptions.ts create mode 100644 sdk/core/core-tracing/lib/interfaces/TimedEvent.ts create mode 100644 sdk/core/core-tracing/lib/interfaces/attributes.ts create mode 100644 sdk/core/core-tracing/lib/interfaces/link.ts create mode 100644 sdk/core/core-tracing/lib/interfaces/span.ts create mode 100644 sdk/core/core-tracing/lib/interfaces/span_context.ts create mode 100644 sdk/core/core-tracing/lib/interfaces/span_kind.ts create mode 100644 sdk/core/core-tracing/lib/interfaces/status.ts create mode 100644 sdk/core/core-tracing/lib/interfaces/trace_options.ts create mode 100644 sdk/core/core-tracing/lib/interfaces/trace_state.ts create mode 100644 sdk/core/core-tracing/lib/interfaces/tracer.ts create mode 100644 sdk/core/core-tracing/lib/plugins/noop/noOpSpanPlugin.ts create mode 100644 sdk/core/core-tracing/lib/plugins/noop/noOpTracePlugin.ts create mode 100644 sdk/core/core-tracing/lib/plugins/opencensus/openCensusSpanPlugin.ts create mode 100644 sdk/core/core-tracing/lib/plugins/opencensus/openCensusTracePlugin.ts create mode 100644 sdk/core/core-tracing/lib/tracerProxy.ts create mode 100644 sdk/core/core-tracing/lib/utils/supportedPlugins.ts create mode 100644 sdk/core/core-tracing/package.json create mode 100644 sdk/core/core-tracing/review/core-tracing.api.md create mode 100644 sdk/core/core-tracing/rollup.base.config.js create mode 100644 sdk/core/core-tracing/rollup.config.js create mode 100644 sdk/core/core-tracing/rollup.test.config.js create mode 100644 sdk/core/core-tracing/tsconfig.json diff --git a/.docsettings.yml b/.docsettings.yml index f851db1a7030..3a212a7ce1bd 100644 --- a/.docsettings.yml +++ b/.docsettings.yml @@ -104,6 +104,7 @@ known_content_issues: - ["sdk/storage/storage-queue/samples/README.md", "#1583"] - ["sdk/storage/storage-queue/test/README.md", "#1583"] - ["sdk/storage/storage-datalake/README.md", "#1583"] + - ["sdk/core/core-tracing/README.md", "#1583"] package_indexing_exclusion_list: - "@azure/template" diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index f46bbcfd8af9..f3d52db3d746 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -17,6 +17,7 @@ dependencies: '@rush-temp/core-auth': 'file:projects/core-auth.tgz' '@rush-temp/core-http': 'file:projects/core-http.tgz' '@rush-temp/core-paging': 'file:projects/core-paging.tgz' + '@rush-temp/core-tracing': 'file:projects/core-tracing.tgz' '@rush-temp/cosmos': 'file:projects/cosmos.tgz' '@rush-temp/event-hubs': 'file:projects/event-hubs.tgz' '@rush-temp/event-processor-host': 'file:projects/event-processor-host.tgz' @@ -120,7 +121,7 @@ dependencies: karma-rollup-preprocessor: 7.0.2_rollup@1.18.0 karma-sourcemap-loader: 0.3.7 karma-typescript-es6-transform: 4.1.1 - karma-webpack: 4.0.2_webpack@4.39.1 + karma-webpack: 4.0.2_webpack@4.39.0 long: 4.0.0 mocha: 5.2.0 mocha-chrome: 2.0.0 @@ -178,9 +179,9 @@ dependencies: url: 0.11.0 util: 0.12.1 uuid: 3.3.2 - webpack: 4.39.1_webpack@4.39.1 - webpack-cli: 3.3.6_webpack@4.39.1 - webpack-dev-middleware: 3.7.0_webpack@4.39.1 + webpack: 4.39.0_webpack@4.39.0 + webpack-cli: 3.3.6_webpack@4.39.0 + webpack-dev-middleware: 3.7.0_webpack@4.39.0 ws: 7.1.1 xhr-mock: 2.5.0 xml2js: 0.4.19 @@ -1430,6 +1431,10 @@ packages: dev: false resolution: integrity: sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== + /async-limiter/1.0.0: + dev: false + resolution: + integrity: sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg== /async-limiter/1.0.1: dev: false resolution: @@ -1450,6 +1455,12 @@ packages: dev: false resolution: integrity: sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo= + /async/2.6.0: + dependencies: + lodash: 4.17.15 + dev: false + resolution: + integrity: sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw== /async/2.6.3: dependencies: lodash: 4.17.15 @@ -2193,7 +2204,7 @@ packages: /browserslist/3.2.8: dependencies: caniuse-lite: 1.0.30000988 - electron-to-chromium: 1.3.211 + electron-to-chromium: 1.3.210 dev: false hasBin: true resolution: @@ -3191,6 +3202,10 @@ packages: node: '>=8' resolution: integrity: sha512-30xVGqjLjiUOArT4+M5q9sYdvuR4riM6yK9wMcas9Vbp6zZa+ocC9dp6QoftuhTPhFAiLK/0C5Ni2nou/Bk8lg== + /duplexer/0.1.1: + dev: false + resolution: + integrity: sha1-rOb/gIwc5mtX0ev5eXessCM0z8E= /duplexify/3.7.1: dependencies: end-of-stream: 1.4.1 @@ -3228,10 +3243,10 @@ packages: dev: false resolution: integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= - /electron-to-chromium/1.3.211: + /electron-to-chromium/1.3.210: dev: false resolution: - integrity: sha512-GZAiK3oHrs0K+LwH+HD+bdjZ17v40oQQdXbbd3dgrwgbENvazrGpcuIADSAREWnxzo9gADB1evuizrbXsnoU2Q== + integrity: sha512-m1i/F+gw9jkauxDx0mOr7Sj6vp6se1mfkQNYqZb1yL5VGTp0AC1NZH5CGI6YMSO7WaScILmkKDZFG9/hlR9axQ== /elliptic/6.5.0: dependencies: bn.js: 4.11.8 @@ -5481,15 +5496,15 @@ packages: dev: false resolution: integrity: sha512-WTGGThwufBT73c20q30iTcXq8Jb3Wat/h+JW1lwKgMtymT5rVxLknoaUVNfenaV3+cRMiTEsBT773kz9jWk6IQ== - /karma-webpack/4.0.2_webpack@4.39.1: + /karma-webpack/4.0.2_webpack@4.39.0: dependencies: clone-deep: 4.0.1 loader-utils: 1.2.3 neo-async: 2.6.1 schema-utils: 1.0.0 source-map: 0.7.3 - webpack: 4.39.1_webpack@4.39.1 - webpack-dev-middleware: 3.7.0_webpack@4.39.1 + webpack: 4.39.0_webpack@4.39.0 + webpack-dev-middleware: 3.7.0_webpack@4.39.0 dev: false engines: node: '>= 8.9.0' @@ -6238,6 +6253,30 @@ packages: dev: false resolution: integrity: sha1-viwAX9oy4LKa8fBdfEszIUxwH5I= + /ms-rest-azure/2.6.0: + dependencies: + adal-node: 0.1.28 + async: 2.6.0 + moment: 2.24.0 + ms-rest: 2.5.3 + request: 2.88.0 + uuid: 3.3.2 + dev: false + resolution: + integrity: sha512-J6386a9krZ4VtU7CRt+Ypgo9RGf8+d3gjMBkH7zbkM4zzkhbbMOYiPRaZ+bHZcfihkKLlktTgA6rjshTjF329A== + /ms-rest/2.5.3: + dependencies: + duplexer: 0.1.1 + is-buffer: 1.1.6 + is-stream: 1.1.0 + moment: 2.24.0 + request: 2.88.0 + through: 2.3.8 + tunnel: 0.0.5 + uuid: 3.3.2 + dev: false + resolution: + integrity: sha512-p0CnzrTzEkS8UTEwgCqT2O5YVK9E8KGBBlJVm3hFtMZvf0dmncKYXWFPyUa4PAsfBL7h4jfu39tOIFTu6exntg== /ms/2.0.0: dev: false resolution: @@ -8568,7 +8607,7 @@ packages: node: '>=6' resolution: integrity: sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== - /terser-webpack-plugin/1.4.1_webpack@4.39.1: + /terser-webpack-plugin/1.4.1_webpack@4.39.0: dependencies: cacache: 12.0.2 find-cache-dir: 2.1.0 @@ -8577,7 +8616,7 @@ packages: serialize-javascript: 1.7.0 source-map: 0.6.1 terser: 4.1.2 - webpack: 4.39.1_webpack@4.39.1 + webpack: 4.39.0_webpack@4.39.0 webpack-sources: 1.4.1 worker-farm: 1.7.0 dev: false @@ -8888,6 +8927,12 @@ packages: dev: false resolution: integrity: sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + /tunnel/0.0.5: + dev: false + engines: + node: '>=0.6.11 <=0.7.0 || >=0.7.3' + resolution: + integrity: sha512-gj5sdqherx4VZKMcBA4vewER7zdK25Td+z1npBqpbDys4eJrLx+SlYjJvq1bDXs2irkuJM5pf8ktaEQVipkrbA== /tunnel/0.0.6: dev: false engines: @@ -9236,7 +9281,7 @@ packages: dev: false resolution: integrity: sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA== - /webpack-cli/3.3.6_webpack@4.39.1: + /webpack-cli/3.3.6_webpack@4.39.0: dependencies: chalk: 2.4.2 cross-spawn: 6.0.5 @@ -9248,7 +9293,7 @@ packages: loader-utils: 1.2.3 supports-color: 6.1.0 v8-compile-cache: 2.0.3 - webpack: 4.39.1_webpack@4.39.1 + webpack: 4.39.0_webpack@4.39.0 yargs: 13.2.4 dev: false engines: @@ -9258,12 +9303,12 @@ packages: webpack: 4.x.x resolution: integrity: sha512-0vEa83M7kJtxK/jUhlpZ27WHIOndz5mghWL2O53kiDoA9DIxSKnfqB92LoqEn77cT4f3H2cZm1BMEat/6AZz3A== - /webpack-dev-middleware/3.7.0_webpack@4.39.1: + /webpack-dev-middleware/3.7.0_webpack@4.39.0: dependencies: memory-fs: 0.4.1 mime: 2.4.4 range-parser: 1.2.1 - webpack: 4.39.1_webpack@4.39.1 + webpack: 4.39.0_webpack@4.39.0 webpack-log: 2.0.0 dev: false engines: @@ -9288,7 +9333,7 @@ packages: dev: false resolution: integrity: sha512-XSz38193PTo/1csJabKaV4b53uRVotlMgqJXm3s3eje0Bu6gQTxYDqpD38CmQfDBA+gN+QqaGjasuC8I/7eW3Q== - /webpack/4.39.1_webpack@4.39.1: + /webpack/4.39.0_webpack@4.39.0: dependencies: '@webassemblyjs/ast': 1.8.5 '@webassemblyjs/helper-module-context': 1.8.5 @@ -9310,7 +9355,7 @@ packages: node-libs-browser: 2.2.1 schema-utils: 1.0.0 tapable: 1.1.3 - terser-webpack-plugin: 1.4.1_webpack@4.39.1 + terser-webpack-plugin: 1.4.1_webpack@4.39.0 watchpack: 1.6.0 webpack-sources: 1.4.1 dev: false @@ -9320,7 +9365,7 @@ packages: peerDependencies: webpack: '*' resolution: - integrity: sha512-/LAb2TJ2z+eVwisldp3dqTEoNhzp/TLCZlmZm3GGGAlnfIWDgOEE758j/9atklNLfRyhKbZTCOIoPqLJXeBLbQ== + integrity: sha512-nrxFNSEKm4T1C/EsgOgN50skt//Pl4X7kgJC1MrlE47M292LSCVmMOC47iTGL0CGxbdwhKGgeThrJcw0bstEfA== /which-module/1.0.0: dev: false resolution: @@ -9393,7 +9438,7 @@ packages: integrity: sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== /ws/3.3.3: dependencies: - async-limiter: 1.0.1 + async-limiter: 1.0.0 safe-buffer: 5.1.2 ultron: 1.1.1 dev: false @@ -9401,7 +9446,7 @@ packages: integrity: sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA== /ws/6.2.1: dependencies: - async-limiter: 1.0.1 + async-limiter: 1.0.0 dev: false resolution: integrity: sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA== @@ -9647,7 +9692,7 @@ packages: dev: false name: '@rush-temp/abort-controller' resolution: - integrity: sha512-MMUffH4NZW/NawCA13C0bdKqjytoja1BQSwuA7bQHzMmINYCA+3lE9scchzm8CV5N5RIdtPPABCTkPAdI/2w6A== + integrity: sha512-x+voDt8XdyBFL303wBUx2CnOIreIhRBNCVEcntOkojpHHsIrRh6hxnD0PYPivBI1cxkF5pyyuHxAxQphFHO16g== tarball: 'file:projects/abort-controller.tgz' version: 0.0.0 'file:projects/core-amqp.tgz': @@ -9718,7 +9763,7 @@ packages: dev: false name: '@rush-temp/core-amqp' resolution: - integrity: sha512-0v3Gz9NCETDOgGKPZ764PdvsLIdCV6QSHRblilI8DlC5CXz/pvUEL1JsQcrM1tXbJOZcuB72pIQwnYrdPm7vdA== + integrity: sha512-GBAs4S1QMhTUgK2mhulJ0LeJkzszExfhvETqLgzX07jGO/qi9h22ithc/IUkBm72yqDphLTxbGdk64tIS7ibow== tarball: 'file:projects/core-amqp.tgz' version: 0.0.0 'file:projects/core-arm.tgz': @@ -9754,7 +9799,7 @@ packages: dev: false name: '@rush-temp/core-arm' resolution: - integrity: sha512-pyEiD37YlrRGFw/QdPkmVy1yOIEbpAp1shPzktFxYfuN/BWicVa+I62AF14J3DdqXkG4wsRaaUNIfrTCvMJNVQ== + integrity: sha512-phve3vyLkRngCpPo1VIMZi4mYuJ1ZQLVwtfTwJlGb17t7U9w73ZY1G/XcwlV+z1eNYz+16VXPbXE/al/Ds1aTA== tarball: 'file:projects/core-arm.tgz' version: 0.0.0 'file:projects/core-asynciterator-polyfill.tgz': @@ -9773,7 +9818,7 @@ packages: dev: false name: '@rush-temp/core-asynciterator-polyfill' resolution: - integrity: sha512-eM85h9SCt/WXjcDWnOd1RZAKQWwPRSpsOgNeNHm/RZ84rEDmAp/8Lv1t1vaJLLqn6bExzexX/a3MjS57kuNY/g== + integrity: sha512-IRwa1BGwvWFf9WcCzNcKr6sJA9gx8uJNIMG1h401qieXmpIZ0AgKwPzIAW+FDXNCvTsyJ7yWXkIbMrHuEU3m6Q== tarball: 'file:projects/core-asynciterator-polyfill.tgz' version: 0.0.0 'file:projects/core-auth.tgz': @@ -9813,7 +9858,7 @@ packages: dev: false name: '@rush-temp/core-auth' resolution: - integrity: sha512-BzCXSUB2kZHpKe4LcJmw1ttav09XKk0gCebGj3pric2r8D4dKZIpzS5KRJ+t+X8TcyupVuBv2kx/U2ZeTTX6QA== + integrity: sha512-4xIrZFzmo83/fk7YHuIPLXT/+55bgOk0REf598D5uJxaWAfDvoaBNJNyxsuQt6O2P195OePubUF6DR0O7BlMMA== tarball: 'file:projects/core-auth.tgz' version: 0.0.0 'file:projects/core-http.tgz': @@ -9856,7 +9901,7 @@ packages: karma-rollup-preprocessor: 7.0.2_rollup@1.18.0 karma-sourcemap-loader: 0.3.7 karma-typescript-es6-transform: 4.1.1 - karma-webpack: 4.0.2_webpack@4.39.1 + karma-webpack: 4.0.2_webpack@4.39.0 mocha: 5.2.0 mocha-chrome: 2.0.0 mocha-junit-reporter: 1.23.1_mocha@5.2.0 @@ -9886,16 +9931,16 @@ packages: typescript: 3.5.3 uglify-js: 3.6.0 uuid: 3.3.2 - webpack: 4.39.1_webpack@4.39.1 - webpack-cli: 3.3.6_webpack@4.39.1 - webpack-dev-middleware: 3.7.0_webpack@4.39.1 + webpack: 4.39.0_webpack@4.39.0 + webpack-cli: 3.3.6_webpack@4.39.0 + webpack-dev-middleware: 3.7.0_webpack@4.39.0 xhr-mock: 2.5.0 xml2js: 0.4.19 yarn: 1.17.3 dev: false name: '@rush-temp/core-http' resolution: - integrity: sha512-DXu2Sn0O580ClpsT/e4sS7zHjNg/38ftgWG7MWj0m9A4VRkP+9K4N0BPRyw0oAeht99AWauEQ2SxYEwc5uGdQg== + integrity: sha512-0JnlqqQCp+WYqDGY+KyqlZFl4pzauS0E8gySGwpChzZslbZi5vvA1tG7Cl2NhEq7wr0CXXrSW2s01DnQs5Z+jA== tarball: 'file:projects/core-http.tgz' version: 0.0.0 'file:projects/core-paging.tgz': @@ -9915,9 +9960,48 @@ packages: dev: false name: '@rush-temp/core-paging' resolution: - integrity: sha512-EnQl2fTIIG6a5I/I3EzV+4vYTEJcb4TBBeW/olyfoCWioVWC9Mmq5u4S83XXAgY3m98/ctbNHzEcEuCdgSdVrA== + integrity: sha512-QkET39Qzizy7zyVKVDimbXrWvs9M2g5X4TWfbHiv9fCMkUx6VRVDchAsseuCDU1ONejKuKVFbN0nxrkFnH60sQ== tarball: 'file:projects/core-paging.tgz' version: 0.0.0 + 'file:projects/core-tracing.tgz': + dependencies: + '@microsoft/api-extractor': 7.3.4 + '@types/mocha': 5.2.7 + '@types/node': 8.10.51 + '@typescript-eslint/eslint-plugin': 1.13.0_0b5e999c52a893676e7127c05369c7b6 + '@typescript-eslint/parser': 1.13.0_eslint@5.16.0 + assert: 1.5.0 + cross-env: 5.2.0 + eslint: 5.16.0 + eslint-config-prettier: 6.0.0_eslint@5.16.0 + eslint-detailed-reporter: 0.8.0_eslint@5.16.0 + eslint-plugin-no-null: 1.0.2_eslint@5.16.0 + eslint-plugin-no-only-tests: 2.3.1 + eslint-plugin-promise: 4.2.1 + inherits: 2.0.4 + mocha: 5.2.0 + mocha-junit-reporter: 1.23.1_mocha@5.2.0 + mocha-multi: 1.1.0_mocha@5.2.0 + prettier: 1.18.2 + rimraf: 2.6.3 + rollup: 1.18.0 + rollup-plugin-commonjs: 10.0.1_rollup@1.18.0 + rollup-plugin-json: 4.0.0 + rollup-plugin-multi-entry: 2.1.0 + rollup-plugin-node-resolve: 5.2.0_rollup@1.18.0 + rollup-plugin-replace: 2.2.0 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.18.0 + rollup-plugin-terser: 5.1.1_rollup@1.18.0 + rollup-plugin-visualizer: 2.5.4_rollup@1.18.0 + tslib: 1.10.0 + typescript: 3.5.3 + util: 0.12.1 + dev: false + name: '@rush-temp/core-tracing' + resolution: + integrity: sha512-RUmLY9Vr2IXSMyL9dss7tAPwnVVAeOB27G+3QMPZlVWiarKq0zSACDeTpyHUVH2H53pusnPpyXbmx3m5Mim9dQ== + tarball: 'file:projects/core-tracing.tgz' + version: 0.0.0 'file:projects/cosmos.tgz': dependencies: '@types/mocha': 5.2.7 @@ -9952,12 +10036,12 @@ packages: tslib: 1.10.0 tunnel: 0.0.6 typescript: 3.5.3 - webpack: 4.39.1_webpack@4.39.1 - webpack-cli: 3.3.6_webpack@4.39.1 + webpack: 4.39.0_webpack@4.39.0 + webpack-cli: 3.3.6_webpack@4.39.0 dev: false name: '@rush-temp/cosmos' resolution: - integrity: sha512-5OtuHMLHmJ9wohJDESFRqKwMm3IMXzj6ffj2BkZZqroUioGo4xLqSOAVrnaqPaiBzlQWp96viBp8mhxgc+2prA== + integrity: sha512-aFhnE62pcG/lqb6qnfae7EfgNN7L+gH3VfxpxOnMtJzvMmpb8U2unGFPk2AIS0/0FRGiM0iGkttQPGXjiR50GA== tarball: 'file:projects/cosmos.tgz' version: 0.0.0 'file:projects/event-hubs.tgz': @@ -10033,7 +10117,7 @@ packages: dev: false name: '@rush-temp/event-hubs' resolution: - integrity: sha512-5bF+EvgsyN/dhQIPgU/C24oeLdUSa+FSbELjGfSmWkmhLQbgBM8JQNImtDgor5n81QpM1pWpFPIpu5M8cVmHzg== + integrity: sha512-M170MYQHFPF7aGXaeMPHviAsyCoPROOJEDuM7cGEqBJcFwXpYrpz7ROCIWwuqIn9q4lXsJf6PkYsmw3VHduZhQ== tarball: 'file:projects/event-hubs.tgz' version: 0.0.0 'file:projects/event-processor-host.tgz': @@ -10091,7 +10175,7 @@ packages: dev: false name: '@rush-temp/event-processor-host' resolution: - integrity: sha512-NA3u7hYUX4M4rPCK+aTFtGaZfbMDWvsxHdV0No6sppjjLiHEKDL2yBdBwhuhKsy4/Ty/VIpfJQQjfUoYPOn/nw== + integrity: sha512-Jsy8RILh68Pv8Qu0es2EIqPqh09U8QXcwQJXtIK+gcSq2zMe71ooOIkBz7xjJuZ2p1PsiTX0noP1apInO9jZoQ== tarball: 'file:projects/event-processor-host.tgz' version: 0.0.0 'file:projects/identity.tgz': @@ -10143,7 +10227,7 @@ packages: dev: false name: '@rush-temp/identity' resolution: - integrity: sha512-Ubsv7XiS4y1uj1PpXBvnOvQTJZW/UPdwEqGfQIWyKz7z0msyM/qrsTPe9qxVj4rDtbP33tCx9SOmqXH5qOWnTg== + integrity: sha512-JChnsLgbSP6jz9PepCG2gwy+9hc4TsDItlZa19dV29bgFBPNLJSCeHtvF7S0GqQl3oz+RxvR4kdY885ZPX0D4A== tarball: 'file:projects/identity.tgz' version: 0.0.0 'file:projects/keyvault-certificates.tgz': @@ -10172,7 +10256,7 @@ packages: dev: false name: '@rush-temp/keyvault-certificates' resolution: - integrity: sha512-chpyZ7ntkMyiVzN6BTFCdw/mzSpZj8O8Gi4JznOkO7bBOQzgBLmVIQ/pwJqUoJg8YUnfqNZMV/xqJD6Irkjl1w== + integrity: sha512-0nhGLrUGObgsdzppH5fMfvAXZv2xxL0hzs232xwe8jqbcln8ZkWIoSRH/dAb9RAHuVl4WtMWDBROAJ9yik+kCw== tarball: 'file:projects/keyvault-certificates.tgz' version: 0.0.0 'file:projects/keyvault-keys.tgz': @@ -10242,7 +10326,7 @@ packages: dev: false name: '@rush-temp/keyvault-keys' resolution: - integrity: sha512-uHS+jjG/J+5s42bd29eIQtGRRboDv5mR9zchVtpbHRkHYRZLrxNoWnKooL84um+7p15mLCRpF4S5cSkex7dRUg== + integrity: sha512-RWtkjDWWH4do62AtNfdtjLKNxDrnDnL40VkhuBIHbQA+AxcN9Iic3OAGiE0lEIp8+Udvi1KPf4fSTXG3QJHvpA== tarball: 'file:projects/keyvault-keys.tgz' version: 0.0.0 'file:projects/keyvault-secrets.tgz': @@ -10311,7 +10395,7 @@ packages: dev: false name: '@rush-temp/keyvault-secrets' resolution: - integrity: sha512-a/Il5P+9dNOUYtFC0EB5PZIhy5LouW+8oqc+uBvwlIKAA/NzUVTy5ZjkMskqiH5aMleJeV4ZMYOSBigU8O8e7Q== + integrity: sha512-ea24a6FgGValOdZJuFLqPHAXVrzRxerMZwGi0TqfVfwAcSn6lHuMCIt3so7LBBJsuT6d2k1Gf4Ow7XdQUhSMbg== tarball: 'file:projects/keyvault-secrets.tgz' version: 0.0.0 'file:projects/service-bus.tgz': @@ -10389,7 +10473,7 @@ packages: dev: false name: '@rush-temp/service-bus' resolution: - integrity: sha512-YZz3mASz3qrM577g17GK1eoOiOyH8DiSGxfkIw28W+qGFSBhPNXKs1qdOwDySMs9iypb3z8UjPMeEiBJYFfj/Q== + integrity: sha512-OyEIa/CmTPd+qEMKtDJP6ZFb3WdD7otXtpfRTlAPeWSV2ukcTu2YqH91J+xV2Ub4mHgVTZbeeWQkn6sfTP6qXg== tarball: 'file:projects/service-bus.tgz' version: 0.0.0 'file:projects/storage-blob.tgz': @@ -10460,7 +10544,7 @@ packages: dev: false name: '@rush-temp/storage-blob' resolution: - integrity: sha512-/pzOlT+BOxng1QpYdbv3xj6EbqP2+biLw7Lsj8MuQ/JlkecQ/vq7uFRuu67Pv7RMA66kzwBu4PRvpkN3CyCsWg== + integrity: sha512-Pzm4zPOtJSgd6OPABfADKXZQ5lpHzWqjkOmYQ8vknLZgKakReSuJrV7mB7/OFu9qxm8Q+FetBjPVWiUpTT1qgA== tarball: 'file:projects/storage-blob.tgz' version: 0.0.0 'file:projects/storage-file.tgz': @@ -10531,7 +10615,7 @@ packages: dev: false name: '@rush-temp/storage-file' resolution: - integrity: sha512-AcWoeC5WyCxKB+KVvceLsoq/zSf5HFzVdXpVvX+Mc/+uaP6XItcvGGsLQfwUojuQ5P7y08AMNMzFMh++vCn7qA== + integrity: sha512-vt91V3Kipjm60Q/mqSDRH3TMnNv3uYOmgMidlO3GH2s2WTaYJQ0fJlt8eZaEMbHcGOgG3R8p3WohMqvzoljDmg== tarball: 'file:projects/storage-file.tgz' version: 0.0.0 'file:projects/storage-queue.tgz': @@ -10601,7 +10685,7 @@ packages: dev: false name: '@rush-temp/storage-queue' resolution: - integrity: sha512-2O9eUkSpX6m28VxTLOykmO3qCo7wybjtfDi6ITx3AhyuRghzv7JwMQNoQKKZlipoD0C5xRzFt4kx51HSA1haPQ== + integrity: sha512-5hD25rOXwAgsiOG3BE+wrApP78SJqNiJNSIgSNUf7O8kNM0quQa7kTrIWDZer1nHt2YXQ4Ipg/4FCSHFXFaw5A== tarball: 'file:projects/storage-queue.tgz' version: 0.0.0 'file:projects/template.tgz': @@ -10652,7 +10736,7 @@ packages: dev: false name: '@rush-temp/template' resolution: - integrity: sha512-MxtFJnVO6Nw4g+5rIx/QWGh/+i5iimaZLDDEisDKv4PY/K8OfoV4Z/dZikDd22rhLUIoT4+yRizXbKtLM7zLxg== + integrity: sha512-X0FdGAh2AwdFvbcwZ3we/W3XrUfo7+GogkdHB9n7fdoS4rudlHoIDVNMTbEfTEEsD1wNYLwlHX0gAH6NZRbxVQ== tarball: 'file:projects/template.tgz' version: 0.0.0 'file:projects/testhub.tgz': @@ -10664,6 +10748,10 @@ packages: async-lock: 1.2.2 death: 1.1.0 debug: 3.2.6 + is-buffer: 2.0.3 + jssha: 2.3.1 + ms-rest: 2.5.3 + ms-rest-azure: 2.6.0 rhea: 1.0.8 rimraf: 2.6.3 tslib: 1.10.0 @@ -10673,7 +10761,7 @@ packages: dev: false name: '@rush-temp/testhub' resolution: - integrity: sha512-VxrbDXfuJ6Nz4rm0DHlJ+0sMk4RMKRflIyu7WxXLZGBpri9KLivFyNA0TWfZBifpdy3T1kVXyLOccskpzczDvA== + integrity: sha512-5P+X3IwgFa9rlq+jbtHxWVZWF1kDmRZwV8jQfHMYV5CLsJjXKw1yISIRSFmCmuXDdHYEnxO1bnRGi34QeZ+63g== tarball: 'file:projects/testhub.tgz' version: 0.0.0 registry: '' @@ -10696,6 +10784,7 @@ specifiers: '@rush-temp/core-auth': 'file:./projects/core-auth.tgz' '@rush-temp/core-http': 'file:./projects/core-http.tgz' '@rush-temp/core-paging': 'file:./projects/core-paging.tgz' + '@rush-temp/core-tracing': 'file:./projects/core-tracing.tgz' '@rush-temp/cosmos': 'file:./projects/cosmos.tgz' '@rush-temp/event-hubs': 'file:./projects/event-hubs.tgz' '@rush-temp/event-processor-host': 'file:./projects/event-processor-host.tgz' diff --git a/rush.json b/rush.json index 227fb28f476e..ab4f526e89f2 100644 --- a/rush.json +++ b/rush.json @@ -401,6 +401,10 @@ { "packageName": "@azure/template", "projectFolder": "sdk/template/template" + }, + { + "packageName": "@azure/core-tracing", + "projectFolder": "sdk/core/core-tracing" } ] } diff --git a/sdk/core/core-tracing/Changelog.md b/sdk/core/core-tracing/Changelog.md new file mode 100644 index 000000000000..d73e414c1e49 --- /dev/null +++ b/sdk/core/core-tracing/Changelog.md @@ -0,0 +1,3 @@ +# 1.0.0-preview.1 5th August 2019 + +Provides low-level interfaces and helper methods for tracing in Azure SDK diff --git a/sdk/core/core-tracing/LICENSE.txt b/sdk/core/core-tracing/LICENSE.txt new file mode 100644 index 000000000000..21071075c245 --- /dev/null +++ b/sdk/core/core-tracing/LICENSE.txt @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/sdk/core/core-tracing/README.md b/sdk/core/core-tracing/README.md new file mode 100644 index 000000000000..930ee8d74da7 --- /dev/null +++ b/sdk/core/core-tracing/README.md @@ -0,0 +1,23 @@ +# Azure Core tracing library for JS + +This is the core tracing library that provides low-level interfaces and helper methods for tracing in Azure SDK JavaScript libraries which work in the browser and Node.js. + +## Getting started + +Coming soon.... + +## Contributing + +This project welcomes contributions and suggestions. Most contributions require you to agree to a +Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us +the rights to use your contribution. For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide +a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions +provided by the bot. You will only need to do this once across all repos using our CLA. + +If you'd like to contribute to this library, please read the [contributing guide](../../../CONTRIBUTING.md) to learn more about how to build and test the code. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. diff --git a/sdk/core/core-tracing/api-extractor.json b/sdk/core/core-tracing/api-extractor.json new file mode 100644 index 000000000000..ea431776e9eb --- /dev/null +++ b/sdk/core/core-tracing/api-extractor.json @@ -0,0 +1,32 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "types/index.d.ts", + "docModel": { + "enabled": false + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/core-tracing.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } + } + \ No newline at end of file diff --git a/sdk/core/core-tracing/lib/implementations/noop/spanNoOpImpl.ts b/sdk/core/core-tracing/lib/implementations/noop/spanNoOpImpl.ts new file mode 100644 index 000000000000..0b602b907960 --- /dev/null +++ b/sdk/core/core-tracing/lib/implementations/noop/spanNoOpImpl.ts @@ -0,0 +1,33 @@ +import { Span } from "../../interfaces/span"; +import { SpanContext } from "../../interfaces/span_context"; +import { Attributes } from "../../interfaces/attributes"; +import { Status } from "../../interfaces/status"; + +export class SpanNoOpImpl implements Span { + context(): SpanContext { + throw new Error("Method not implemented."); + } + setAttribute(key: string, value: unknown): this { + throw new Error("Method not implemented."); + } + setAttributes(attributes: Attributes): this { + throw new Error("Method not implemented."); + } + addEvent(name: string, attributes?: Attributes | undefined): this { + throw new Error("Method not implemented."); + } + addLink(spanContext: SpanContext, attributes?: Attributes | undefined): this { + throw new Error("Method not implemented."); + } + setStatus(status: Status): this { + throw new Error("Method not implemented."); + } + updateName(name: string): this { + throw new Error("Method not implemented."); + } + start(startTime?: number): void {} + end(endTime?: number): void {} + isRecordingEvents(): boolean { + throw new Error("Method not implemented."); + } +} diff --git a/sdk/core/core-tracing/lib/implementations/noop/tracerNoOpImpl.ts b/sdk/core/core-tracing/lib/implementations/noop/tracerNoOpImpl.ts new file mode 100644 index 000000000000..8d00b5392c39 --- /dev/null +++ b/sdk/core/core-tracing/lib/implementations/noop/tracerNoOpImpl.ts @@ -0,0 +1,25 @@ +import { Tracer } from "../../interfaces/tracer"; +import { SpanOptions } from "../../interfaces/SpanOptions"; +import { Span } from "../../interfaces/span"; +import { SpanNoOpImpl } from "./spanNoOpImpl"; + +export class TracerNoOpImpl implements Tracer { + getCurrentSpan(): Span { + throw new Error("Method not implemented."); + } + startSpan(name: string, options?: SpanOptions | undefined): Span { + return new SpanNoOpImpl(); + } + withSpan unknown>(span: Span, fn: T): ReturnType { + throw new Error("Method not implemented."); + } + recordSpanData(span: Span): void { + throw new Error("Method not implemented."); + } + getBinaryFormat(): unknown { + throw new Error("Method not implemented."); + } + getHttpTextFormat(): unknown { + throw new Error("Method not implemented."); + } +} diff --git a/sdk/core/core-tracing/lib/index.ts b/sdk/core/core-tracing/lib/index.ts new file mode 100644 index 000000000000..d8b06e6a3195 --- /dev/null +++ b/sdk/core/core-tracing/lib/index.ts @@ -0,0 +1,29 @@ +export { TracerProxy } from "./tracerProxy"; + +// Utils +export { SupportedPlugins } from "./utils/supportedPlugins"; + +// Plugins +export { NoOpSpanPlugin } from "./plugins/noop/noOpSpanPlugin"; +export { NoOpTracePlugin } from "./plugins/noop/noOpTracePlugin"; +export { OpenCensusSpanPlugin } from "./plugins/opencensus/openCensusSpanPlugin"; +export { OpenCensusTracePlugin } from "./plugins/opencensus/openCensusTracePlugin"; + +// Implementations +export { SpanNoOpImpl } from "./implementations/noop/spanNoOpImpl"; +export { TracerNoOpImpl } from "./implementations/noop/tracerNoOpImpl"; + +// Interfaces +export { Attributes } from "./interfaces/attributes"; +export { Event } from "./interfaces/Event"; +export { Link } from "./interfaces/link"; +export { Sampler } from "./interfaces/Sampler"; +export { SpanContext } from "./interfaces/span_context"; +export { SpanKind } from "./interfaces/span_kind"; +export { Span } from "./interfaces/span"; +export { SpanOptions } from "./interfaces/SpanOptions"; +export { Status, CanonicalCode } from "./interfaces/status"; +export { TimedEvent } from "./interfaces/TimedEvent"; +export { TraceOptions } from "./interfaces/trace_options"; +export { TraceState } from "./interfaces/trace_state"; +export { Tracer } from "./interfaces/tracer"; diff --git a/sdk/core/core-tracing/lib/interfaces/Event.ts b/sdk/core/core-tracing/lib/interfaces/Event.ts new file mode 100644 index 000000000000..ea21c330174a --- /dev/null +++ b/sdk/core/core-tracing/lib/interfaces/Event.ts @@ -0,0 +1,25 @@ +/** + * Copyright 2019, 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 { Attributes } from './attributes'; + +/** A text annotation with a set of attributes. */ +export interface Event { + /** The name of the event. */ + name: string; + /** The attributes of the event. */ + attributes?: Attributes; +} diff --git a/sdk/core/core-tracing/lib/interfaces/Sampler.ts b/sdk/core/core-tracing/lib/interfaces/Sampler.ts new file mode 100644 index 000000000000..ae4f3338ec86 --- /dev/null +++ b/sdk/core/core-tracing/lib/interfaces/Sampler.ts @@ -0,0 +1,37 @@ +/** + * Copyright 2019, 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 { SpanContext } from './span_context'; + +/** + * This interface represent a sampler. Sampling is a mechanism to control the + * noise and overhead introduced by OpenTelemetry by reducing the number of + * samples of traces collected and sent to the backend. + */ +export interface Sampler { + /** + * Checks whether span needs to be created and tracked. + * + * TODO: Consider to add required arguments https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/sampling-api.md#shouldsample + * @param [parentContext] Parent span context. Typically taken from the wire. + * Can be null. + * @returns whether span should be sampled or not. + */ + shouldSample(parentContext?: SpanContext): boolean; + + /** Returns the sampler name or short description with the configuration. */ + toString(): string; +} diff --git a/sdk/core/core-tracing/lib/interfaces/SpanOptions.ts b/sdk/core/core-tracing/lib/interfaces/SpanOptions.ts new file mode 100644 index 000000000000..602d07e10c24 --- /dev/null +++ b/sdk/core/core-tracing/lib/interfaces/SpanOptions.ts @@ -0,0 +1,43 @@ +/** + * Copyright 2019, 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 { Span } from './span'; +import { Attributes } from './attributes'; +import { SpanKind } from './span_kind'; +import { SpanContext } from './span_context'; + +/** + * Options needed for span creation + */ +export interface SpanOptions { + /** The SpanKind of a span */ + kind?: SpanKind; + + /** A spans attributes */ + attributes?: Attributes; + + /** Indicates that events are being recorded for a span */ + isRecordingEvents?: boolean; + + /** + * A parent SpanContext (or Span, for convenience) that the newly-started + * span will be the child of. + */ + parent?: Span | SpanContext; + + /** A manually specified start time for the created Span object. */ + startTime?: number; +} diff --git a/sdk/core/core-tracing/lib/interfaces/TimedEvent.ts b/sdk/core/core-tracing/lib/interfaces/TimedEvent.ts new file mode 100644 index 000000000000..3b46df2e87a6 --- /dev/null +++ b/sdk/core/core-tracing/lib/interfaces/TimedEvent.ts @@ -0,0 +1,25 @@ +/** + * Copyright 2019, 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 { Event } from './Event'; + +/** + * Represents a timed event. + * A timed event is an event with a timestamp. + */ +export interface TimedEvent extends Event { + time: number; +} diff --git a/sdk/core/core-tracing/lib/interfaces/attributes.ts b/sdk/core/core-tracing/lib/interfaces/attributes.ts new file mode 100644 index 000000000000..a9fecfac5f1a --- /dev/null +++ b/sdk/core/core-tracing/lib/interfaces/attributes.ts @@ -0,0 +1,20 @@ +/** + * Copyright 2019, 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. + */ + +/** Defines a attributes interface. */ +export interface Attributes { + [attributeKey: string]: unknown; +} diff --git a/sdk/core/core-tracing/lib/interfaces/link.ts b/sdk/core/core-tracing/lib/interfaces/link.ts new file mode 100644 index 000000000000..fadac28adf7f --- /dev/null +++ b/sdk/core/core-tracing/lib/interfaces/link.ts @@ -0,0 +1,29 @@ +/** + * Copyright 2019, 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 { Attributes } from './attributes'; +import { SpanContext } from './span_context'; + +/** + * A pointer from the current {@link Span} to another span in the same trace or + * in a different trace. + */ +export interface Link { + /** The {@link SpanContext} of a linked span. */ + spanContext: SpanContext; + /** A set of {@link Attributes} on the link. */ + attributes?: Attributes; +} diff --git a/sdk/core/core-tracing/lib/interfaces/span.ts b/sdk/core/core-tracing/lib/interfaces/span.ts new file mode 100644 index 000000000000..96304dd7c6c7 --- /dev/null +++ b/sdk/core/core-tracing/lib/interfaces/span.ts @@ -0,0 +1,117 @@ +/** + * Copyright 2019, 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 { Attributes } from "./attributes"; +import { SpanContext } from "./span_context"; +import { Status } from "./status"; + +/** + * An interface that represents a span. A span represents a single operation + * within a trace. Examples of span might include remote procedure calls or a + * in-process function calls to sub-components. A Trace has a single, top-level + * "root" Span that in turn may have zero or more child Spans, which in turn + * may have children. + */ +export interface Span { + /** + * Returns the {@link SpanContext} object associated with this Span. + * + * @returns the SpanContext object associated with this Span. + */ + context(): SpanContext; + + // /** + // * # TODO + // * Returns the Tracer object used to create this Span. + // * https://github.com/open-telemetry/opentelemetry-specification/issues/21 + // */ + // tracer(): Tracer; + + /** + * Sets an attribute to the span. + * + * @param key the key for this attribute. + * @param value the value for this attribute. + */ + setAttribute(key: string, value: unknown): this; + + /** + * Sets attributes to the span. + * + * @param attributes the attributes that will be added. + */ + setAttributes(attributes: Attributes): this; + + /** + * Adds an event to the Span. + * + * @param name the name of the event. + * @param [attributes] the attributes that will be added; these are + * associated with this event. + */ + addEvent(name: string, attributes?: Attributes): this; + + /** + * Adds a link to the Span. + * + * @param spanContext the context of the linked span. + * @param [attributes] the attributes that will be added; these are + * associated with this link. + */ + addLink(spanContext: SpanContext, attributes?: Attributes): this; + + /** + * Sets a status to the span. If used, this will override the default Span + * status. Default is {@link CanonicalCode.OK}. + * + * @param status the Status to set. + */ + setStatus(status: Status): this; + + /** + * Updates the Span name. + * + * TODO (revision): https://github.com/open-telemetry/opentelemetry-specification/issues/119 + * + * @param name the Span name. + */ + updateName(name: string): this; + + /** + * Marks the end of Span execution. + * + * Call to End of a Span MUST not have any effects on child spans. Those may + * still be running and can be ended later. + * + * Do not return `this`. The Span generally should not be used after it + * is ended so chaining is not desired in this context. + * + * @param [endTime] the timestamp to set as Span's end time. If not provided, + * use the current time as the span's end time. + * TODO (Add timestamp format): https://github.com/open-telemetry/opentelemetry-js/issues/19 + */ + end(endTime?: number): void; + + start(startTime?: number): void; + + /** + * Returns the flag whether this span will be recorded. + * + * @returns true if this Span is active and recording information like events + * with the AddEvent operation and attributes using setAttributes. + */ + isRecordingEvents(): boolean; +} diff --git a/sdk/core/core-tracing/lib/interfaces/span_context.ts b/sdk/core/core-tracing/lib/interfaces/span_context.ts new file mode 100644 index 000000000000..c67602a25d78 --- /dev/null +++ b/sdk/core/core-tracing/lib/interfaces/span_context.ts @@ -0,0 +1,66 @@ +/** + * Copyright 2019, 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 { TraceOptions } from './trace_options'; +import { TraceState } from './trace_state'; + +/** + * A SpanContext represents the portion of a {@link Span} which must be + * serialized and propagated along side of a distributed context. + */ +export interface SpanContext { + /** + * The ID of the trace that this span belongs to. It is worldwide unique + * with practically sufficient probability by being made as 16 randomly + * generated bytes, encoded as a 32 lowercase hex characters corresponding to + * 128 bits. + */ + traceId: string; + /** + * The ID of the Span. It is globally unique with practically sufficient + * probability by being made as 8 randomly generated bytes, encoded as a 16 + * lowercase hex characters corresponding to 64 bits. + */ + spanId: string; + /** + * Trace options to propagate. + * + * It is represented as 1 byte (bitmap). Bit to represent whether trace is + * sampled or not. When set, the least significant bit documents that the + * caller may have recorded trace data. A caller who does not record trace + * data out-of-band leaves this flag unset. + * + * SAMPLED = 0x1 and UNSAMPLED = 0x0; + */ + traceOptions?: TraceOptions; + /** + * Tracing-system-specific info to propagate. + * + * The tracestate field value is a `list` as defined below. The `list` is a + * series of `list-members` separated by commas `,`, and a list-member is a + * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs + * surrounding `list-members` are ignored. There can be a maximum of 32 + * `list-members` in a `list`. + * More Info: https://www.w3.org/TR/trace-context/#tracestate-field + * + * Examples: + * Single tracing system (generic format): + * tracestate: rojo=00f067aa0ba902b7 + * Multiple tracing systems (with different formatting): + * tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE + */ + traceState?: TraceState; +} diff --git a/sdk/core/core-tracing/lib/interfaces/span_kind.ts b/sdk/core/core-tracing/lib/interfaces/span_kind.ts new file mode 100644 index 000000000000..688650f2beb6 --- /dev/null +++ b/sdk/core/core-tracing/lib/interfaces/span_kind.ts @@ -0,0 +1,50 @@ +/** + * Copyright 2019, 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. + */ + +/** + * Type of span. Can be used to specify additional relationships between spans + * in addition to a parent/child relationship. + */ +export enum SpanKind { + /** Default value. Indicates that the span is used internally. */ + INTERNAL = 0, + + /** + * Indicates that the span covers server-side handling of an RPC or other + * remote request. + */ + SERVER = 1, + + /** + * Indicates that the span covers the client-side wrapper around an RPC or + * other remote request. + */ + CLIENT = 2, + + /** + * Indicates that the span describes producer sending a message to a + * broker. Unlike client and server, there is no direct critical path latency + * relationship between producer and consumer spans. + */ + PRODUCER = 3, + + /** + * Indicates that the span describes consumer receiving a message from a + * broker. Unlike client and server, there is no direct critical path latency + * relationship between producer and consumer spans. + */ + CONSUMER = 4, +} diff --git a/sdk/core/core-tracing/lib/interfaces/status.ts b/sdk/core/core-tracing/lib/interfaces/status.ts new file mode 100644 index 000000000000..be84093ce18d --- /dev/null +++ b/sdk/core/core-tracing/lib/interfaces/status.ts @@ -0,0 +1,165 @@ +/** + * Copyright 2019, 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. + */ + +/** + * The status of a Span by providing a standard CanonicalCode in conjunction + * with an optional descriptive message. + */ +export interface Status { + /** The canonical code of this message. */ + code: CanonicalCode; + /** A developer-facing error message. */ + message?: string; +} + +/** + * An enumeration of canonical status codes. + * + * TODO (revision): https://github.com/open-telemetry/opentelemetry-specification/issues/59 + */ +export enum CanonicalCode { + /** + * Not an error; returned on success + */ + OK = 0, + /** + * The operation was cancelled (typically by the caller). + */ + CANCELLED = 1, + /** + * Unknown error. An example of where this error may be returned is + * if a status value received from another address space belongs to + * an error-space that is not known in this address space. Also + * errors raised by APIs that do not return enough error information + * may be converted to this error. + */ + UNKNOWN = 2, + /** + * Client specified an invalid argument. Note that this differs + * from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments + * that are problematic regardless of the state of the system + * (e.g., a malformed file name). + */ + INVALID_ARGUMENT = 3, + /** + * Deadline expired before operation could complete. For operations + * that change the state of the system, this error may be returned + * even if the operation has completed successfully. For example, a + * successful response from a server could have been delayed long + * enough for the deadline to expire. + */ + DEADLINE_EXCEEDED = 4, + /** + * Some requested entity (e.g., file or directory) was not found. + */ + NOT_FOUND = 5, + /** + * Some entity that we attempted to create (e.g., file or directory) + * already exists. + */ + ALREADY_EXISTS = 6, + /** + * The caller does not have permission to execute the specified + * operation. PERMISSION_DENIED must not be used for rejections + * caused by exhausting some resource (use RESOURCE_EXHAUSTED + * instead for those errors). PERMISSION_DENIED must not be + * used if the caller can not be identified (use UNAUTHENTICATED + * instead for those errors). + */ + PERMISSION_DENIED = 7, + /** + * Some resource has been exhausted, perhaps a per-user quota, or + * perhaps the entire file system is out of space. + */ + RESOURCE_EXHAUSTED = 8, + /** + * Operation was rejected because the system is not in a state + * required for the operation's execution. For example, directory + * to be deleted may be non-empty, an rmdir operation is applied to + * a non-directory, etc. + * + * A litmus test that may help a service implementor in deciding + * between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: + * + * - Use UNAVAILABLE if the client can retry just the failing call. + * - Use ABORTED if the client should retry at a higher-level + * (e.g., restarting a read-modify-write sequence). + * - Use FAILED_PRECONDITION if the client should not retry until + * the system state has been explicitly fixed. E.g., if an "rmdir" + * fails because the directory is non-empty, FAILED_PRECONDITION + * should be returned since the client should not retry unless + * they have first fixed up the directory by deleting files from it. + * - Use FAILED_PRECONDITION if the client performs conditional + * REST Get/Update/Delete on a resource and the resource on the + * server does not match the condition. E.g., conflicting + * read-modify-write on the same resource. + */ + FAILED_PRECONDITION = 9, + /** + * The operation was aborted, typically due to a concurrency issue + * like sequencer check failures, transaction aborts, etc. + * + * See litmus test above for deciding between FAILED_PRECONDITION, + * ABORTED, and UNAVAILABLE. + */ + ABORTED = 10, + /** + * Operation was attempted past the valid range. E.g., seeking or + * reading past end of file. + * + * Unlike INVALID_ARGUMENT, this error indicates a problem that may + * be fixed if the system state changes. For example, a 32-bit file + * system will generate INVALID_ARGUMENT if asked to read at an + * offset that is not in the range [0,2^32-1], but it will generate + * OUT_OF_RANGE if asked to read from an offset past the current + * file size. + * + * There is a fair bit of overlap between FAILED_PRECONDITION and + * OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific + * error) when it applies so that callers who are iterating through + * a space can easily look for an OUT_OF_RANGE error to detect when + * they are done. + */ + OUT_OF_RANGE = 11, + /** + * Operation is not implemented or not supported/enabled in this service. + */ + UNIMPLEMENTED = 12, + /** + * Internal errors. Means some invariants expected by underlying + * system has been broken. If you see one of these errors, + * something is very broken. + */ + INTERNAL = 13, + /** + * The service is currently unavailable. This is a most likely a + * transient condition and may be corrected by retrying with + * a backoff. + * + * See litmus test above for deciding between FAILED_PRECONDITION, + * ABORTED, and UNAVAILABLE. + */ + UNAVAILABLE = 14, + /** + * Unrecoverable data loss or corruption. + */ + DATA_LOSS = 15, + /** + * The request does not have valid authentication credentials for the + * operation. + */ + UNAUTHENTICATED = 16, +} diff --git a/sdk/core/core-tracing/lib/interfaces/trace_options.ts b/sdk/core/core-tracing/lib/interfaces/trace_options.ts new file mode 100644 index 000000000000..2bad26194d26 --- /dev/null +++ b/sdk/core/core-tracing/lib/interfaces/trace_options.ts @@ -0,0 +1,27 @@ +/** + * Copyright 2019, 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. + */ + +/** + * An enumeration that represents global trace options. These options are + * propagated to all child {@link Span}. These determine features such as + * whether a Span should be traced. It is implemented as a bitmask. + */ +export enum TraceOptions { + /** Bit to represent whether trace is unsampled in trace options. */ + UNSAMPLED = 0x0, + /** Bit to represent whether trace is sampled in trace options. */ + SAMPLED = 0x1, +} diff --git a/sdk/core/core-tracing/lib/interfaces/trace_state.ts b/sdk/core/core-tracing/lib/interfaces/trace_state.ts new file mode 100644 index 000000000000..78561119a426 --- /dev/null +++ b/sdk/core/core-tracing/lib/interfaces/trace_state.ts @@ -0,0 +1,63 @@ +/** + * Copyright 2019, 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. + */ + +/** + * Tracestate carries system-specific configuration data, represented as a list + * of key-value pairs. TraceState allows multiple tracing systems to + * participate in the same trace. + */ +export interface TraceState { + /** + * Adds or updates the TraceState that has the given `key` if it is + * present. The new State will always be added in the front of the + * list of states. + * + * @param key key of the TraceState entry. + * @param value value of the TraceState entry. + */ + set(key: string, value: string): void; + + /** + * Removes the TraceState Entry that has the given `key` if it is present. + * + * @param key the key for the TraceState Entry to be removed. + */ + unset(key: string): void; + + /** + * Returns the value to which the specified key is mapped, or `undefined` if + * this map contains no mapping for the key. + * + * @param key with which the specified value is to be associated. + * @returns the value to which the specified key is mapped, or `undefined` if + * this map contains no mapping for the key. + */ + get(key: string): string | undefined; + + // TODO: Consider to add support for merging an object as well by also + // accepting a single internalTraceState argument similar to the constructor. + + /** + * Serializes the TraceState to a `list` as defined below. The `list` is a + * series of `list-members` separated by commas `,`, and a list-member is a + * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs + * surrounding `list-members` are ignored. There can be a maximum of 32 + * `list-members` in a `list`. + * + * @returns the serialized string. + */ + serialize(): string; +} diff --git a/sdk/core/core-tracing/lib/interfaces/tracer.ts b/sdk/core/core-tracing/lib/interfaces/tracer.ts new file mode 100644 index 000000000000..bec95f236048 --- /dev/null +++ b/sdk/core/core-tracing/lib/interfaces/tracer.ts @@ -0,0 +1,92 @@ +/** + * Copyright 2019, 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 { Span } from './span'; +import { SpanOptions } from './SpanOptions'; + +/** + * Tracer provides an interface for creating {@link Span}s and propagating + * context in-process. + * + * Users may choose to use manual or automatic Context propagation. Because of + * that this class offers APIs to facilitate both usages. + */ +export interface Tracer { + /** + * Returns the current Span from the current context if available. + * + * If there is no Span associated with the current context, a default Span + * with invalid SpanContext is returned. + * + * @returns Span The currently active Span + */ + getCurrentSpan(): Span; + + /** + * Starts a new {@link Span}. + * @param name The name of the span + * @param [options] SpanOptions used for span creation + * @returns Span The newly created span + */ + startSpan(name: string, options?: SpanOptions): Span; + + /** + * Executes the function given by fn within the context provided by Span + * + * @param span The span that provides the context + * @param fn The function to be eexcuted inside the provided context + */ + withSpan unknown>( + span: Span, + fn: T + ): ReturnType; + + /** + * Send a pre-populated span object to the exporter. + * Sampling and recording decisions as well as other collection optimizations + * are the responsibility of a caller. + * + * @todo: Pending API discussion. Revisit if Span or SpanData should be passed + * in here once this is sorted out. + * @param span Span Data to be reported to all exporters. + */ + recordSpanData(span: Span): void; + + /** + * Returns the {@link BinaryFormat} interface which can serialize/deserialize + * Spans. + * + * If no tracer implementation is provided, this defaults to the W3C Trace + * Context binary format ({@link BinaryFormat}). For more details see + * W3C Trace Context + * binary protocol. + * + * @todo: Change return type once BinaryFormat is available + */ + getBinaryFormat(): unknown; + + /** + * Returns the {@link HttpTextFormat} interface which can inject/extract + * Spans. + * + * If no tracer implementation is provided, this defaults to the W3C Trace + * Context HTTP text format ({@link HttpTraceContext}). For more details see + * W3C Trace Context. + * + * @todo: Change return type once HttpTextFormat is available + */ + getHttpTextFormat(): unknown; +} diff --git a/sdk/core/core-tracing/lib/plugins/noop/noOpSpanPlugin.ts b/sdk/core/core-tracing/lib/plugins/noop/noOpSpanPlugin.ts new file mode 100644 index 000000000000..11d96ac5edc4 --- /dev/null +++ b/sdk/core/core-tracing/lib/plugins/noop/noOpSpanPlugin.ts @@ -0,0 +1,52 @@ +import { Span } from "../../interfaces/span"; +import { SpanContext } from "../../interfaces/span_context"; +import { Attributes } from "../../interfaces/attributes"; +import { Status } from "../../interfaces/status"; + +export class NoOpSpanPlugin implements Span { + private _span: any; + + constructor(span: any) { + this._span = span; + } + + context(): SpanContext { + throw new Error("Method not implemented."); + } + + end(endTime?: number): void { + this._span.end(endTime); + } + + start(startTime?: number): void { + this._span.start(startTime); + } + + setAttribute(key: string, value: unknown): this { + throw new Error("Method not implemented."); + } + + setAttributes(attributes: Attributes): this { + throw new Error("Method not implemented."); + } + + addEvent(name: string, attributes?: Attributes): this { + throw new Error("Method not implemented."); + } + + addLink(spanContext: SpanContext, attributes?: Attributes): this { + throw new Error("Method not implemented."); + } + + setStatus(status: Status): this { + throw new Error("Method not implemented."); + } + + updateName(name: string): this { + throw new Error("Method not implemented."); + } + + isRecordingEvents(): boolean { + throw new Error("Method not implemented."); + } +} diff --git a/sdk/core/core-tracing/lib/plugins/noop/noOpTracePlugin.ts b/sdk/core/core-tracing/lib/plugins/noop/noOpTracePlugin.ts new file mode 100644 index 000000000000..4161a78f3dd7 --- /dev/null +++ b/sdk/core/core-tracing/lib/plugins/noop/noOpTracePlugin.ts @@ -0,0 +1,35 @@ +import { Tracer } from "../../interfaces/tracer"; +import { Span } from "../../interfaces/span"; +import { SpanOptions } from "../../interfaces/SpanOptions"; +import { NoOpSpanPlugin } from "./noOpSpanPlugin"; +import { SpanNoOpImpl } from "../../implementations/noop/spanNoOpImpl"; + +export class NoOpTracePlugin implements Tracer { + private _tracer: any; + + public constructor(tracer: any) { + this._tracer = tracer; + } + + startSpan(name: string, options?: SpanOptions): Span { + const span = new SpanNoOpImpl(); + const noOpSpanPlugin = new NoOpSpanPlugin(span); + return noOpSpanPlugin; + } + + getCurrentSpan(): Span { + throw new Error("Method not implemented."); + } + withSpan unknown>(span: Span, fn: T): ReturnType { + throw new Error("Method not implemented."); + } + recordSpanData(span: Span): void { + throw new Error("Method not implemented."); + } + getBinaryFormat(): unknown { + throw new Error("Method not implemented."); + } + getHttpTextFormat(): unknown { + throw new Error("Method not implemented."); + } +} diff --git a/sdk/core/core-tracing/lib/plugins/opencensus/openCensusSpanPlugin.ts b/sdk/core/core-tracing/lib/plugins/opencensus/openCensusSpanPlugin.ts new file mode 100644 index 000000000000..1e3aa3f5669a --- /dev/null +++ b/sdk/core/core-tracing/lib/plugins/opencensus/openCensusSpanPlugin.ts @@ -0,0 +1,61 @@ +import { Span } from "../../interfaces/span"; +import { SpanContext } from "../../interfaces/span_context"; +import { Attributes } from "../../interfaces/attributes"; +import { Status } from "../../interfaces/status"; + +export class OpenCensusSpanPlugin implements Span { + private _span: any; + + public getSpan() { + return this._span; + } + + constructor(span: any) { + this._span = span; + } + + end(endTime?: number): void { + this._span.end(endTime); + } + + start(startTime?: number): void { + this._span.start(startTime); + } + + context(): SpanContext { + throw new Error("Method not implemented."); + } + + setAttribute(key: string, value: unknown): this { + this._span.addAttribute(key, value); + return this; + } + + setAttributes(attributes: Attributes): this { + throw new Error("Method not implemented."); + } + + addEvent(name: string, attributes?: Attributes): this { + throw new Error("Method not implemented."); + } + + addLink(spanContext: SpanContext, attributes?: Attributes): this { + // Since there is no way to specify the link relationship + // It is set as Unspecified = 0 + this._span.addLink(spanContext.traceId, spanContext.spanId, 0, attributes); + return this; + } + + setStatus(status: Status): this { + this._span.setStatus(status.code, status.message); + return this; + } + + updateName(name: string): this { + throw new Error("Method not implemented."); + } + + isRecordingEvents(): boolean { + throw new Error("Method not implemented."); + } +} diff --git a/sdk/core/core-tracing/lib/plugins/opencensus/openCensusTracePlugin.ts b/sdk/core/core-tracing/lib/plugins/opencensus/openCensusTracePlugin.ts new file mode 100644 index 000000000000..1e1cdb086156 --- /dev/null +++ b/sdk/core/core-tracing/lib/plugins/opencensus/openCensusTracePlugin.ts @@ -0,0 +1,47 @@ +import { Tracer } from "../../interfaces/tracer"; +import { SpanOptions } from "../../interfaces/SpanOptions"; +import { Span } from "../../interfaces/span"; +import { OpenCensusSpanPlugin } from "../opencensus/openCensusSpanPlugin"; + +export class OpenCensusTracePlugin implements Tracer { + private _tracer: any; + + public constructor(tracer: any) { + this._tracer = tracer; + } + + startSpan(name: string, options?: SpanOptions): Span { + const parent = options + ? options.parent + ? options.parent instanceof OpenCensusSpanPlugin + ? options.parent.getSpan() + : options.parent + : undefined + : undefined; + + const span = this._tracer.startChildSpan({ + name: name, + childOf: parent + }); + + const openCensusSpanPlugin = new OpenCensusSpanPlugin(span); + return openCensusSpanPlugin; + } + + getCurrentSpan(): Span { + throw new Error("Method not implemented."); + } + + withSpan unknown>(span: Span, fn: T): ReturnType { + throw new Error("Method not implemented."); + } + recordSpanData(span: Span): void { + throw new Error("Method not implemented."); + } + getBinaryFormat(): unknown { + throw new Error("Method not implemented."); + } + getHttpTextFormat(): unknown { + throw new Error("Method not implemented."); + } +} diff --git a/sdk/core/core-tracing/lib/tracerProxy.ts b/sdk/core/core-tracing/lib/tracerProxy.ts new file mode 100644 index 000000000000..627acfe682de --- /dev/null +++ b/sdk/core/core-tracing/lib/tracerProxy.ts @@ -0,0 +1,26 @@ +import { SupportedPlugins } from "./utils/supportedPlugins"; +import { OpenCensusTracePlugin } from "./plugins/opencensus/openCensusTracePlugin"; +import { NoOpTracePlugin } from "./plugins/noop/noOpTracePlugin"; +import { TracerNoOpImpl } from "./implementations/noop/tracerNoOpImpl"; +import { Tracer } from "./interfaces/tracer"; + +export class TracerProxy { + private static _tracerPlugin: Tracer; + + private constructor() {} + + public static setTracer(tracer: any, tracerPluginType: SupportedPlugins) { + if (tracerPluginType === SupportedPlugins.OPENCENSUS) { + TracerProxy._tracerPlugin = new OpenCensusTracePlugin(tracer); + } else { + TracerProxy._tracerPlugin = new NoOpTracePlugin(tracer); + } + } + + public static getTracer() { + if (!TracerProxy._tracerPlugin) { + TracerProxy._tracerPlugin = new NoOpTracePlugin(new TracerNoOpImpl()); + } + return TracerProxy._tracerPlugin; + } +} diff --git a/sdk/core/core-tracing/lib/utils/supportedPlugins.ts b/sdk/core/core-tracing/lib/utils/supportedPlugins.ts new file mode 100644 index 000000000000..5eaeba3b2c20 --- /dev/null +++ b/sdk/core/core-tracing/lib/utils/supportedPlugins.ts @@ -0,0 +1,4 @@ +export enum SupportedPlugins { + OPENCENSUS, + NOOP +} diff --git a/sdk/core/core-tracing/package.json b/sdk/core/core-tracing/package.json new file mode 100644 index 000000000000..0d13b4c8a1cc --- /dev/null +++ b/sdk/core/core-tracing/package.json @@ -0,0 +1,95 @@ +{ + "name": "@azure/core-tracing", + "version": "1.0.0-preview.1", + "description": "Provides low-level interfaces and helper methods for tracing in Azure SDK", + "sdk-type": "client", + "main": "dist/index.js", + "module": "dist-esm/index.js", + "browser": { + "./dist/index.js": "./browser/index.js" + }, + "types": "types/core-tracing.d.ts", + "scripts": { + "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", + "build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1", + "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1", + "build:samples": "cd samples && tsc -p .", + "build:test": "tsc -p . && rollup -c rollup.test.config.js 2>&1", + "build": "tsc -p . && rollup -c 2>&1 && api-extractor run --local", + "check-format": "prettier --list-different --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "clean": "rimraf dist dist-esm test-dist types *.tgz *.log", + "extract-api": "tsc -p . && api-extractor run --local", + "format": "prettier --write --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "integration-test:browser": "echo skipped", + "integration-test:node": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "lint:fix": "eslint \"src/**/*.ts\" \"test/**/*.ts\" -c ../../.eslintrc.json --fix --fix-type [problem,suggestion]", + "lint": "eslint -c ../../.eslintrc.json lib --ext .ts -f node_modules/eslint-detailed-reporter/lib/detailed.js -o template-lintReport.html || exit 0", + "pack": "npm pack 2>&1", + "prebuild": "npm run clean", + "test:browser": "npm run build:test && npm run unit-test:browser && npm run integration-test:browser", + "test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node", + "test": "npm run build:test && npm run unit-test && npm run integration-test", + "unit-test:browser": "echo skipped", + "unit-test:node": "mocha test-dist/**/*.js --reporter mocha-multi --reporter-options spec=-,mocha-junit-reporter=-", + "unit-test": "npm run unit-test:node && npm run unit-test:browser" + }, + "files": [ + "browser/*.js*", + "dist/", + "dist-esm/", + "src/", + "types/core-tracing.d.ts" + ], + "repository": "github:Azure/azure-sdk-for-js", + "keywords": [ + "azure", + "tracing" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/azure/azure-sdk-for-js/issues" + }, + "engine": { + "node": ">=6.0.0" + }, + "homepage": "https://github.com/azure/azure-sdk-for-js/tree/master/sdk/core/core-tracing", + "sideEffects": false, + "private": true, + "dependencies": { + "tslib": "^1.9.3" + }, + "devDependencies": { + "@microsoft/api-extractor": "^7.1.5", + "@types/mocha": "^5.2.5", + "@types/node": "^8.0.0", + "@typescript-eslint/eslint-plugin": "^1.11.0", + "@typescript-eslint/parser": "^1.11.0", + "assert": "^1.4.1", + "cross-env": "^5.2.0", + "eslint": "^5.16.0", + "eslint-config-prettier": "^6.0.0", + "eslint-detailed-reporter": "^0.8.0", + "eslint-plugin-no-null": "^1.0.2", + "eslint-plugin-no-only-tests": "^2.3.0", + "eslint-plugin-promise": "^4.1.1", + "inherits": "^2.0.3", + "mocha": "^5.2.0", + "mocha-junit-reporter": "^1.18.0", + "mocha-multi": "^1.0.1", + "prettier": "^1.16.4", + "rimraf": "^2.6.2", + "rollup": "^1.16.3", + "rollup-plugin-commonjs": "^10.0.0", + "rollup-plugin-json": "^4.0.0", + "rollup-plugin-multi-entry": "^2.1.0", + "rollup-plugin-node-resolve": "^5.0.2", + "rollup-plugin-replace": "^2.1.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "rollup-plugin-terser": "^5.1.1", + "rollup-plugin-visualizer": "^2.0.0", + "typescript": "^3.2.2", + "util": "^0.12.1" + } +} diff --git a/sdk/core/core-tracing/review/core-tracing.api.md b/sdk/core/core-tracing/review/core-tracing.api.md new file mode 100644 index 000000000000..adb07cd6f2e4 --- /dev/null +++ b/sdk/core/core-tracing/review/core-tracing.api.md @@ -0,0 +1,274 @@ +## API Report File for "@azure/core-tracing" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +// @public +export interface Attributes { + // (undocumented) + [attributeKey: string]: unknown; +} + +// @public +export enum CanonicalCode { + ABORTED = 10, + ALREADY_EXISTS = 6, + CANCELLED = 1, + DATA_LOSS = 15, + DEADLINE_EXCEEDED = 4, + FAILED_PRECONDITION = 9, + INTERNAL = 13, + INVALID_ARGUMENT = 3, + NOT_FOUND = 5, + OK = 0, + OUT_OF_RANGE = 11, + PERMISSION_DENIED = 7, + RESOURCE_EXHAUSTED = 8, + UNAUTHENTICATED = 16, + UNAVAILABLE = 14, + UNIMPLEMENTED = 12, + UNKNOWN = 2 +} + +// @public +export interface Event { + attributes?: Attributes; + name: string; +} + +// @public +export interface Link { + attributes?: Attributes; + spanContext: SpanContext; +} + +// @public (undocumented) +export class NoOpSpanPlugin implements Span { + constructor(span: any); + // (undocumented) + addEvent(name: string, attributes?: Attributes): this; + // (undocumented) + addLink(spanContext: SpanContext, attributes?: Attributes): this; + // (undocumented) + context(): SpanContext; + // (undocumented) + end(endTime?: number): void; + // (undocumented) + isRecordingEvents(): boolean; + // (undocumented) + setAttribute(key: string, value: unknown): this; + // (undocumented) + setAttributes(attributes: Attributes): this; + // (undocumented) + setStatus(status: Status): this; + // (undocumented) + start(startTime?: number): void; + // (undocumented) + updateName(name: string): this; +} + +// @public (undocumented) +export class NoOpTracePlugin implements Tracer { + constructor(tracer: any); + // (undocumented) + getBinaryFormat(): unknown; + // (undocumented) + getCurrentSpan(): Span; + // (undocumented) + getHttpTextFormat(): unknown; + // (undocumented) + recordSpanData(span: Span): void; + // (undocumented) + startSpan(name: string, options?: SpanOptions): Span; + // (undocumented) + withSpan unknown>(span: Span, fn: T): ReturnType; +} + +// @public (undocumented) +export class OpenCensusSpanPlugin implements Span { + constructor(span: any); + // (undocumented) + addEvent(name: string, attributes?: Attributes): this; + // (undocumented) + addLink(spanContext: SpanContext, attributes?: Attributes): this; + // (undocumented) + context(): SpanContext; + // (undocumented) + end(endTime?: number): void; + // (undocumented) + getSpan(): any; + // (undocumented) + isRecordingEvents(): boolean; + // (undocumented) + setAttribute(key: string, value: unknown): this; + // (undocumented) + setAttributes(attributes: Attributes): this; + // (undocumented) + setStatus(status: Status): this; + // (undocumented) + start(startTime?: number): void; + // (undocumented) + updateName(name: string): this; +} + +// @public (undocumented) +export class OpenCensusTracePlugin implements Tracer { + constructor(tracer: any); + // (undocumented) + getBinaryFormat(): unknown; + // (undocumented) + getCurrentSpan(): Span; + // (undocumented) + getHttpTextFormat(): unknown; + // (undocumented) + recordSpanData(span: Span): void; + // (undocumented) + startSpan(name: string, options?: SpanOptions): Span; + // (undocumented) + withSpan unknown>(span: Span, fn: T): ReturnType; +} + +// @public +export interface Sampler { + shouldSample(parentContext?: SpanContext): boolean; + toString(): string; +} + +// @public +export interface Span { + addEvent(name: string, attributes?: Attributes): this; + addLink(spanContext: SpanContext, attributes?: Attributes): this; + context(): SpanContext; + end(endTime?: number): void; + isRecordingEvents(): boolean; + setAttribute(key: string, value: unknown): this; + setAttributes(attributes: Attributes): this; + setStatus(status: Status): this; + // (undocumented) + start(startTime?: number): void; + updateName(name: string): this; +} + +// @public +export interface SpanContext { + spanId: string; + traceId: string; + traceOptions?: TraceOptions; + traceState?: TraceState; +} + +// @public +export enum SpanKind { + CLIENT = 2, + CONSUMER = 4, + INTERNAL = 0, + PRODUCER = 3, + SERVER = 1 +} + +// @public (undocumented) +export class SpanNoOpImpl implements Span { + // (undocumented) + addEvent(name: string, attributes?: Attributes | undefined): this; + // (undocumented) + addLink(spanContext: SpanContext, attributes?: Attributes | undefined): this; + // (undocumented) + context(): SpanContext; + // (undocumented) + end(endTime?: number): void; + // (undocumented) + isRecordingEvents(): boolean; + // (undocumented) + setAttribute(key: string, value: unknown): this; + // (undocumented) + setAttributes(attributes: Attributes): this; + // (undocumented) + setStatus(status: Status): this; + // (undocumented) + start(startTime?: number): void; + // (undocumented) + updateName(name: string): this; +} + +// @public +export interface SpanOptions { + attributes?: Attributes; + isRecordingEvents?: boolean; + kind?: SpanKind; + parent?: Span | SpanContext; + startTime?: number; +} + +// @public +export interface Status { + code: CanonicalCode; + message?: string; +} + +// @public (undocumented) +export enum SupportedPlugins { + // (undocumented) + NOOP = 1, + // (undocumented) + OPENCENSUS = 0 +} + +// @public +export interface TimedEvent extends Event { + // (undocumented) + time: number; +} + +// @public +export enum TraceOptions { + SAMPLED = 1, + UNSAMPLED = 0 +} + +// @public +export interface Tracer { + getBinaryFormat(): unknown; + getCurrentSpan(): Span; + getHttpTextFormat(): unknown; + recordSpanData(span: Span): void; + startSpan(name: string, options?: SpanOptions): Span; + withSpan unknown>(span: Span, fn: T): ReturnType; +} + +// @public (undocumented) +export class TracerNoOpImpl implements Tracer { + // (undocumented) + getBinaryFormat(): unknown; + // (undocumented) + getCurrentSpan(): Span; + // (undocumented) + getHttpTextFormat(): unknown; + // (undocumented) + recordSpanData(span: Span): void; + // (undocumented) + startSpan(name: string, options?: SpanOptions | undefined): Span; + // (undocumented) + withSpan unknown>(span: Span, fn: T): ReturnType; +} + +// @public (undocumented) +export class TracerProxy { + // (undocumented) + static getTracer(): Tracer; + // (undocumented) + static setTracer(tracer: any, tracerPluginType: SupportedPlugins): void; + } + +// @public +export interface TraceState { + get(key: string): string | undefined; + serialize(): string; + set(key: string, value: string): void; + unset(key: string): void; +} + + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/core/core-tracing/rollup.base.config.js b/sdk/core/core-tracing/rollup.base.config.js new file mode 100644 index 000000000000..e5af2fcc90c6 --- /dev/null +++ b/sdk/core/core-tracing/rollup.base.config.js @@ -0,0 +1,103 @@ +import nodeResolve from "rollup-plugin-node-resolve"; +import multiEntry from "rollup-plugin-multi-entry"; +import cjs from "rollup-plugin-commonjs"; +import replace from "rollup-plugin-replace"; +import { terser } from "rollup-plugin-terser"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import viz from "rollup-plugin-visualizer"; + +const pkg = require("./package.json"); +const depNames = Object.keys(pkg.dependencies); +const input = "dist-esm/index.js"; +const production = process.env.NODE_ENV === "production"; + +export function nodeConfig(test = false) { + const externalNodeBuiltins = ["events"]; + const baseConfig = { + input: input, + external: depNames.concat(externalNodeBuiltins), + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [ + sourcemaps(), + replace({ + delimiters: ["", ""], + values: { + // replace dynamic checks with if (true) since this is for node only. + // Allows rollup's dead code elimination to be more aggressive. + "if (isNode)": "if (true)" + } + }), + nodeResolve({ preferBuiltins: true }), + cjs() + ] + }; + + if (test) { + // entry point is every test file + baseConfig.input = "dist-esm/test/**/*.spec.js"; + baseConfig.plugins.unshift(multiEntry({ exports: false })); + + // different output file + baseConfig.output.file = "test-dist/index.js"; + + // mark assert as external + baseConfig.external.push("assert"); + + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, rollup started respecting + // the "sideEffects" field in package.json. Since our package.json sets "sideEffects=false", this also + // applies to test code, which causes all tests to be removed by tree-shaking. + baseConfig.treeshake = false; + } else if (production) { + baseConfig.plugins.push(terser()); + } + + return baseConfig; +} + +export function browserConfig(test = false, production = false) { + const baseConfig = { + input: input, + output: { + file: "browser/core-tracing.js", + format: "umd", + name: "Azure.Core.Tracing", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + sourcemaps(), + replace({ + delimiters: ["", ""], + values: { + // replace dynamic checks with if (false) since this is for + // browser only. Rollup's dead code elimination will remove + // any code guarded by if (isNode) { ... } + "if (isNode)": "if (false)" + } + }), + nodeResolve({ + mainFields: ["module", "browser"], + preferBuiltins: false + }), + cjs(), + viz({ filename: "browser/browser-stats.html", sourcemap: false }) + ] + }; + + if (test) { + baseConfig.input = "dist-esm/test/**/*.spec.js"; + baseConfig.plugins.unshift(multiEntry({ exports: false })); + baseConfig.output.file = "test-browser/index.js"; + + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, rollup started respecting + // the "sideEffects" field in package.json. Since our package.json sets "sideEffects=false", this also + // applies to test code, which causes all tests to be removed by tree-shaking. + baseConfig.treeshake = false; + } else if (production) { + baseConfig.output.file = "browser/core-tracing.min.js"; + baseConfig.plugins.push(terser()); + } + + return baseConfig; +} diff --git a/sdk/core/core-tracing/rollup.config.js b/sdk/core/core-tracing/rollup.config.js new file mode 100644 index 000000000000..49a26bd6fdd6 --- /dev/null +++ b/sdk/core/core-tracing/rollup.config.js @@ -0,0 +1,14 @@ +import * as base from "./rollup.base.config"; + +const inputs = []; + +if (!process.env.ONLY_BROWSER) { + inputs.push(base.nodeConfig()); +} + +if (!process.env.ONLY_NODE) { + inputs.push(base.browserConfig()); + inputs.push(base.browserConfig(false, true)); +} + +export default inputs; diff --git a/sdk/core/core-tracing/rollup.test.config.js b/sdk/core/core-tracing/rollup.test.config.js new file mode 100644 index 000000000000..069a53566909 --- /dev/null +++ b/sdk/core/core-tracing/rollup.test.config.js @@ -0,0 +1,3 @@ +import * as base from "./rollup.base.config"; + +export default [base.nodeConfig(true), base.browserConfig(true)]; \ No newline at end of file diff --git a/sdk/core/core-tracing/tsconfig.json b/sdk/core/core-tracing/tsconfig.json new file mode 100644 index 000000000000..2e1218772c63 --- /dev/null +++ b/sdk/core/core-tracing/tsconfig.json @@ -0,0 +1,61 @@ +{ + "compilerOptions": { + /* Basic Options */ + "target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, + "module": "es6" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, + // "lib": [], /* Specify library files to be included in the compilation. */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + "declaration": true /* Generates corresponding '.d.ts' file. */, + "declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */, + "declarationDir": "./types" /* Output directory for generated declaration files.*/, + "sourceMap": true /* Generates corresponding '.map' file. */, + // "outFile": "./", /* Concatenate and emit output to single file. */ + "outDir": "./dist-esm" /* Redirect output structure to the directory. */, + // "rootDir": "." /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, + // "composite": true, /* Enable project compilation */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + "importHelpers": true /* Import emit helpers from 'tslib'. */, + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true /* Enable all strict type-checking options. */, + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [] /* List of root folders whose combined content represents the structure of the project at runtime. */, + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */, + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + "forceConsistentCasingInFileNames": true + } +}