From e0ef91a6119b24b353632494595c5c195aae0d80 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 8 Apr 2022 11:36:14 -0400 Subject: [PATCH 01/18] chore: use a single lerna monorepo --- .github/workflows/lint.yml | 13 +- .github/workflows/peer-api.yaml | 4 - .github/workflows/unit-test.yml | 126 ------------------ .../node10/tsconfig.json | 3 + .../node12/tsconfig.json | 3 + .../node8/tsconfig.json | 3 + experimental/lerna.json | 8 -- experimental/package.json | 1 - .../exporter-trace-otlp-grpc/tsconfig.json | 9 ++ .../exporter-trace-otlp-http/tsconfig.json | 11 ++ .../exporter-trace-otlp-proto/tsconfig.json | 9 ++ .../tsconfig.json | 6 + .../tsconfig.json | 6 + .../tsconfig.json | 6 + .../tsconfig.json | 3 + .../tsconfig.json | 18 +++ .../tsconfig.json | 15 +++ .../tsconfig.json | 15 +++ .../tsconfig.json | 18 +++ .../tsconfig.json | 6 + .../opentelemetry-sdk-node/tsconfig.json | 15 +++ .../packages/otlp-transformer/tsconfig.json | 9 ++ experimental/tsconfig.json | 63 --------- lerna.json | 2 + tsconfig.json | 57 ++++++++ 25 files changed, 215 insertions(+), 214 deletions(-) delete mode 100644 experimental/lerna.json delete mode 120000 experimental/package.json delete mode 100644 experimental/tsconfig.json diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b00d143182..42bc17b5db 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,10 +8,6 @@ on: jobs: build: - strategy: - fail-fast: false - matrix: - package-group: [".", "experimental"] runs-on: ubuntu-latest steps: @@ -22,7 +18,6 @@ jobs: - uses: actions/checkout@v2 - name: Lint changelog file - if: ${{ matrix.package-group == '.' }} uses: avto-dev/markdown-lint@v1 with: # Commenting due to @@ -33,7 +28,6 @@ jobs: args: "./CHANGELOG.md" - name: Lint markdown files - if: ${{ matrix.package-group == '.' }} uses: avto-dev/markdown-lint@v1 with: args: "./**/*.md" @@ -45,27 +39,22 @@ jobs: with: path: | node_modules - experimental/node_modules */*/node_modules - experimental/*/*/node_modules - key: lint-${{ matrix.package-group }}-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}-20211216.2 + key: lint-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}-20211216.2 # On a cache miss, install dependencies - name: Bootstrap if: steps.cache.outputs.cache-hit != 'true' - working-directory: ${{ matrix.package-group }} run: | npm install --ignore-scripts npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' - name: Lint - working-directory: ${{ matrix.package-group }} run: | npm run lint npm run lint:examples - name: Lint doc files - if: ${{ matrix.package-group == '.' }} run: | npm run compile NODE_OPTIONS=--max-old-space-size=4096 npm run docs diff --git a/.github/workflows/peer-api.yaml b/.github/workflows/peer-api.yaml index 80299fc879..10e9b48065 100644 --- a/.github/workflows/peer-api.yaml +++ b/.github/workflows/peer-api.yaml @@ -24,7 +24,3 @@ jobs: - name: Check API dependency semantics (stable) working-directory: packages run: lerna exec --ignore propagation-validation-server --ignore propagation-validation-server --ignore @opentelemetry/selenium-tests "node ../../scripts/peer-api-check.js" - - - name: Check API dependency semantics (experimental) - working-directory: experimental - run: lerna exec --ignore propagation-validation-server --ignore @opentelemetry/selenium-tests --ignore @opentelemetry/api-metrics --ignore @opentelemetry/otlp-transformer "node ../../../scripts/peer-api-check.js" diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 4c4d37b51d..be9aec6141 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -120,129 +120,3 @@ jobs: run: npm run test:webworker - name: Report Coverage run: npm run codecov:webworker - node-tests-experimental: - strategy: - fail-fast: false - matrix: - node_version: ["8", "10", "12", "14", "16"] - runs-on: ubuntu-latest - env: - NPM_CONFIG_UNSAFE_PERM: true - steps: - - name: Checkout - uses: actions/checkout@v2 - - - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node_version }} - - - name: restore lerna - id: cache - uses: actions/cache@v3 - with: - path: | - experimental/node_modules - experimental/*/*/node_modules - key: node-tests-experimental-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('experimental/**/package.json') }} - - - name: Bootstrap - if: steps.cache.outputs.cache-hit != 'true' - working-directory: experimental - run: | - npm install --ignore-scripts - npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' - - - name: Build 🔧 - working-directory: experimental - run: | - npm run compile - - - name: Unit tests - working-directory: experimental - run: npm run test - - name: Report Coverage - working-directory: experimental - run: npm run codecov - if: ${{ matrix.node_version == '14' }} - browser-tests-experimental: - runs-on: ubuntu-latest - container: - image: circleci/node:16-browsers - env: - NPM_CONFIG_UNSAFE_PERM: true - steps: - - name: Permission Setup - run: sudo chmod -R 777 /github /__w - - name: Checkout - uses: actions/checkout@v2 - - - name: restore lerna - uses: actions/cache@v3 - id: cache - with: - path: | - experimental/node_modules - experimental/*/*/node_modules - key: browser-tests-experimental-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }} - - - name: Bootstrap - if: steps.cache.outputs.cache-hit != 'true' - working-directory: experimental - run: | - npm install --ignore-scripts - npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' - - - name: Build 🔧 - working-directory: experimental - run: | - npm run compile - # run additional compilation variants - npx lerna run compile - - - name: Unit tests - working-directory: experimental - run: npm run test:browser - - name: Report Coverage - working-directory: experimental - run: npm run codecov:browser - webworker-tests-experimental: - runs-on: ubuntu-latest - container: - image: circleci/node:14-browsers - env: - NPM_CONFIG_UNSAFE_PERM: true - steps: - - name: Checkout - uses: actions/checkout@v1 - - name: Permission Setup - run: sudo chmod -R 777 /github /__w - - - name: restore lerna - uses: actions/cache@v3 - id: cache - with: - path: | - experimental/node_modules - experimental/*/*/node_modules - key: browser-tests-experimental-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }} - - - name: Bootstrap - if: steps.cache.outputs.cache-hit != 'true' - working-directory: experimental - run: | - npm install --ignore-scripts - npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' - - - name: Build 🔧 - working-directory: experimental - run: | - npm run compile - # run additional compilation variants - npx lerna run compile - - - name: Unit tests - working-directory: experimental - run: npm run test:webworker - - name: Report Coverage - working-directory: experimental - run: npm run codecov:webworker diff --git a/experimental/backwards-compatability/node10/tsconfig.json b/experimental/backwards-compatability/node10/tsconfig.json index 049617e92f..93d86afe21 100644 --- a/experimental/backwards-compatability/node10/tsconfig.json +++ b/experimental/backwards-compatability/node10/tsconfig.json @@ -8,6 +8,9 @@ "index.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, { "path": "../../packages/opentelemetry-sdk-node" } diff --git a/experimental/backwards-compatability/node12/tsconfig.json b/experimental/backwards-compatability/node12/tsconfig.json index 049617e92f..93d86afe21 100644 --- a/experimental/backwards-compatability/node12/tsconfig.json +++ b/experimental/backwards-compatability/node12/tsconfig.json @@ -8,6 +8,9 @@ "index.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, { "path": "../../packages/opentelemetry-sdk-node" } diff --git a/experimental/backwards-compatability/node8/tsconfig.json b/experimental/backwards-compatability/node8/tsconfig.json index 049617e92f..93d86afe21 100644 --- a/experimental/backwards-compatability/node8/tsconfig.json +++ b/experimental/backwards-compatability/node8/tsconfig.json @@ -8,6 +8,9 @@ "index.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, { "path": "../../packages/opentelemetry-sdk-node" } diff --git a/experimental/lerna.json b/experimental/lerna.json deleted file mode 100644 index 1b4e1af995..0000000000 --- a/experimental/lerna.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": "0.27.0", - "npmClient": "npm", - "packages": [ - "packages/*", - "backwards-compatability/*" - ] -} diff --git a/experimental/package.json b/experimental/package.json deleted file mode 120000 index 4e26811d41..0000000000 --- a/experimental/package.json +++ /dev/null @@ -1 +0,0 @@ -../package.json \ No newline at end of file diff --git a/experimental/packages/exporter-trace-otlp-grpc/tsconfig.json b/experimental/packages/exporter-trace-otlp-grpc/tsconfig.json index 8597d3eb6b..3b28c06f67 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/tsconfig.json +++ b/experimental/packages/exporter-trace-otlp-grpc/tsconfig.json @@ -9,6 +9,15 @@ "test/**/*.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-resources" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, { "path": "../exporter-trace-otlp-http" } diff --git a/experimental/packages/exporter-trace-otlp-http/tsconfig.json b/experimental/packages/exporter-trace-otlp-http/tsconfig.json index ed9d0830bd..8892d54c12 100644 --- a/experimental/packages/exporter-trace-otlp-http/tsconfig.json +++ b/experimental/packages/exporter-trace-otlp-http/tsconfig.json @@ -7,5 +7,16 @@ "include": [ "src/**/*.ts", "test/**/*.ts" + ], + "references": [ + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-resources" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + } ] } diff --git a/experimental/packages/exporter-trace-otlp-proto/tsconfig.json b/experimental/packages/exporter-trace-otlp-proto/tsconfig.json index 8597d3eb6b..3b28c06f67 100644 --- a/experimental/packages/exporter-trace-otlp-proto/tsconfig.json +++ b/experimental/packages/exporter-trace-otlp-proto/tsconfig.json @@ -9,6 +9,15 @@ "test/**/*.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-resources" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, { "path": "../exporter-trace-otlp-http" } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/tsconfig.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/tsconfig.json index 0c98be5092..fb3bcd8afa 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/tsconfig.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/tsconfig.json @@ -9,6 +9,12 @@ "test/**/*.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-resources" + }, { "path": "../exporter-trace-otlp-grpc" }, diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/tsconfig.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/tsconfig.json index 7672d5f0aa..7bf7d7dfbd 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/tsconfig.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/tsconfig.json @@ -9,6 +9,12 @@ "test/**/*.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-resources" + }, { "path": "../exporter-trace-otlp-http" }, diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.json index 7564c309e6..0a77729134 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.json @@ -9,6 +9,12 @@ "test/**/*.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-resources" + }, { "path": "../exporter-trace-otlp-http" }, diff --git a/experimental/packages/opentelemetry-exporter-prometheus/tsconfig.json b/experimental/packages/opentelemetry-exporter-prometheus/tsconfig.json index 3c062d3feb..362d404d69 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/tsconfig.json +++ b/experimental/packages/opentelemetry-exporter-prometheus/tsconfig.json @@ -9,6 +9,9 @@ "test/**/*.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-core" + }, { "path": "../opentelemetry-api-metrics" }, diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/tsconfig.json b/experimental/packages/opentelemetry-instrumentation-fetch/tsconfig.json index 41fa3be237..b228a2080a 100644 --- a/experimental/packages/opentelemetry-instrumentation-fetch/tsconfig.json +++ b/experimental/packages/opentelemetry-instrumentation-fetch/tsconfig.json @@ -10,6 +10,24 @@ "test/**/*.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-context-zone" + }, + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-propagator-b3" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-web" + }, + { + "path": "../../../packages/opentelemetry-semantic-conventions" + }, { "path": "../opentelemetry-instrumentation" } diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.json b/experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.json index b0e33797f4..8b4ba562f1 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.json +++ b/experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.json @@ -9,6 +9,21 @@ "test/**/*.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-context-async-hooks" + }, + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-node" + }, + { + "path": "../../../packages/opentelemetry-semantic-conventions" + }, { "path": "../opentelemetry-api-metrics" }, diff --git a/experimental/packages/opentelemetry-instrumentation-http/tsconfig.json b/experimental/packages/opentelemetry-instrumentation-http/tsconfig.json index b172f492db..b883031b0f 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/tsconfig.json +++ b/experimental/packages/opentelemetry-instrumentation-http/tsconfig.json @@ -9,6 +9,21 @@ "test/**/*.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-context-async-hooks" + }, + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-node" + }, + { + "path": "../../../packages/opentelemetry-semantic-conventions" + }, { "path": "../opentelemetry-instrumentation" } diff --git a/experimental/packages/opentelemetry-instrumentation-xml-http-request/tsconfig.json b/experimental/packages/opentelemetry-instrumentation-xml-http-request/tsconfig.json index 41fa3be237..b228a2080a 100644 --- a/experimental/packages/opentelemetry-instrumentation-xml-http-request/tsconfig.json +++ b/experimental/packages/opentelemetry-instrumentation-xml-http-request/tsconfig.json @@ -10,6 +10,24 @@ "test/**/*.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-context-zone" + }, + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-propagator-b3" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-web" + }, + { + "path": "../../../packages/opentelemetry-semantic-conventions" + }, { "path": "../opentelemetry-instrumentation" } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/tsconfig.json b/experimental/packages/opentelemetry-sdk-metrics-base/tsconfig.json index 948abef3ce..53d44a09df 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/tsconfig.json +++ b/experimental/packages/opentelemetry-sdk-metrics-base/tsconfig.json @@ -9,6 +9,12 @@ "test/**/*.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-resources" + }, { "path": "../opentelemetry-api-metrics" } diff --git a/experimental/packages/opentelemetry-sdk-node/tsconfig.json b/experimental/packages/opentelemetry-sdk-node/tsconfig.json index 36c71e90d8..88e78f2e41 100644 --- a/experimental/packages/opentelemetry-sdk-node/tsconfig.json +++ b/experimental/packages/opentelemetry-sdk-node/tsconfig.json @@ -9,6 +9,21 @@ "test/**/*.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-context-async-hooks" + }, + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-resources" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-node" + }, { "path": "../opentelemetry-api-metrics" }, diff --git a/experimental/packages/otlp-transformer/tsconfig.json b/experimental/packages/otlp-transformer/tsconfig.json index 3c062d3feb..89cb53e4de 100644 --- a/experimental/packages/otlp-transformer/tsconfig.json +++ b/experimental/packages/otlp-transformer/tsconfig.json @@ -9,6 +9,15 @@ "test/**/*.ts" ], "references": [ + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-resources" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, { "path": "../opentelemetry-api-metrics" }, diff --git a/experimental/tsconfig.json b/experimental/tsconfig.json deleted file mode 100644 index a049b5a42b..0000000000 --- a/experimental/tsconfig.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "files": [], - "references": [ - { - "path": "packages/exporter-trace-otlp-grpc" - }, - { - "path": "packages/exporter-trace-otlp-http" - }, - { - "path": "packages/exporter-trace-otlp-proto" - }, - { - "path": "packages/opentelemetry-api-metrics" - }, - { - "path": "packages/opentelemetry-exporter-metrics-otlp-grpc" - }, - { - "path": "packages/opentelemetry-exporter-metrics-otlp-http" - }, - { - "path": "packages/opentelemetry-exporter-metrics-otlp-proto" - }, - { - "path": "packages/opentelemetry-exporter-prometheus" - }, - { - "path": "packages/opentelemetry-instrumentation-fetch" - }, - { - "path": "packages/opentelemetry-instrumentation-grpc" - }, - { - "path": "packages/opentelemetry-instrumentation-http" - }, - { - "path": "packages/opentelemetry-instrumentation-xml-http-request" - }, - { - "path": "packages/opentelemetry-instrumentation" - }, - { - "path": "packages/opentelemetry-sdk-metrics-base" - }, - { - "path": "packages/opentelemetry-sdk-node" - }, - { - "path": "packages/otlp-transformer" - }, - { - "path": "backwards-compatability/node10" - }, - { - "path": "backwards-compatability/node12" - }, - { - "path": "backwards-compatability/node8" - } - ] -} diff --git a/lerna.json b/lerna.json index d7632268d1..f524729bbd 100644 --- a/lerna.json +++ b/lerna.json @@ -3,6 +3,8 @@ "npmClient": "npm", "packages": [ "packages/*", + "experimental/packages/*", + "experimental/backwards-compatability/*", "integration-tests/*", "selenium-tests" ] diff --git a/tsconfig.json b/tsconfig.json index 86c1ef2732..e8b0b5cba6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -88,6 +88,63 @@ { "path": "packages/template" }, + { + "path": "experimental/packages/exporter-trace-otlp-grpc" + }, + { + "path": "experimental/packages/exporter-trace-otlp-http" + }, + { + "path": "experimental/packages/exporter-trace-otlp-proto" + }, + { + "path": "experimental/packages/opentelemetry-api-metrics" + }, + { + "path": "experimental/packages/opentelemetry-exporter-metrics-otlp-grpc" + }, + { + "path": "experimental/packages/opentelemetry-exporter-metrics-otlp-http" + }, + { + "path": "experimental/packages/opentelemetry-exporter-metrics-otlp-proto" + }, + { + "path": "experimental/packages/opentelemetry-exporter-prometheus" + }, + { + "path": "experimental/packages/opentelemetry-instrumentation-fetch" + }, + { + "path": "experimental/packages/opentelemetry-instrumentation-grpc" + }, + { + "path": "experimental/packages/opentelemetry-instrumentation-http" + }, + { + "path": "experimental/packages/opentelemetry-instrumentation-xml-http-request" + }, + { + "path": "experimental/packages/opentelemetry-instrumentation" + }, + { + "path": "experimental/packages/opentelemetry-sdk-metrics-base" + }, + { + "path": "experimental/packages/opentelemetry-sdk-node" + }, + { + "path": "experimental/packages/otlp-transformer" + }, + { + "path": "experimental/backwards-compatability/node10" + }, + { + "path": "experimental/backwards-compatability/node12" + }, + { + "path": "experimental/backwards-compatability/node8" + }, { "path": "integration-tests/propagation-validation-server" } From 49bf9376eac42dbfe34567c9e7ffbe4f7b6ee50c Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 13 Apr 2022 11:22:21 -0400 Subject: [PATCH 02/18] chore: release API dependencies --- experimental/packages/exporter-trace-otlp-grpc/package.json | 4 ++-- experimental/packages/exporter-trace-otlp-http/package.json | 4 ++-- experimental/packages/exporter-trace-otlp-proto/package.json | 4 ++-- .../opentelemetry-exporter-metrics-otlp-grpc/package.json | 4 ++-- .../opentelemetry-exporter-metrics-otlp-http/package.json | 4 ++-- .../opentelemetry-exporter-metrics-otlp-proto/package.json | 4 ++-- .../packages/opentelemetry-exporter-prometheus/package.json | 4 ++-- .../packages/opentelemetry-instrumentation-fetch/package.json | 4 ++-- .../packages/opentelemetry-instrumentation-grpc/package.json | 4 ++-- .../packages/opentelemetry-instrumentation-http/package.json | 4 ++-- .../package.json | 4 ++-- .../packages/opentelemetry-instrumentation/package.json | 4 ++-- .../examples/metrics/package.json | 4 ++-- .../packages/opentelemetry-sdk-metrics-base/package.json | 4 ++-- experimental/packages/opentelemetry-sdk-node/package.json | 4 ++-- experimental/packages/otlp-transformer/package.json | 4 ++-- integration-tests/propagation-validation-server/package.json | 2 +- lerna.json | 2 +- packages/opentelemetry-context-async-hooks/package.json | 2 +- packages/opentelemetry-context-zone-peer-dep/package.json | 2 +- packages/opentelemetry-core/package.json | 2 +- packages/opentelemetry-exporter-jaeger/package.json | 4 ++-- packages/opentelemetry-exporter-zipkin/package.json | 4 ++-- packages/opentelemetry-propagator-b3/package.json | 2 +- packages/opentelemetry-propagator-jaeger/package.json | 2 +- packages/opentelemetry-resources/package.json | 2 +- packages/opentelemetry-sdk-trace-base/package.json | 4 ++-- packages/opentelemetry-sdk-trace-node/package.json | 4 ++-- packages/opentelemetry-sdk-trace-web/package.json | 4 ++-- packages/opentelemetry-shim-opentracing/package.json | 2 +- selenium-tests/package.json | 4 ++-- 31 files changed, 53 insertions(+), 53 deletions(-) diff --git a/experimental/packages/exporter-trace-otlp-grpc/package.json b/experimental/packages/exporter-trace-otlp-grpc/package.json index b8173525af..a36d23169f 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/package.json +++ b/experimental/packages/exporter-trace-otlp-grpc/package.json @@ -49,7 +49,7 @@ }, "devDependencies": { "@babel/core": "7.16.0", - "@opentelemetry/api": "^1.1.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", @@ -64,7 +64,7 @@ "typescript": "4.4.4" }, "peerDependencies": { - "@opentelemetry/api": "^1.1.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@opentelemetry/core": "1.1.1", diff --git a/experimental/packages/exporter-trace-otlp-http/package.json b/experimental/packages/exporter-trace-otlp-http/package.json index cba5e84058..e73c216de2 100644 --- a/experimental/packages/exporter-trace-otlp-http/package.json +++ b/experimental/packages/exporter-trace-otlp-http/package.json @@ -62,7 +62,7 @@ }, "devDependencies": { "@babel/core": "7.16.0", - "@opentelemetry/api": "^1.1.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", @@ -89,7 +89,7 @@ "webpack-merge": "5.8.0" }, "peerDependencies": { - "@opentelemetry/api": "^1.1.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@opentelemetry/core": "1.1.1", diff --git a/experimental/packages/exporter-trace-otlp-proto/package.json b/experimental/packages/exporter-trace-otlp-proto/package.json index eddf0c405a..0808f5ec1b 100644 --- a/experimental/packages/exporter-trace-otlp-proto/package.json +++ b/experimental/packages/exporter-trace-otlp-proto/package.json @@ -49,7 +49,7 @@ }, "devDependencies": { "@babel/core": "7.16.0", - "@opentelemetry/api": "^1.1.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", @@ -64,7 +64,7 @@ "typescript": "4.4.4" }, "peerDependencies": { - "@opentelemetry/api": "^1.1.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@opentelemetry/core": "1.1.1", diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json index 7d5bdfb287..7f6ef50a76 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json @@ -49,7 +49,7 @@ }, "devDependencies": { "@babel/core": "7.16.0", - "@opentelemetry/api": "^1.1.0", + "@opentelemetry/api": "^1.0.0", "@opentelemetry/api-metrics": "0.27.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", @@ -65,7 +65,7 @@ "typescript": "4.4.4" }, "peerDependencies": { - "@opentelemetry/api": "^1.1.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@grpc/grpc-js": "^1.5.9", diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json index 38bb2c4ff1..46a0f3537c 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json @@ -62,7 +62,7 @@ }, "devDependencies": { "@babel/core": "7.16.0", - "@opentelemetry/api": "^1.1.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", @@ -89,7 +89,7 @@ "webpack-merge": "5.8.0" }, "peerDependencies": { - "@opentelemetry/api": "^1.1.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@opentelemetry/api-metrics": "0.27.0", diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json index ebc9046432..bcbd44ee96 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json @@ -49,7 +49,7 @@ }, "devDependencies": { "@babel/core": "7.16.0", - "@opentelemetry/api": "^1.1.0", + "@opentelemetry/api": "^1.0.0", "@opentelemetry/api-metrics": "0.27.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", @@ -65,7 +65,7 @@ "typescript": "4.4.4" }, "peerDependencies": { - "@opentelemetry/api": "^1.1.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@grpc/proto-loader": "0.6.9", diff --git a/experimental/packages/opentelemetry-exporter-prometheus/package.json b/experimental/packages/opentelemetry-exporter-prometheus/package.json index bd909e78ba..cff0d5d9d9 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/package.json +++ b/experimental/packages/opentelemetry-exporter-prometheus/package.json @@ -43,7 +43,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.3", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", @@ -56,7 +56,7 @@ "typescript": "4.4.4" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.3" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@opentelemetry/api-metrics": "0.27.0", diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/package.json b/experimental/packages/opentelemetry-instrumentation-fetch/package.json index 2b7c88bff8..7036ac724b 100644 --- a/experimental/packages/opentelemetry-instrumentation-fetch/package.json +++ b/experimental/packages/opentelemetry-instrumentation-fetch/package.json @@ -54,7 +54,7 @@ }, "devDependencies": { "@babel/core": "7.16.0", - "@opentelemetry/api": "^1.1.0", + "@opentelemetry/api": "^1.0.0", "@opentelemetry/context-zone": "1.1.1", "@opentelemetry/propagator-b3": "1.1.1", "@opentelemetry/sdk-trace-base": "1.1.1", @@ -83,7 +83,7 @@ "webpack-merge": "5.8.0" }, "peerDependencies": { - "@opentelemetry/api": "^1.1.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@opentelemetry/core": "1.1.1", diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/package.json b/experimental/packages/opentelemetry-instrumentation-grpc/package.json index 4e35650bc8..9ea75bc0b1 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/package.json +++ b/experimental/packages/opentelemetry-instrumentation-grpc/package.json @@ -46,7 +46,7 @@ "devDependencies": { "@grpc/grpc-js": "1.5.9", "@grpc/proto-loader": "0.6.9", - "@opentelemetry/api": "^1.1.0", + "@opentelemetry/api": "^1.0.0", "@opentelemetry/context-async-hooks": "1.1.1", "@opentelemetry/core": "1.1.1", "@opentelemetry/sdk-trace-base": "1.1.1", @@ -67,7 +67,7 @@ "typescript": "4.4.4" }, "peerDependencies": { - "@opentelemetry/api": "^1.1.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@opentelemetry/api-metrics": "0.27.0", diff --git a/experimental/packages/opentelemetry-instrumentation-http/package.json b/experimental/packages/opentelemetry-instrumentation-http/package.json index 6337d43068..b5cab2bbf5 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/package.json +++ b/experimental/packages/opentelemetry-instrumentation-http/package.json @@ -44,7 +44,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.1.0", + "@opentelemetry/api": "^1.0.0", "@opentelemetry/context-async-hooks": "1.1.1", "@opentelemetry/sdk-trace-base": "1.1.1", "@opentelemetry/sdk-trace-node": "1.1.1", @@ -70,7 +70,7 @@ "typescript": "4.4.4" }, "peerDependencies": { - "@opentelemetry/api": "^1.1.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@opentelemetry/core": "1.1.1", diff --git a/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json b/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json index 1505e20f4b..0809dbc5cf 100644 --- a/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json +++ b/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json @@ -54,7 +54,7 @@ }, "devDependencies": { "@babel/core": "7.16.0", - "@opentelemetry/api": "^1.1.0", + "@opentelemetry/api": "^1.0.0", "@opentelemetry/context-zone": "1.1.1", "@opentelemetry/propagator-b3": "1.1.1", "@opentelemetry/sdk-trace-base": "1.1.1", @@ -83,7 +83,7 @@ "webpack-merge": "5.8.0" }, "peerDependencies": { - "@opentelemetry/api": "^1.1.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@opentelemetry/core": "1.1.1", diff --git a/experimental/packages/opentelemetry-instrumentation/package.json b/experimental/packages/opentelemetry-instrumentation/package.json index 7d63770fbf..e7e223aa7e 100644 --- a/experimental/packages/opentelemetry-instrumentation/package.json +++ b/experimental/packages/opentelemetry-instrumentation/package.json @@ -73,11 +73,11 @@ "shimmer": "^1.2.1" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.3" + "@opentelemetry/api": "^1.0.0" }, "devDependencies": { "@babel/core": "7.16.0", - "@opentelemetry/api": "^1.0.3", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/semver": "7.3.9", diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/examples/metrics/package.json b/experimental/packages/opentelemetry-sdk-metrics-base/examples/metrics/package.json index dfa9a6abf3..eb518107c5 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/examples/metrics/package.json +++ b/experimental/packages/opentelemetry-sdk-metrics-base/examples/metrics/package.json @@ -26,8 +26,8 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/api": "^1.0.2", - "@opentelemetry/core": "^1.0.1", + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/core": "^1.1.1", "@opentelemetry/exporter-prometheus": "^0.27.0", "@opentelemetry/sdk-metrics-base": "^0.27.0" }, diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/package.json b/experimental/packages/opentelemetry-sdk-metrics-base/package.json index 8ccf00b691..58d98fcb4e 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/package.json +++ b/experimental/packages/opentelemetry-sdk-metrics-base/package.json @@ -54,7 +54,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.3", + "@opentelemetry/api": "^1.0.0", "@types/lodash.merge": "4.6.6", "@types/mocha": "8.2.3", "@types/node": "14.17.33", @@ -74,7 +74,7 @@ "typescript": "4.4.4" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.3" + "@opentelemetry/api": "^1.0.0" }, "todo": "Move API metrics to peer dependencies. While it is using an unpublished name, lerna doesn't properly link it if it is in peer dependencies", "dependencies": { diff --git a/experimental/packages/opentelemetry-sdk-node/package.json b/experimental/packages/opentelemetry-sdk-node/package.json index c2ede4f8d7..d900f0482c 100644 --- a/experimental/packages/opentelemetry-sdk-node/package.json +++ b/experimental/packages/opentelemetry-sdk-node/package.json @@ -54,10 +54,10 @@ "@opentelemetry/sdk-trace-node": "~1.1.1" }, "peerDependencies": { - "@opentelemetry/api": ">=1.1.0 <1.2.0" + "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "devDependencies": { - "@opentelemetry/api": "~1.1.0", + "@opentelemetry/api": "^1.0.0", "@opentelemetry/context-async-hooks": "1.1.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", diff --git a/experimental/packages/otlp-transformer/package.json b/experimental/packages/otlp-transformer/package.json index 740b1cc345..d608a2b625 100644 --- a/experimental/packages/otlp-transformer/package.json +++ b/experimental/packages/otlp-transformer/package.json @@ -42,11 +42,11 @@ "README.md" ], "peerDependencies": { - "@opentelemetry/api": ">=1.1.0 <1.2.0", + "@opentelemetry/api": ">=1.0.0 <1.2.0", "@opentelemetry/api-metrics": "~0.27.0" }, "devDependencies": { - "@opentelemetry/api": "^1.1.0", + "@opentelemetry/api": "^1.0.0", "@opentelemetry/api-metrics": "~0.27.0", "@types/mocha": "8.2.3", "@types/webpack-env": "1.16.3", diff --git a/integration-tests/propagation-validation-server/package.json b/integration-tests/propagation-validation-server/package.json index dc51cbf5fd..b7b1ffd6e6 100644 --- a/integration-tests/propagation-validation-server/package.json +++ b/integration-tests/propagation-validation-server/package.json @@ -11,7 +11,7 @@ "compile": "tsc --build" }, "dependencies": { - "@opentelemetry/api": "~1.1.0", + "@opentelemetry/api": "^1.0.0", "@opentelemetry/context-async-hooks": "1.1.1", "@opentelemetry/core": "1.1.1", "@opentelemetry/sdk-trace-base": "1.1.1", diff --git a/lerna.json b/lerna.json index f524729bbd..7c9b4dc384 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.1.1", + "version": "independent", "npmClient": "npm", "packages": [ "packages/*", diff --git a/packages/opentelemetry-context-async-hooks/package.json b/packages/opentelemetry-context-async-hooks/package.json index 2f9cc1582c..07eee63295 100644 --- a/packages/opentelemetry-context-async-hooks/package.json +++ b/packages/opentelemetry-context-async-hooks/package.json @@ -43,7 +43,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "~1.1.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "codecov": "3.8.3", diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json index 81f62fa18e..f4e2da9092 100644 --- a/packages/opentelemetry-context-zone-peer-dep/package.json +++ b/packages/opentelemetry-context-zone-peer-dep/package.json @@ -53,7 +53,7 @@ }, "devDependencies": { "@babel/core": "7.16.0", - "@opentelemetry/api": "~1.1.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json index a20080abdd..2015807cb6 100644 --- a/packages/opentelemetry-core/package.json +++ b/packages/opentelemetry-core/package.json @@ -63,7 +63,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "~1.1.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json index 741d0f76c5..1ef6791862 100644 --- a/packages/opentelemetry-exporter-jaeger/package.json +++ b/packages/opentelemetry-exporter-jaeger/package.json @@ -43,7 +43,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.1.0", + "@opentelemetry/api": "^1.0.0", "@opentelemetry/resources": "1.1.1", "@types/mocha": "8.2.3", "@types/node": "14.17.33", @@ -58,7 +58,7 @@ "typescript": "4.4.4" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.3" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@opentelemetry/core": "1.1.1", diff --git a/packages/opentelemetry-exporter-zipkin/package.json b/packages/opentelemetry-exporter-zipkin/package.json index e82ffc46bd..4bc7cb565b 100644 --- a/packages/opentelemetry-exporter-zipkin/package.json +++ b/packages/opentelemetry-exporter-zipkin/package.json @@ -60,7 +60,7 @@ }, "devDependencies": { "@babel/core": "7.16.0", - "@opentelemetry/api": "^1.1.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", @@ -87,7 +87,7 @@ "webpack-merge": "5.8.0" }, "peerDependencies": { - "@opentelemetry/api": "^1.0.3" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@opentelemetry/core": "1.1.1", diff --git a/packages/opentelemetry-propagator-b3/package.json b/packages/opentelemetry-propagator-b3/package.json index e1c9c21391..d790ea559c 100644 --- a/packages/opentelemetry-propagator-b3/package.json +++ b/packages/opentelemetry-propagator-b3/package.json @@ -56,7 +56,7 @@ "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "devDependencies": { - "@opentelemetry/api": "~1.1.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "codecov": "3.8.3", diff --git a/packages/opentelemetry-propagator-jaeger/package.json b/packages/opentelemetry-propagator-jaeger/package.json index 3a424dc5e5..7ad27c5c7b 100644 --- a/packages/opentelemetry-propagator-jaeger/package.json +++ b/packages/opentelemetry-propagator-jaeger/package.json @@ -53,7 +53,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "~1.1.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", diff --git a/packages/opentelemetry-resources/package.json b/packages/opentelemetry-resources/package.json index 52251190a5..5f4d044087 100644 --- a/packages/opentelemetry-resources/package.json +++ b/packages/opentelemetry-resources/package.json @@ -58,7 +58,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "~1.1.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", diff --git a/packages/opentelemetry-sdk-trace-base/package.json b/packages/opentelemetry-sdk-trace-base/package.json index 5857c55a63..68a1906c2c 100644 --- a/packages/opentelemetry-sdk-trace-base/package.json +++ b/packages/opentelemetry-sdk-trace-base/package.json @@ -61,7 +61,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "~1.1.0", + "@opentelemetry/api": "^1.0.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", @@ -84,7 +84,7 @@ "webpack": "4.46.0" }, "peerDependencies": { - "@opentelemetry/api": ">=1.1.0 <1.2.0" + "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "dependencies": { "@opentelemetry/core": "1.1.1", diff --git a/packages/opentelemetry-sdk-trace-node/package.json b/packages/opentelemetry-sdk-trace-node/package.json index d63bbc36b3..96b0d7843d 100644 --- a/packages/opentelemetry-sdk-trace-node/package.json +++ b/packages/opentelemetry-sdk-trace-node/package.json @@ -44,7 +44,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "~1.1.0", + "@opentelemetry/api": "^1.0.0", "@opentelemetry/resources": "1.1.1", "@opentelemetry/semantic-conventions": "1.1.1", "@types/mocha": "8.2.3", @@ -60,7 +60,7 @@ "typescript": "4.4.4" }, "peerDependencies": { - "@opentelemetry/api": ">=1.1.0 <1.2.0" + "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "dependencies": { "@opentelemetry/context-async-hooks": "1.1.1", diff --git a/packages/opentelemetry-sdk-trace-web/package.json b/packages/opentelemetry-sdk-trace-web/package.json index a2f2f3d15a..2880a352bd 100644 --- a/packages/opentelemetry-sdk-trace-web/package.json +++ b/packages/opentelemetry-sdk-trace-web/package.json @@ -55,7 +55,7 @@ }, "devDependencies": { "@babel/core": "7.16.0", - "@opentelemetry/api": "~1.1.0", + "@opentelemetry/api": "^1.0.0", "@opentelemetry/context-zone": "1.1.1", "@opentelemetry/propagator-b3": "1.1.1", "@opentelemetry/resources": "1.1.1", @@ -87,7 +87,7 @@ "webpack-merge": "5.8.0" }, "peerDependencies": { - "@opentelemetry/api": ">=1.1.0 <1.2.0" + "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "dependencies": { "@opentelemetry/core": "1.1.1", diff --git a/packages/opentelemetry-shim-opentracing/package.json b/packages/opentelemetry-shim-opentracing/package.json index feca430777..d6ce64f348 100644 --- a/packages/opentelemetry-shim-opentracing/package.json +++ b/packages/opentelemetry-shim-opentracing/package.json @@ -41,7 +41,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "~1.1.0", + "@opentelemetry/api": "^1.0.0", "@opentelemetry/propagator-b3": "1.1.1", "@opentelemetry/propagator-jaeger": "1.1.1", "@opentelemetry/sdk-trace-base": "1.1.1", diff --git a/selenium-tests/package.json b/selenium-tests/package.json index 4aa5e5ce7f..22c60eb791 100644 --- a/selenium-tests/package.json +++ b/selenium-tests/package.json @@ -36,7 +36,7 @@ "@babel/plugin-proposal-decorators": "7.16.4", "@babel/plugin-transform-runtime": "7.16.4", "@babel/preset-env": "7.16.4", - "@opentelemetry/api": "^1.1.0", + "@opentelemetry/api": "^1.0.0", "babel-loader": "8.2.3", "babel-polyfill": "6.26.0", "browserstack-local": "1.4.8", @@ -53,7 +53,7 @@ "webpack-merge": "5.8.0" }, "peerDependencies": { - "@opentelemetry/api": "^1.1.0" + "@opentelemetry/api": "^1.0.0" }, "dependencies": { "@opentelemetry/context-zone-peer-dep": "1.1.1", From b3640b285ef53099417bfa3a50b496fb3014f851 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 13 Apr 2022 11:46:09 -0400 Subject: [PATCH 03/18] chore: fix selenium exporter --- selenium-tests/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selenium-tests/package.json b/selenium-tests/package.json index 22c60eb791..6fbd084aee 100644 --- a/selenium-tests/package.json +++ b/selenium-tests/package.json @@ -58,7 +58,7 @@ "dependencies": { "@opentelemetry/context-zone-peer-dep": "1.1.1", "@opentelemetry/core": "1.1.1", - "@opentelemetry/exporter-otlp-http": "0.26.0", + "@opentelemetry/exporter-trace-otlp-http": "0.27.0", "@opentelemetry/exporter-zipkin": "1.1.1", "@opentelemetry/instrumentation": "0.27.0", "@opentelemetry/instrumentation-fetch": "0.27.0", From 56d6bd23f8ebf1a7a6c16756096fc5e818788eea Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 13 Apr 2022 14:40:02 -0400 Subject: [PATCH 04/18] chore: support old API versions --- .../opentelemetry-api-metrics/src/NoopMeter.ts | 8 ++++---- .../src/types/Metric.ts | 8 ++++---- .../src/types/ObservableResult.ts | 4 ++-- .../src/transformMetrics.ts | 6 +++--- .../src/PrometheusSerializer.ts | 6 +++--- .../test/PrometheusSerializer.test.ts | 8 ++++---- .../src/Instruments.ts | 8 ++++---- .../src/Measurement.ts | 4 ++-- .../src/ObservableResult.ts | 2 +- .../src/aggregator/types.ts | 4 ++-- .../AlignedHistogramBucketExemplarReservoir.ts | 6 +++--- .../src/exemplar/AlwaysSampleExemplarFilter.ts | 4 ++-- .../src/exemplar/Exemplar.ts | 4 ++-- .../src/exemplar/ExemplarFilter.ts | 6 +++--- .../src/exemplar/ExemplarReservoir.ts | 16 ++++++++-------- .../src/exemplar/NeverSampleExemplarFilter.ts | 4 ++-- .../SimpleFixedSizeExemplarReservoir.ts | 6 +++--- .../src/exemplar/WithTraceExemplarFilter.ts | 4 ++-- .../src/export/MetricData.ts | 4 ++-- .../src/state/DeltaMetricProcessor.ts | 6 +++--- .../src/state/HashMap.ts | 4 ++-- .../src/state/MultiWritableMetricStorage.ts | 4 ++-- .../src/state/SyncMetricStorage.ts | 4 ++-- .../src/state/WritableMetricStorage.ts | 6 +++--- .../src/utils.ts | 6 +++--- .../src/view/AttributesProcessor.ts | 10 +++++----- .../test/MeterProvider.test.ts | 2 +- .../test/state/HashMap.test.ts | 8 ++++---- .../state/MultiWritableMetricStorage.test.ts | 4 ++-- .../test/util.ts | 6 +++--- .../src/common/attributes.ts | 10 ++++------ .../src/trace/sampler/ParentBasedSampler.ts | 4 ++-- .../src/transform.ts | 4 ++-- .../opentelemetry-resources/src/Resource.ts | 2 +- .../src/BasicTracerProvider.ts | 3 +-- .../opentelemetry-sdk-trace-base/src/Span.ts | 14 +++++++------- .../src/TimedEvent.ts | 4 ++-- .../src/export/ReadableSpan.ts | 4 ++-- .../test/common/Span.test.ts | 10 +++++----- .../test/common/Tracer.test.ts | 8 ++++---- .../src/resource/SemanticResourceAttributes.ts | 4 ++-- .../opentelemetry-shim-opentracing/src/shim.ts | 18 +++++++++--------- 42 files changed, 127 insertions(+), 130 deletions(-) diff --git a/experimental/packages/opentelemetry-api-metrics/src/NoopMeter.ts b/experimental/packages/opentelemetry-api-metrics/src/NoopMeter.ts index a2ad1370a4..06741a606b 100644 --- a/experimental/packages/opentelemetry-api-metrics/src/NoopMeter.ts +++ b/experimental/packages/opentelemetry-api-metrics/src/NoopMeter.ts @@ -17,7 +17,7 @@ import { Meter } from './types/Meter'; import { MetricOptions, - Attributes, + SpanAttributes, Counter, Histogram, UpDownCounter, @@ -98,15 +98,15 @@ export class NoopMeter implements Meter { export class NoopMetric {} export class NoopCounterMetric extends NoopMetric implements Counter { - add(_value: number, _attributes: Attributes): void {} + add(_value: number, _attributes: SpanAttributes): void {} } export class NoopUpDownCounterMetric extends NoopMetric implements UpDownCounter { - add(_value: number, _attributes: Attributes): void {} + add(_value: number, _attributes: SpanAttributes): void {} } export class NoopHistogramMetric extends NoopMetric implements Histogram { - record(_value: number, _attributes: Attributes): void {} + record(_value: number, _attributes: SpanAttributes): void {} } export const NOOP_METER = new NoopMeter(); diff --git a/experimental/packages/opentelemetry-api-metrics/src/types/Metric.ts b/experimental/packages/opentelemetry-api-metrics/src/types/Metric.ts index b541acc2fa..2db00aa481 100644 --- a/experimental/packages/opentelemetry-api-metrics/src/types/Metric.ts +++ b/experimental/packages/opentelemetry-api-metrics/src/types/Metric.ts @@ -72,27 +72,27 @@ export interface Counter { /** * Increment value of counter by the input. Inputs may not be negative. */ - add(value: number, attributes?: Attributes, context?: Context): void; + add(value: number, attributes?: SpanAttributes, context?: Context): void; } export interface UpDownCounter { /** * Increment value of counter by the input. Inputs may be negative. */ - add(value: number, attributes?: Attributes, context?: Context): void; + add(value: number, attributes?: SpanAttributes, context?: Context): void; } export interface Histogram { /** * Records a measurement. Value of the measurement must not be negative. */ - record(value: number, attributes?: Attributes, context?: Context): void; + record(value: number, attributes?: SpanAttributes, context?: Context): void; } /** * key-value pairs passed by the user. */ -export type Attributes = { [key: string]: string }; +export type SpanAttributes = { [key: string]: string }; /** * The observable callback for Observable instruments. diff --git a/experimental/packages/opentelemetry-api-metrics/src/types/ObservableResult.ts b/experimental/packages/opentelemetry-api-metrics/src/types/ObservableResult.ts index 3803a633ff..3c8fce37f9 100644 --- a/experimental/packages/opentelemetry-api-metrics/src/types/ObservableResult.ts +++ b/experimental/packages/opentelemetry-api-metrics/src/types/ObservableResult.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { Attributes } from './Metric'; +import { SpanAttributes } from './Metric'; /** * Interface that is being used in callback function for Observable Metric @@ -28,5 +28,5 @@ export interface ObservableResult { * one values associated with the same attributes values, SDK may pick the * last one or simply drop the entire observable result. */ - observe(value: number, attributes?: Attributes): void; + observe(value: number, attributes?: SpanAttributes): void; } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/transformMetrics.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/transformMetrics.ts index 128b28a1cf..955e8e6a8a 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/transformMetrics.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/transformMetrics.ts @@ -25,14 +25,14 @@ import { MetricData, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; -import { Attributes, ValueType } from '@opentelemetry/api-metrics'; +import { ValueType } from '@opentelemetry/api-metrics'; /** - * Converts {@link Attributes} to a collector-compatible format. + * Converts {@link SpanAttributes} to a collector-compatible format. * @param attributes */ export function toCollectorAttributes( - attributes: Attributes + attributes: SpanAttributes ): otlpTypes.opentelemetryProto.common.v1.StringKeyValue[] { return Object.entries(attributes).map(([key, value]) => { return { key, value: String(value) }; diff --git a/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts b/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts index 360208c8a6..c079662880 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts +++ b/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts @@ -24,7 +24,7 @@ import { DataPoint, Histogram, } from '@opentelemetry/sdk-metrics-base'; -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { hrTimeToMilliseconds } from '@opentelemetry/core'; type PrometheusDataTypeLiteral = @@ -131,10 +131,10 @@ function toPrometheusType( function stringify( metricName: string, - attributes: Attributes, + attributes: SpanAttributes, value: number, timestamp?: number, - additionalAttributes?: Attributes + additionalAttributes?: SpanAttributes ) { let hasAttribute = false; let attributesStr = ''; diff --git a/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts b/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts index 55a5ee9b6a..d8526f93f6 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts +++ b/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts @@ -15,7 +15,7 @@ */ import * as assert from 'assert'; -import { Attributes, UpDownCounter } from '@opentelemetry/api-metrics'; +import { SpanAttributes, UpDownCounter } from '@opentelemetry/api-metrics'; import { AggregationTemporality, MeterProvider, @@ -341,7 +341,7 @@ describe('PrometheusSerializer', () => { NaN: NaN, null: null, undefined: undefined, - } as unknown) as Attributes); + } as unknown) as SpanAttributes); }); assert.strictEqual( @@ -381,7 +381,7 @@ describe('PrometheusSerializer', () => { backslashN: '\u005c\u006e', // \n => \\n (\u005c\u005c\u006e) backslashDoubleQuote: '\u005c\u0022', // \" => \\\" (\u005c\u005c\u005c\u0022) backslashLineFeed: '\u005c\u000a', // \↵ => \\\n (\u005c\u005c\u005c\u006e) - } as unknown) as Attributes); + } as unknown) as SpanAttributes); }); assert.strictEqual( @@ -406,7 +406,7 @@ describe('PrometheusSerializer', () => { // error while linting: text format parsing error in line 282: expected '=' after label name, found '-' counter.add(1, ({ 'account-id': '123456', - } as unknown) as Attributes); + } as unknown) as SpanAttributes); }); assert.strictEqual( diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/Instruments.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/Instruments.ts index 7b3d51b7ec..33fbc00bda 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/Instruments.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/Instruments.ts @@ -26,7 +26,7 @@ export class SyncInstrument { return this._descriptor.name; } - protected _record(value: number, attributes: metrics.Attributes = {}, context: api.Context = api.context.active()) { + protected _record(value: number, attributes: metrics.SpanAttributes = {}, context: api.Context = api.context.active()) { if (this._descriptor.valueType === metrics.ValueType.INT && !Number.isInteger(value)) { api.diag.warn( `INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.` @@ -44,7 +44,7 @@ export class UpDownCounterInstrument extends SyncInstrument implements metrics.U /** * Increment value of counter by the input. Inputs may be negative. */ - add(value: number, attributes?: metrics.Attributes, ctx?: api.Context): void { + add(value: number, attributes?: metrics.SpanAttributes, ctx?: api.Context): void { this._record(value, attributes, ctx); } } @@ -56,7 +56,7 @@ export class CounterInstrument extends SyncInstrument implements metrics.Counter /** * Increment value of counter by the input. Inputs may not be negative. */ - add(value: number, attributes?: metrics.Attributes, ctx?: api.Context): void { + add(value: number, attributes?: metrics.SpanAttributes, ctx?: api.Context): void { if (value < 0) { api.diag.warn(`negative value provided to counter ${this.getName()}: ${value}`); return; @@ -73,7 +73,7 @@ export class HistogramInstrument extends SyncInstrument implements metrics.Histo /** * Records a measurement. Value of the measurement must not be negative. */ - record(value: number, attributes?: metrics.Attributes, ctx?: api.Context): void { + record(value: number, attributes?: metrics.SpanAttributes, ctx?: api.Context): void { this._record(value, attributes, ctx); } } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/Measurement.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/Measurement.ts index 2beb5959a5..4f444d500d 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/Measurement.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/Measurement.ts @@ -15,13 +15,13 @@ */ import * as api from '@opentelemetry/api'; -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#measurement export type Measurement = { value: number; // TODO use common attributes - attributes: Attributes + attributes: SpanAttributes context?: api.Context; }; diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/ObservableResult.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/ObservableResult.ts index 3251027d89..646cf73475 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/ObservableResult.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/ObservableResult.ts @@ -29,7 +29,7 @@ export class ObservableResult implements metrics.ObservableResult { /** * Observe a measurement of the value associated with the given attributes. */ - observe(value: number, attributes: metrics.Attributes = {}): void { + observe(value: number, attributes: metrics.SpanAttributes = {}): void { this.buffer.set(attributes, value); } } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/types.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/types.ts index c0ccf099f5..48f2b28cd8 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/types.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/types.ts @@ -15,7 +15,7 @@ */ import { HrTime } from '@opentelemetry/api'; -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { MetricData } from '../export/MetricData'; import { InstrumentDescriptor } from '../InstrumentDescriptor'; import { Maybe } from '../utils'; @@ -67,7 +67,7 @@ export interface Accumulation { record(value: number): void; } -export type AccumulationRecord = [Attributes, T]; +export type AccumulationRecord = [SpanAttributes, T]; /** * Base interface for aggregators. Aggregators are responsible for holding diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlignedHistogramBucketExemplarReservoir.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlignedHistogramBucketExemplarReservoir.ts index bfd0a524e4..fa64ce8360 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlignedHistogramBucketExemplarReservoir.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlignedHistogramBucketExemplarReservoir.ts @@ -16,7 +16,7 @@ import { Context, HrTime } from '@opentelemetry/api'; -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { FixedSizeExemplarReservoirBase } from './ExemplarReservoir'; @@ -32,7 +32,7 @@ export class AlignedHistogramBucketExemplarReservoir extends FixedSizeExemplarRe this._boundaries = boundaries; } - private _findBucketIndex(value: number, _timestamp: HrTime, _attributes: Attributes, _ctx: Context) { + private _findBucketIndex(value: number, _timestamp: HrTime, _attributes: SpanAttributes, _ctx: Context) { for(let i = 0; i < this._boundaries.length; i++) { if (value <= this._boundaries[i]) { return i; @@ -41,7 +41,7 @@ export class AlignedHistogramBucketExemplarReservoir extends FixedSizeExemplarRe return this._boundaries.length; } - offer(value: number, timestamp: HrTime, attributes: Attributes, ctx: Context): void { + offer(value: number, timestamp: HrTime, attributes: SpanAttributes, ctx: Context): void { const index = this._findBucketIndex(value, timestamp, attributes, ctx); this._reservoirStorage[index].offer(value, timestamp, attributes, ctx); } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlwaysSampleExemplarFilter.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlwaysSampleExemplarFilter.ts index 154025df60..dc5ee7f670 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlwaysSampleExemplarFilter.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlwaysSampleExemplarFilter.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { Context, HrTime } from '@opentelemetry/api'; import { ExemplarFilter } from './ExemplarFilter'; @@ -24,7 +24,7 @@ export class AlwaysSampleExemplarFilter implements ExemplarFilter { shouldSample( _value: number, _timestamp: HrTime, - _attributes: Attributes, + _attributes: SpanAttributes, _ctx: Context ): boolean { return true; diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/Exemplar.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/Exemplar.ts index 4c7b809baa..3a7d3da4f2 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/Exemplar.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/Exemplar.ts @@ -15,7 +15,7 @@ */ import { HrTime } from '@opentelemetry/api'; -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; /** * A representation of an exemplar, which is a sample input measurement. @@ -27,7 +27,7 @@ export type Exemplar = { // The set of key/value pairs that were filtered out by the aggregator, but // recorded alongside the original measurement. Only key/value pairs that were // filtered out by the aggregator should be included - filteredAttributes: Attributes; + filteredAttributes: SpanAttributes; // The value of the measurement that was recorded. value: number; diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarFilter.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarFilter.ts index 9f0e236350..b7e46fbcd8 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarFilter.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarFilter.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { Context, HrTime } from '@opentelemetry/api'; /** @@ -28,13 +28,13 @@ export interface ExemplarFilter { * * @param value The value of the measurement * @param timestamp A timestamp that best represents when the measurement was taken - * @param attributes The complete set of Attributes of the measurement + * @param attributes The complete set of SpanAttributes of the measurement * @param context The Context of the measurement */ shouldSample( value: number, timestamp: HrTime, - attributes: Attributes, + attributes: SpanAttributes, ctx: Context ): boolean; } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarReservoir.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarReservoir.ts index 8e8fd61bcd..9cf47df052 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarReservoir.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarReservoir.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { Context, HrTime, isSpanContextValid, trace } from '@opentelemetry/api'; import { Exemplar } from './Exemplar'; @@ -28,7 +28,7 @@ export interface ExemplarReservoir { offer( value: number, timestamp: HrTime, - attributes: Attributes, + attributes: SpanAttributes, ctx: Context ): void; /** @@ -40,19 +40,19 @@ export interface ExemplarReservoir { * @returns a list of {@link Exemplar}s. Retuned exemplars contain the attributes that were filtered out by the * aggregator, but recorded alongside the original measurement. */ - collect(pointAttributes: Attributes): Exemplar[]; + collect(pointAttributes: SpanAttributes): Exemplar[]; } class ExemplarBucket { private value: number = 0; - private attributes: Attributes = {}; + private attributes: SpanAttributes = {}; private timestamp: HrTime = [0, 0]; private spanId?: string; private traceId?: string; private _offered: boolean = false; - offer(value: number, timestamp: HrTime, attributes: Attributes, ctx: Context) { + offer(value: number, timestamp: HrTime, attributes: SpanAttributes, ctx: Context) { this.value = value; this.timestamp = timestamp; this.attributes = attributes; @@ -64,7 +64,7 @@ class ExemplarBucket { this._offered = true; } - collect(pointAttributes: Attributes): Exemplar | null { + collect(pointAttributes: SpanAttributes): Exemplar | null { if (!this._offered) return null; const currentAttributes = this.attributes; // filter attributes @@ -103,7 +103,7 @@ export abstract class FixedSizeExemplarReservoirBase implements ExemplarReservoi } } - abstract offer(value: number, timestamp: HrTime, attributes: Attributes, ctx: Context): void; + abstract offer(value: number, timestamp: HrTime, attributes: SpanAttributes, ctx: Context): void; maxSize(): number { return this._size; @@ -114,7 +114,7 @@ export abstract class FixedSizeExemplarReservoirBase implements ExemplarReservoi */ protected reset(): void {} - collect(pointAttributes: Attributes): Exemplar[] { + collect(pointAttributes: SpanAttributes): Exemplar[] { const exemplars: Exemplar[] = []; this._reservoirStorage.forEach(storageItem => { const res = storageItem.collect(pointAttributes); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/NeverSampleExemplarFilter.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/NeverSampleExemplarFilter.ts index 815d8a97dd..72b60dab5d 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/NeverSampleExemplarFilter.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/NeverSampleExemplarFilter.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { Context, HrTime } from '@opentelemetry/api'; import { ExemplarFilter } from './ExemplarFilter'; @@ -23,7 +23,7 @@ export class NeverSampleExemplarFilter implements ExemplarFilter { shouldSample( _value: number, _timestamp: HrTime, - _attributes: Attributes, + _attributes: SpanAttributes, _ctx: Context ): boolean { return false; diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/SimpleFixedSizeExemplarReservoir.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/SimpleFixedSizeExemplarReservoir.ts index 1dac0b8a53..d1ad8637ea 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/SimpleFixedSizeExemplarReservoir.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/SimpleFixedSizeExemplarReservoir.ts @@ -15,7 +15,7 @@ */ import { Context, HrTime } from '@opentelemetry/api'; -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { FixedSizeExemplarReservoirBase } from './ExemplarReservoir'; /** @@ -34,13 +34,13 @@ export class SimpleFixedSizeExemplarReservoir extends FixedSizeExemplarReservoir return Math.floor(Math.random() * (max - min) + min); } - private _findBucketIndex(_value: number, _timestamp: HrTime, _attributes: Attributes, _ctx: Context) { + private _findBucketIndex(_value: number, _timestamp: HrTime, _attributes: SpanAttributes, _ctx: Context) { if (this._numMeasurementsSeen < this._size ) return this._numMeasurementsSeen++; const index = this.getRandomInt(0, ++this._numMeasurementsSeen); return index < this._size ? index: -1; } - offer(value: number, timestamp: HrTime, attributes: Attributes, ctx: Context): void { + offer(value: number, timestamp: HrTime, attributes: SpanAttributes, ctx: Context): void { const index = this._findBucketIndex(value, timestamp, attributes, ctx); if (index !== -1) { this._reservoirStorage[index].offer(value, timestamp, attributes, ctx); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/WithTraceExemplarFilter.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/WithTraceExemplarFilter.ts index 3e48171184..a18f6fb8a7 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/WithTraceExemplarFilter.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/WithTraceExemplarFilter.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { Context, HrTime, isSpanContextValid, trace, TraceFlags } from '@opentelemetry/api'; import { ExemplarFilter } from './ExemplarFilter'; @@ -23,7 +23,7 @@ export class WithTraceExemplarFilter implements ExemplarFilter { shouldSample( value: number, timestamp: HrTime, - attributes: Attributes, + attributes: SpanAttributes, ctx: Context ): boolean { const spanContext = trace.getSpanContext(ctx); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/export/MetricData.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/export/MetricData.ts index 4ddee7c9f1..d991541135 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/export/MetricData.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/export/MetricData.ts @@ -15,7 +15,7 @@ */ import { HrTime } from '@opentelemetry/api'; -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { InstrumentationLibrary } from '@opentelemetry/core'; import { Resource } from '@opentelemetry/resources'; import { InstrumentDescriptor } from '../InstrumentDescriptor'; @@ -92,7 +92,7 @@ export interface DataPoint { /** * The attributes associated with this DataPoint. */ - readonly attributes: Attributes; + readonly attributes: SpanAttributes; /** * The value for this DataPoint. */ diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/DeltaMetricProcessor.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/DeltaMetricProcessor.ts index 3e25ce0ade..643af9ca0d 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/DeltaMetricProcessor.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/DeltaMetricProcessor.ts @@ -15,7 +15,7 @@ */ import { Context } from '@opentelemetry/api'; -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { Maybe } from '../utils'; import { Accumulation, Aggregator } from '../aggregator/types'; import { AttributeHashMap } from './HashMap'; @@ -36,11 +36,11 @@ export class DeltaMetricProcessor> { constructor(private _aggregator: Aggregator) {} /** Bind an efficient storage handle for a set of attributes. */ - private bind(attributes: Attributes) { + private bind(attributes: SpanAttributes) { return this._activeCollectionStorage.getOrDefault(attributes, () => this._aggregator.createAccumulation()); } - record(value: number, attributes: Attributes, _context: Context) { + record(value: number, attributes: SpanAttributes, _context: Context) { const accumulation = this.bind(attributes); accumulation?.record(value); } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/HashMap.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/HashMap.ts index be30996325..c652f8aa23 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/HashMap.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/HashMap.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { hashAttributes } from '../utils'; export interface Hash { @@ -74,7 +74,7 @@ export class HashMap { } } -export class AttributeHashMap extends HashMap { +export class AttributeHashMap extends HashMap { constructor() { super(hashAttributes); } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/MultiWritableMetricStorage.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/MultiWritableMetricStorage.ts index ad51708d55..4d7798fcc8 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/MultiWritableMetricStorage.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/MultiWritableMetricStorage.ts @@ -15,7 +15,7 @@ */ import { Context } from '@opentelemetry/api'; -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { WritableMetricStorage } from './WritableMetricStorage'; /** @@ -24,7 +24,7 @@ import { WritableMetricStorage } from './WritableMetricStorage'; export class MultiMetricStorage implements WritableMetricStorage { constructor(private readonly _backingStorages: WritableMetricStorage[]) {} - record(value: number, attributes: Attributes, context: Context) { + record(value: number, attributes: SpanAttributes, context: Context) { this._backingStorages.forEach(it => { it.record(value, attributes, context); }); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/SyncMetricStorage.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/SyncMetricStorage.ts index a22530f7b1..27ee3456b9 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/SyncMetricStorage.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/SyncMetricStorage.ts @@ -15,7 +15,7 @@ */ import { Context, HrTime } from '@opentelemetry/api'; -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { WritableMetricStorage } from './WritableMetricStorage'; import { Accumulation, Aggregator } from '../aggregator/types'; import { View } from '../view/View'; @@ -50,7 +50,7 @@ export class SyncMetricStorage> extends MetricStor this._temporalMetricStorage = new TemporalMetricProcessor(aggregator); } - record(value: number, attributes: Attributes, context: Context) { + record(value: number, attributes: SpanAttributes, context: Context) { attributes = this._attributesProcessor.process(attributes, context); this._deltaMetricStorage.record(value, attributes, context); } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/WritableMetricStorage.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/WritableMetricStorage.ts index 7d30d0ee90..cd94e86864 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/WritableMetricStorage.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/WritableMetricStorage.ts @@ -15,7 +15,7 @@ */ import { Context } from '@opentelemetry/api'; -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; /** * Internal interface. @@ -24,9 +24,9 @@ import { Attributes } from '@opentelemetry/api-metrics'; */ export interface WritableMetricStorage { /** Records a measurement. */ - record(value: number, attributes: Attributes, context: Context): void; + record(value: number, attributes: SpanAttributes, context: Context): void; } export class NoopWritableMetricStorage implements WritableMetricStorage { - record(_value: number, _attributes: Attributes, _context: Context): void {} + record(_value: number, _attributes: SpanAttributes, _context: Context): void {} } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/utils.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/utils.ts index 4fa84fd4ca..50eec061f3 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/utils.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/utils.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; export type Maybe = T | undefined; @@ -24,9 +24,9 @@ export function isNotNullish(item: Maybe): item is T { /** * Converting the unordered attributes into unique identifier string. - * @param attributes user provided unordered Attributes. + * @param attributes user provided unordered SpanAttributes. */ -export function hashAttributes(attributes: Attributes): string { +export function hashAttributes(attributes: SpanAttributes): string { let keys = Object.keys(attributes); if (keys.length === 0) return ''; diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/view/AttributesProcessor.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/view/AttributesProcessor.ts index 562bfcef92..cca9c8fa80 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/view/AttributesProcessor.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/view/AttributesProcessor.ts @@ -15,7 +15,7 @@ */ import { Context } from '@opentelemetry/api'; -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; /** * The {@link AttributesProcessor} is responsible for customizing which @@ -30,7 +30,7 @@ export abstract class AttributesProcessor { * @param context The active context when the instrument is synchronous. * `undefined` otherwise. */ - abstract process(incoming: Attributes, context?: Context): Attributes; + abstract process(incoming: SpanAttributes, context?: Context): SpanAttributes; static Noop() { return NOOP; @@ -38,7 +38,7 @@ export abstract class AttributesProcessor { } export class NoopAttributesProcessor extends AttributesProcessor { - process(incoming: Attributes, _context?: Context) { + process(incoming: SpanAttributes, _context?: Context) { return incoming; } } @@ -52,8 +52,8 @@ export class FilteringAttributesProcessor extends AttributesProcessor { super(); } - process(incoming: Attributes, _context: Context): Attributes { - const filteredAttributes: Attributes = {}; + process(incoming: SpanAttributes, _context: Context): SpanAttributes { + const filteredAttributes: SpanAttributes = {}; Object.keys(incoming) .filter(attributeName => this._allowedAttributeNames.includes(attributeName)) .forEach(attributeName => filteredAttributes[attributeName] = incoming[attributeName]); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/MeterProvider.test.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/MeterProvider.test.ts index 93d6aebdc2..779a9256b9 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/MeterProvider.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/MeterProvider.test.ts @@ -158,7 +158,7 @@ describe('MeterProvider', () => { // DataPoint matches attributes and point. assertPartialDeepStrictEqual(result?.instrumentationLibraryMetrics[0].metrics[0].dataPoints[0], { - // Attributes are still there. + // SpanAttributes are still there. attributes: { attrib1: 'attrib_value1', attrib2: 'attrib_value2' diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/state/HashMap.test.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/state/HashMap.test.ts index 8a4ac7da01..5068a55893 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/state/HashMap.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/state/HashMap.test.ts @@ -15,14 +15,14 @@ */ import * as assert from 'assert'; -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import { HashMap } from '../../src/state/HashMap'; import { hashAttributes } from '../../src/utils'; describe('HashMap', () => { describe('set & get', () => { it('should get and set with attributes', () => { - const map = new HashMap(hashAttributes); + const map = new HashMap(hashAttributes); const hash = hashAttributes({ foo: 'bar' }); map.set({ foo: 'bar' }, 1); @@ -41,7 +41,7 @@ describe('HashMap', () => { describe('has', () => { it('should return if the key exists in the value map', () => { - const map = new HashMap(hashAttributes); + const map = new HashMap(hashAttributes); const hash = hashAttributes({ foo: 'bar' }); // with pinned hash code @@ -58,7 +58,7 @@ describe('HashMap', () => { describe('entries', () => { it('iterating with entries', () => { - const map = new HashMap(hashAttributes); + const map = new HashMap(hashAttributes); map.set({ foo: '1' }, 1); map.set({ foo: '2' }, 2); map.set({ foo: '3' }, 3); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MultiWritableMetricStorage.test.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MultiWritableMetricStorage.test.ts index 41b1b9b6d8..5da52465cd 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MultiWritableMetricStorage.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MultiWritableMetricStorage.test.ts @@ -15,7 +15,7 @@ */ import * as api from '@opentelemetry/api'; -import { Attributes } from '@opentelemetry/api-metrics'; +import { SpanAttributes } from '@opentelemetry/api-metrics'; import * as assert from 'assert'; import { Measurement } from '../../src/Measurement'; import { MultiMetricStorage } from '../../src/state/MultiWritableMetricStorage'; @@ -37,7 +37,7 @@ describe('MultiMetricStorage', () => { it('record with multiple backing storages', () => { class TestWritableMetricStorage implements WritableMetricStorage { records: Measurement[] = []; - record(value: number, attributes: Attributes, context: api.Context): void { + record(value: number, attributes: SpanAttributes, context: api.Context): void { this.records.push({ value, attributes, context }); } } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/util.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/util.ts index e01c72b018..4c9552fd79 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/util.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/util.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { Attributes, ValueType } from '@opentelemetry/api-metrics'; +import { SpanAttributes, ValueType } from '@opentelemetry/api-metrics'; import { InstrumentationLibrary } from '@opentelemetry/core'; import { Resource } from '@opentelemetry/resources'; import * as assert from 'assert'; @@ -49,7 +49,7 @@ export const defaultInstrumentationLibrary: InstrumentationLibrary = { }; export const commonValues: number[] = [1, -1, 1.0, Infinity, -Infinity, NaN]; -export const commonAttributes: Attributes[] = [{}, { 1: '1' }, { a: '2' }, new (class Foo { +export const commonAttributes: SpanAttributes[] = [{}, { 1: '1' }, { a: '2' }, new (class Foo { a = '1'; })]; @@ -86,7 +86,7 @@ export function assertMetricData( export function assertDataPoint( actual: unknown, - attributes: Attributes, + attributes: SpanAttributes, point: Histogram | number, startTime?: HrTime, endTime?: HrTime, diff --git a/packages/opentelemetry-core/src/common/attributes.ts b/packages/opentelemetry-core/src/common/attributes.ts index 6e07557b2e..0726acd581 100644 --- a/packages/opentelemetry-core/src/common/attributes.ts +++ b/packages/opentelemetry-core/src/common/attributes.ts @@ -14,10 +14,10 @@ * limitations under the License. */ -import { diag, AttributeValue, Attributes } from '@opentelemetry/api'; +import { diag, SpanAttributeValue, SpanAttributes } from '@opentelemetry/api'; -export function sanitizeAttributes(attributes: unknown): Attributes { - const out: Attributes = {}; +export function sanitizeAttributes(attributes: unknown): SpanAttributes { + const out: SpanAttributes = {}; if (typeof attributes !== 'object' || attributes == null) { return out; @@ -46,7 +46,7 @@ export function isAttributeKey(key: unknown): key is string { return typeof key === 'string' && key.length > 0; } -export function isAttributeValue(val: unknown): val is AttributeValue { +export function isAttributeValue(val: unknown): val is SpanAttributeValue { if (val == null) { return true; } @@ -87,9 +87,7 @@ function isHomogeneousAttributeValueArray(arr: unknown[]): boolean { function isValidPrimitiveAttributeValue(val: unknown): boolean { switch (typeof val) { case 'number': - return true; case 'boolean': - return true; case 'string': return true; } diff --git a/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts b/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts index aba16a18b7..1097ac1476 100644 --- a/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts +++ b/packages/opentelemetry-core/src/trace/sampler/ParentBasedSampler.ts @@ -15,12 +15,12 @@ */ import { - Attributes, Context, isSpanContextValid, Link, Sampler, SamplingResult, + SpanAttributes, SpanKind, TraceFlags, trace, } from '@opentelemetry/api'; @@ -64,7 +64,7 @@ export class ParentBasedSampler implements Sampler { traceId: string, spanName: string, spanKind: SpanKind, - attributes: Attributes, + attributes: SpanAttributes, links: Link[] ): SamplingResult { const parentContext = trace.getSpanContext(context); diff --git a/packages/opentelemetry-exporter-zipkin/src/transform.ts b/packages/opentelemetry-exporter-zipkin/src/transform.ts index 1b3a444a67..9ffd48ecce 100644 --- a/packages/opentelemetry-exporter-zipkin/src/transform.ts +++ b/packages/opentelemetry-exporter-zipkin/src/transform.ts @@ -66,9 +66,9 @@ export function toZipkinSpan( return zipkinSpan; } -/** Converts OpenTelemetry Attributes and SpanStatus to Zipkin Tags format. */ +/** Converts OpenTelemetry SpanAttributes and SpanStatus to Zipkin Tags format. */ export function _toZipkinTags( - attributes: api.Attributes, + attributes: api.SpanAttributes, status: api.SpanStatus, statusCodeTagName: string, statusErrorTagName: string, diff --git a/packages/opentelemetry-resources/src/Resource.ts b/packages/opentelemetry-resources/src/Resource.ts index 55853ac98e..ac368d812e 100644 --- a/packages/opentelemetry-resources/src/Resource.ts +++ b/packages/opentelemetry-resources/src/Resource.ts @@ -68,7 +68,7 @@ export class Resource { merge(other: Resource | null): Resource { if (!other || !Object.keys(other.attributes).length) return this; - // Attributes from resource overwrite attributes from other resource. + // SpanAttributes from resource overwrite attributes from other resource. const mergedAttributes = Object.assign( {}, this.attributes, diff --git a/packages/opentelemetry-sdk-trace-base/src/BasicTracerProvider.ts b/packages/opentelemetry-sdk-trace-base/src/BasicTracerProvider.ts index b7aab0949c..a964de5840 100644 --- a/packages/opentelemetry-sdk-trace-base/src/BasicTracerProvider.ts +++ b/packages/opentelemetry-sdk-trace-base/src/BasicTracerProvider.ts @@ -20,7 +20,6 @@ import { propagation, TextMapPropagator, trace, - TracerOptions, TracerProvider, } from '@opentelemetry/api'; import { @@ -91,7 +90,7 @@ export class BasicTracerProvider implements TracerProvider { } } - getTracer(name: string, version?: string, options?: TracerOptions): Tracer { + getTracer(name: string, version?: string, options?: { schemaUrl?: string }): Tracer { const key = `${name}@${version || ''}:${options?.schemaUrl || ''}`; if (!this._tracers.has(key)) { this._tracers.set(key, new Tracer({ name, version, schemaUrl: options?.schemaUrl }, this._config, this)); diff --git a/packages/opentelemetry-sdk-trace-base/src/Span.ts b/packages/opentelemetry-sdk-trace-base/src/Span.ts index 343ceebf03..00859d7d55 100644 --- a/packages/opentelemetry-sdk-trace-base/src/Span.ts +++ b/packages/opentelemetry-sdk-trace-base/src/Span.ts @@ -31,7 +31,7 @@ import { TimedEvent } from './TimedEvent'; import { Tracer } from './Tracer'; import { SpanProcessor } from './SpanProcessor'; import { SpanLimits } from './types'; -import { AttributeValue, Context } from '@opentelemetry/api'; +import { SpanAttributeValue, Context } from '@opentelemetry/api'; import { ExceptionEventName } from './enums'; /** @@ -43,7 +43,7 @@ export class Span implements api.Span, ReadableSpan { private readonly _spanContext: api.SpanContext; readonly kind: api.SpanKind; readonly parentSpanId?: string; - readonly attributes: api.Attributes = {}; + readonly attributes: api.SpanAttributes = {}; readonly links: api.Link[] = []; readonly events: TimedEvent[] = []; readonly startTime: api.HrTime; @@ -89,7 +89,7 @@ export class Span implements api.Span, ReadableSpan { return this._spanContext; } - setAttribute(key: string, value?: AttributeValue): this; + setAttribute(key: string, value?: SpanAttributeValue): this; setAttribute(key: string, value: unknown): this { if (value == null || this._isSpanEnded()) return this; if (key.length === 0) { @@ -112,7 +112,7 @@ export class Span implements api.Span, ReadableSpan { return this; } - setAttributes(attributes: api.Attributes): this { + setAttributes(attributes: api.SpanAttributes): this { for (const [k, v] of Object.entries(attributes)) { this.setAttribute(k, v); } @@ -128,7 +128,7 @@ export class Span implements api.Span, ReadableSpan { */ addEvent( name: string, - attributesOrStartTime?: api.Attributes | api.TimeInput, + attributesOrStartTime?: api.SpanAttributes | api.TimeInput, startTime?: api.TimeInput ): this { if (this._isSpanEnded()) return this; @@ -196,7 +196,7 @@ export class Span implements api.Span, ReadableSpan { } recordException(exception: api.Exception, time: api.TimeInput = hrTime()): void { - const attributes: api.Attributes = {}; + const attributes: api.SpanAttributes = {}; if (typeof exception === 'string') { attributes[SemanticAttributes.EXCEPTION_MESSAGE] = exception; } else if (exception) { @@ -263,7 +263,7 @@ export class Span implements api.Span, ReadableSpan { * @param value Attribute value * @returns truncated attribute value if required, otherwise same value */ - private _truncateToSize(value: AttributeValue): AttributeValue { + private _truncateToSize(value: SpanAttributeValue): SpanAttributeValue { const limit = this._attributeValueLengthLimit; // Check limit if (limit <= 0) { diff --git a/packages/opentelemetry-sdk-trace-base/src/TimedEvent.ts b/packages/opentelemetry-sdk-trace-base/src/TimedEvent.ts index 862a14201d..93cb9b47f3 100644 --- a/packages/opentelemetry-sdk-trace-base/src/TimedEvent.ts +++ b/packages/opentelemetry-sdk-trace-base/src/TimedEvent.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { HrTime, Attributes } from '@opentelemetry/api'; +import { HrTime, SpanAttributes } from '@opentelemetry/api'; /** * Represents a timed event. @@ -25,5 +25,5 @@ export interface TimedEvent { /** The name of the event. */ name: string; /** The attributes of the event. */ - attributes?: Attributes; + attributes?: SpanAttributes; } diff --git a/packages/opentelemetry-sdk-trace-base/src/export/ReadableSpan.ts b/packages/opentelemetry-sdk-trace-base/src/export/ReadableSpan.ts index 08631e9d6d..8552134a56 100644 --- a/packages/opentelemetry-sdk-trace-base/src/export/ReadableSpan.ts +++ b/packages/opentelemetry-sdk-trace-base/src/export/ReadableSpan.ts @@ -17,7 +17,7 @@ import { SpanKind, SpanStatus, - Attributes, + SpanAttributes, HrTime, Link, SpanContext, @@ -34,7 +34,7 @@ export interface ReadableSpan { readonly startTime: HrTime; readonly endTime: HrTime; readonly status: SpanStatus; - readonly attributes: Attributes; + readonly attributes: SpanAttributes; readonly links: Link[]; readonly events: TimedEvent[]; readonly duration: HrTime; diff --git a/packages/opentelemetry-sdk-trace-base/test/common/Span.test.ts b/packages/opentelemetry-sdk-trace-base/test/common/Span.test.ts index ebb40a33c1..4573efbbf4 100644 --- a/packages/opentelemetry-sdk-trace-base/test/common/Span.test.ts +++ b/packages/opentelemetry-sdk-trace-base/test/common/Span.test.ts @@ -22,8 +22,8 @@ import { SpanKind, TraceFlags, HrTime, - Attributes, - AttributeValue, + SpanAttributes, + SpanAttributeValue, } from '@opentelemetry/api'; import { DEFAULT_ATTRIBUTE_COUNT_LIMIT, @@ -244,7 +244,7 @@ describe('Span', () => { span.setAttribute(k, v); } for (const [k, v] of Object.entries(invalidAttributes)) { - span.setAttribute(k, v as unknown as AttributeValue); + span.setAttribute(k, v as unknown as SpanAttributeValue); } assert.deepStrictEqual(span.attributes, validAttributes); @@ -613,7 +613,7 @@ describe('Span', () => { ); span.setAttributes(validAttributes); - span.setAttributes(invalidAttributes as unknown as Attributes); + span.setAttributes(invalidAttributes as unknown as SpanAttributes); assert.deepStrictEqual(span.attributes, validAttributes); }); @@ -641,7 +641,7 @@ describe('Span', () => { spanContext, SpanKind.CLIENT ); - span.addEvent('rev', { ...validAttributes, ...invalidAttributes } as unknown as Attributes); + span.addEvent('rev', { ...validAttributes, ...invalidAttributes } as unknown as SpanAttributes); span.end(); assert.strictEqual(span.events.length, 1); diff --git a/packages/opentelemetry-sdk-trace-base/test/common/Tracer.test.ts b/packages/opentelemetry-sdk-trace-base/test/common/Tracer.test.ts index 573346548e..7918bbc951 100644 --- a/packages/opentelemetry-sdk-trace-base/test/common/Tracer.test.ts +++ b/packages/opentelemetry-sdk-trace-base/test/common/Tracer.test.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import { - Attributes, + SpanAttributes, Context, context, createContextKey, @@ -49,7 +49,7 @@ describe('Tracer', () => { : process.env) as any; class TestSampler implements Sampler { - shouldSample(_context: Context, _traceId: string, _spanName: string, _spanKind: SpanKind, attributes: Attributes, links: Link[]) { + shouldSample(_context: Context, _traceId: string, _spanName: string, _spanKind: SpanKind, attributes: SpanAttributes, links: Link[]) { // The attributes object should be valid. assert.deepStrictEqual(sanitizeAttributes(attributes), attributes); links.forEach(link => { @@ -61,7 +61,7 @@ describe('Tracer', () => { testAttribute: 'foobar', // invalid attributes should be sanitized. ...invalidAttributes, - } as unknown as Attributes, + } as unknown as SpanAttributes, }; } } @@ -375,7 +375,7 @@ describe('Tracer', () => { tracerProvider ); - const attributes = { ...validAttributes, ...invalidAttributes } as unknown as Attributes; + const attributes = { ...validAttributes, ...invalidAttributes } as unknown as SpanAttributes; const links = [{ context: { traceId: 'b3cda95b652f4a1592b449d5929fda1b', diff --git a/packages/opentelemetry-semantic-conventions/src/resource/SemanticResourceAttributes.ts b/packages/opentelemetry-semantic-conventions/src/resource/SemanticResourceAttributes.ts index 561a20c46c..ead775e80e 100644 --- a/packages/opentelemetry-semantic-conventions/src/resource/SemanticResourceAttributes.ts +++ b/packages/opentelemetry-semantic-conventions/src/resource/SemanticResourceAttributes.ts @@ -245,7 +245,7 @@ As an alternative, consider setting `faas.id` as a span attribute instead. HOST_IMAGE_ID: 'host.image.id', /** - * The version string of the VM image as defined in [Version Attributes](README.md#version-attributes). + * The version string of the VM image as defined in [Version SpanAttributes](README.md#version-attributes). */ HOST_IMAGE_VERSION: 'host.image.version', @@ -360,7 +360,7 @@ As an alternative, consider setting `faas.id` as a span attribute instead. OS_NAME: 'os.name', /** - * The version string of the operating system as defined in [Version Attributes](../../resource/semantic_conventions/README.md#version-attributes). + * The version string of the operating system as defined in [Version SpanAttributes](../../resource/semantic_conventions/README.md#version-attributes). */ OS_VERSION: 'os.version', diff --git a/packages/opentelemetry-shim-opentracing/src/shim.ts b/packages/opentelemetry-shim-opentracing/src/shim.ts index 5d303ca312..b9fee53adc 100644 --- a/packages/opentelemetry-shim-opentracing/src/shim.ts +++ b/packages/opentelemetry-shim-opentracing/src/shim.ts @@ -15,7 +15,7 @@ */ import * as api from '@opentelemetry/api'; -import { Attributes, AttributeValue, SpanStatusCode, TextMapPropagator } from '@opentelemetry/api'; +import { SpanAttributes, SpanAttributeValue, SpanStatusCode, TextMapPropagator } from '@opentelemetry/api'; import * as opentracing from 'opentracing'; import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; @@ -276,7 +276,7 @@ export class SpanShim extends opentracing.Span { * @param eventName name of the event. * @param payload an arbitrary object to be attached to the event. */ - override logEvent(eventName: string, payload?: Attributes): void { + override logEvent(eventName: string, payload?: SpanAttributes): void { this._logInternal(eventName, payload); } @@ -286,7 +286,7 @@ export class SpanShim extends opentracing.Span { * @param keyValuePairs a set of key-value pairs to be used as event attributes * @param timestamp optional timestamp for the event */ - override log(keyValuePairs: Attributes, timestamp?: number): this { + override log(keyValuePairs: SpanAttributes, timestamp?: number): this { const entries = Object.entries(keyValuePairs); const eventEntry = entries.find(([key, _]) => key === 'event'); const eventName = eventEntry?.[1] || 'log'; @@ -296,7 +296,7 @@ export class SpanShim extends opentracing.Span { return this; } - private _logInternal(eventName: string, attributes: Attributes | undefined, timestamp?: number): void { + private _logInternal(eventName: string, attributes: SpanAttributes | undefined, timestamp?: number): void { if (attributes && eventName === 'error') { const entries = Object.entries(attributes); const errorEntry = entries.find(([key]) => key === 'error.object'); @@ -306,7 +306,7 @@ export class SpanShim extends opentracing.Span { return; } - const mappedAttributes: api.Attributes = {}; + const mappedAttributes: api.SpanAttributes = {}; for (const [k, v] of entries) { switch (k) { case 'error.kind': { @@ -337,7 +337,7 @@ export class SpanShim extends opentracing.Span { * Adds a set of tags to the span. * @param keyValueMap set of KV pairs representing tags */ - override addTags(keyValueMap: Attributes): this { + override addTags(keyValueMap: SpanAttributes): this { for (const [key, value] of Object.entries(keyValueMap)) { if (this._setErrorAsSpanStatusCode(key, value)) { continue; @@ -355,7 +355,7 @@ export class SpanShim extends opentracing.Span { * @param key key for the tag * @param value value for the tag */ - override setTag(key: string, value: AttributeValue): this { + override setTag(key: string, value: SpanAttributeValue): this { if (this._setErrorAsSpanStatusCode(key, value)) { return this; } @@ -383,7 +383,7 @@ export class SpanShim extends opentracing.Span { private _setErrorAsSpanStatusCode( key: string, - value: AttributeValue | undefined + value: SpanAttributeValue | undefined ): boolean { if (key === opentracing.Tags.ERROR) { const statusCode = SpanShim._mapErrorTag(value); @@ -394,7 +394,7 @@ export class SpanShim extends opentracing.Span { } private static _mapErrorTag( - value: AttributeValue | undefined + value: SpanAttributeValue | undefined ): SpanStatusCode { switch (value) { case true: From 6ca35a3545bb34e347b0210dc4acd8229b1b37cc Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 13 Apr 2022 17:17:55 -0400 Subject: [PATCH 05/18] chore: update changelog --- CHANGELOG.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 328a95ad40..3fa9cc65ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,15 +10,16 @@ All notable changes to this project will be documented in this file. ### :bug: (Bug Fix) -* fix: sanitize attributes inputs #2881 @legendecas +* fix: sanitize attributes inputs [#2881](https://github.com/open-telemetry/opentelemetry-js/pull/2881) @legendecas +* fix: support earlier API versions [#2892](https://github.com/open-telemetry/opentelemetry-js/pull/2892) @dyladan ### :books: (Refine Doc) -* docs(sdk): update earliest support node version #2860 @svetlanabrennan +* docs(sdk): update earliest support node version [#2860](https://github.com/open-telemetry/opentelemetry-js/pull/2860) @svetlanabrennan ### :house: (Internal) -* chore: require changelog entry to merge PR #2847 @dyladan +* chore: require changelog entry to merge PR [#2847](https://github.com/open-telemetry/opentelemetry-js/pull/2847) @dyladan ## 1.1.1 From 97ecc3cea354f05e0cf39848447514b019a05407 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 13 Apr 2022 17:22:00 -0400 Subject: [PATCH 06/18] chore: remove peer api check --- .github/workflows/peer-api.yaml | 26 ----------------------- CHANGELOG.md | 1 + scripts/peer-api-check.js | 37 --------------------------------- 3 files changed, 1 insertion(+), 63 deletions(-) delete mode 100644 .github/workflows/peer-api.yaml delete mode 100644 scripts/peer-api-check.js diff --git a/.github/workflows/peer-api.yaml b/.github/workflows/peer-api.yaml deleted file mode 100644 index 10e9b48065..0000000000 --- a/.github/workflows/peer-api.yaml +++ /dev/null @@ -1,26 +0,0 @@ -name: Ensure API Peer Dependency - -on: - push: - branches: - - main - pull_request: - -jobs: - peer-api-check: - runs-on: ubuntu-latest - container: - image: node:14 - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install lerna - run: npm install -g lerna - - - name: Install semver - run: npm install semver - - - name: Check API dependency semantics (stable) - working-directory: packages - run: lerna exec --ignore propagation-validation-server --ignore propagation-validation-server --ignore @opentelemetry/selenium-tests "node ../../scripts/peer-api-check.js" diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fa9cc65ee..e9b224ff08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ All notable changes to this project will be documented in this file. ### :house: (Internal) * chore: require changelog entry to merge PR [#2847](https://github.com/open-telemetry/opentelemetry-js/pull/2847) @dyladan +* chore: remove peer API check [#2892](https://github.com/open-telemetry/opentelemetry-js/pull/2892) @dyladan ## 1.1.1 diff --git a/scripts/peer-api-check.js b/scripts/peer-api-check.js deleted file mode 100644 index 3d79e60f44..0000000000 --- a/scripts/peer-api-check.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 fs = require('fs'); -const os = require('os'); -const path = require('path'); -const semver = require('semver'); - -const appRoot = process.cwd(); - -const packageJsonUrl = path.resolve(`${appRoot}/package.json`); -const pjson = require(packageJsonUrl); - -if (pjson.dependencies && pjson.dependencies["@opentelemetry/api"]) - throw new Error(`Package ${pjson.name} depends on API but it should be a peer dependency`); - -const peerVersion = pjson.peerDependencies && pjson.peerDependencies["@opentelemetry/api"] -const devVersion = pjson.devDependencies && pjson.devDependencies["@opentelemetry/api"] -if (peerVersion) { - if (!semver.subset(devVersion, peerVersion)) { - throw new Error(`Package ${pjson.name} depends on peer API version ${peerVersion} but version ${devVersion} in development`); - } - console.log(`${pjson.name} OK`); -} From e9540f82f924f9f4731e259e0d99ff6b6d8b9464 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 13 Apr 2022 17:22:42 -0400 Subject: [PATCH 07/18] chore: changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9b224ff08..58c9a285f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file. * chore: require changelog entry to merge PR [#2847](https://github.com/open-telemetry/opentelemetry-js/pull/2847) @dyladan * chore: remove peer API check [#2892](https://github.com/open-telemetry/opentelemetry-js/pull/2892) @dyladan +* chore: merge lerna subdirectories into a single monorepo [#2892](https://github.com/open-telemetry/opentelemetry-js/pull/2892) @dyladan ## 1.1.1 From b8ff087f9c577838a51160a1b9bcbcff10134ef3 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 13 Apr 2022 17:39:54 -0400 Subject: [PATCH 08/18] chore: fix cache keys and paths --- .github/workflows/unit-test.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index be9aec6141..6838eabed2 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -6,7 +6,7 @@ on: pull_request: jobs: - node-tests-stable: + node-tests: strategy: fail-fast: false matrix: @@ -28,8 +28,9 @@ jobs: with: path: | node_modules - */*/node_modules - key: node-tests-stable-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }} + packages/*/node_modules + experimental/packages/*/node_modules + key: node-tests-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }} - name: Bootstrap if: steps.cache.outputs.cache-hit != 'true' @@ -46,7 +47,7 @@ jobs: - name: Report Coverage run: npm run codecov if: ${{ matrix.node_version == '14' }} - browser-tests-stable: + browser-tests: runs-on: ubuntu-latest container: image: circleci/node:16-browsers @@ -59,13 +60,14 @@ jobs: uses: actions/checkout@v2 - name: restore lerna - uses: actions/cache@v3 id: cache + uses: actions/cache@v3 with: path: | node_modules - */*/node_modules - key: browser-tests-stable-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }} + packages/*/node_modules + experimental/packages/*/node_modules + key: browser-tests-${{ runner.os }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }} - name: Bootstrap if: steps.cache.outputs.cache-hit != 'true' @@ -83,7 +85,7 @@ jobs: run: npm run test:browser - name: Report Coverage run: npm run codecov:browser - webworker-tests-stable: + webworker-tests: runs-on: ubuntu-latest container: image: circleci/node:14-browsers @@ -96,13 +98,14 @@ jobs: run: sudo chmod -R 777 /github /__w - name: restore lerna - uses: actions/cache@v3 id: cache + uses: actions/cache@v3 with: path: | node_modules - */*/node_modules - key: browser-tests-stable-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }} + packages/*/node_modules + experimental/packages/*/node_modules + key: webworker-tests-${{ runner.os }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }} - name: Bootstrap if: steps.cache.outputs.cache-hit != 'true' From 5a7aa7034e69d665a88dc521a7df9a9028650cd2 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 13 Apr 2022 17:46:58 -0400 Subject: [PATCH 09/18] chore: fix lint cache --- .github/workflows/lint.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 42bc17b5db..377d07b2d6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -39,8 +39,9 @@ jobs: with: path: | node_modules - */*/node_modules - key: lint-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}-20211216.2 + packages/*/node_modules + experimental/packages/*/node_modules + key: lint-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }} # On a cache miss, install dependencies - name: Bootstrap From 78fae539dbc210b317461de8c06f21e8dd724cdb Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Thu, 14 Apr 2022 13:55:35 -0400 Subject: [PATCH 10/18] ci: install when cache misses --- .github/workflows/unit-test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 6838eabed2..d8297340cf 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -28,12 +28,14 @@ jobs: with: path: | node_modules + package-lock.json packages/*/node_modules + packages/*/package-lock.json experimental/packages/*/node_modules - key: node-tests-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }} + experimental/packages/*/package-lock.json + key: node-tests-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04142022 - name: Bootstrap - if: steps.cache.outputs.cache-hit != 'true' run: | npm install --ignore-scripts npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --ignore @opentelemetry/selenium-tests From 8216fc4236ae783a7dc90116d66d5a802831c55c Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Thu, 14 Apr 2022 14:02:48 -0400 Subject: [PATCH 11/18] chore: apply cache fix to webworker and web --- .github/workflows/unit-test.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index d8297340cf..a3599e25c2 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -67,12 +67,14 @@ jobs: with: path: | node_modules + package-lock.json packages/*/node_modules + packages/*/package-lock.json experimental/packages/*/node_modules - key: browser-tests-${{ runner.os }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }} + experimental/packages/*/package-lock.json + key: browser-tests-${{ runner.os }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04142022 - name: Bootstrap - if: steps.cache.outputs.cache-hit != 'true' run: | npm install --ignore-scripts npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --ignore @opentelemetry/selenium-tests @@ -105,12 +107,14 @@ jobs: with: path: | node_modules + package-lock.json packages/*/node_modules + packages/*/package-lock.json experimental/packages/*/node_modules - key: webworker-tests-${{ runner.os }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }} + experimental/packages/*/package-lock.json + key: webworker-tests-${{ runner.os }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04142022 - name: Bootstrap - if: steps.cache.outputs.cache-hit != 'true' run: | npm install --ignore-scripts npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' From 3c0adb0cc698f40f8c190c48a494c7f4a9e77b05 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Thu, 14 Apr 2022 14:03:28 -0400 Subject: [PATCH 12/18] chore: apply cache fix to lint --- .github/workflows/lint.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 377d07b2d6..f6ad0e48ce 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -39,13 +39,15 @@ jobs: with: path: | node_modules + package-lock.json packages/*/node_modules + packages/*/package-lock.json experimental/packages/*/node_modules - key: lint-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }} + experimental/packages/*/package-lock.json + key: lint-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04142022 # On a cache miss, install dependencies - name: Bootstrap - if: steps.cache.outputs.cache-hit != 'true' run: | npm install --ignore-scripts npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' From e6d2855d1714720044f3e586c2c1df78330adb44 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 15 Apr 2022 08:28:57 -0400 Subject: [PATCH 13/18] chore: revert peer api check removal --- .github/workflows/peer-api.yml | 26 ++++++++++++++++++++++++ scripts/peer-api-check.js | 37 ++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 .github/workflows/peer-api.yml create mode 100644 scripts/peer-api-check.js diff --git a/.github/workflows/peer-api.yml b/.github/workflows/peer-api.yml new file mode 100644 index 0000000000..de9e1a6dcc --- /dev/null +++ b/.github/workflows/peer-api.yml @@ -0,0 +1,26 @@ +name: Ensure API Peer Dependency + +on: + push: + branches: + - main + pull_request: + +jobs: + peer-api-check: + runs-on: ubuntu-latest + container: + image: node:14 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install lerna + run: npm install -g lerna + + - name: Install semver + run: npm install semver + + - name: Check API dependency semantics + working-directory: packages + run: lerna exec --ignore propagation-validation-server --ignore @opentelemetry/api-metrics --ignore propagation-validation-server --ignore @opentelemetry/selenium-tests "node $(pwd)/scripts/peer-api-check.js" diff --git a/scripts/peer-api-check.js b/scripts/peer-api-check.js new file mode 100644 index 0000000000..e372af1eb2 --- /dev/null +++ b/scripts/peer-api-check.js @@ -0,0 +1,37 @@ +/* + * 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 fs = require('fs'); +const os = require('os'); +const path = require('path'); +const semver = require('semver'); + +const appRoot = process.cwd(); + +const packageJsonUrl = path.resolve(`${appRoot}/package.json`); +const pjson = require(packageJsonUrl); + +if (pjson.dependencies && pjson.dependencies["@opentelemetry/api"]) + throw new Error(`Package ${pjson.name} depends on API but it should be a peer dependency`); + +const peerVersion = pjson.peerDependencies && pjson.peerDependencies["@opentelemetry/api"] +const devVersion = pjson.devDependencies && pjson.devDependencies["@opentelemetry/api"] +if (peerVersion) { + if (!semver.subset(devVersion, peerVersion)) { + throw new Error(`Package ${pjson.name} depends on peer API version ${peerVersion} but version ${devVersion} in development`); + } + console.log(`${pjson.name} OK`); +} \ No newline at end of file From 0a33593b518914657869da6413a6e3a74b89c201 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 15 Apr 2022 08:37:25 -0400 Subject: [PATCH 14/18] chore: match peer and dev dependency versions for API --- experimental/packages/opentelemetry-sdk-node/package.json | 2 +- experimental/packages/otlp-transformer/package.json | 2 +- packages/opentelemetry-context-async-hooks/package.json | 2 +- packages/opentelemetry-context-zone-peer-dep/package.json | 2 +- packages/opentelemetry-core/package.json | 2 +- packages/opentelemetry-propagator-b3/package.json | 2 +- packages/opentelemetry-propagator-jaeger/package.json | 2 +- packages/opentelemetry-resources/package.json | 2 +- packages/opentelemetry-sdk-trace-base/package.json | 2 +- packages/opentelemetry-sdk-trace-node/package.json | 2 +- packages/opentelemetry-sdk-trace-web/package.json | 2 +- packages/opentelemetry-shim-opentracing/package.json | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/experimental/packages/opentelemetry-sdk-node/package.json b/experimental/packages/opentelemetry-sdk-node/package.json index d900f0482c..177118f082 100644 --- a/experimental/packages/opentelemetry-sdk-node/package.json +++ b/experimental/packages/opentelemetry-sdk-node/package.json @@ -57,7 +57,7 @@ "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api": ">=1.0.0 <1.2.0", "@opentelemetry/context-async-hooks": "1.1.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", diff --git a/experimental/packages/otlp-transformer/package.json b/experimental/packages/otlp-transformer/package.json index d608a2b625..f6c44c4dd1 100644 --- a/experimental/packages/otlp-transformer/package.json +++ b/experimental/packages/otlp-transformer/package.json @@ -46,7 +46,7 @@ "@opentelemetry/api-metrics": "~0.27.0" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api": ">=1.0.0 <1.2.0", "@opentelemetry/api-metrics": "~0.27.0", "@types/mocha": "8.2.3", "@types/webpack-env": "1.16.3", diff --git a/packages/opentelemetry-context-async-hooks/package.json b/packages/opentelemetry-context-async-hooks/package.json index 07eee63295..9614218dcb 100644 --- a/packages/opentelemetry-context-async-hooks/package.json +++ b/packages/opentelemetry-context-async-hooks/package.json @@ -43,7 +43,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api": ">=1.0.0 <1.2.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "codecov": "3.8.3", diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json index f4e2da9092..10cf215252 100644 --- a/packages/opentelemetry-context-zone-peer-dep/package.json +++ b/packages/opentelemetry-context-zone-peer-dep/package.json @@ -53,7 +53,7 @@ }, "devDependencies": { "@babel/core": "7.16.0", - "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api": ">=1.0.0 <1.2.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json index 2015807cb6..0c34a3a81c 100644 --- a/packages/opentelemetry-core/package.json +++ b/packages/opentelemetry-core/package.json @@ -63,7 +63,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api": ">=1.0.0 <1.2.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", diff --git a/packages/opentelemetry-propagator-b3/package.json b/packages/opentelemetry-propagator-b3/package.json index d790ea559c..17f6b3c940 100644 --- a/packages/opentelemetry-propagator-b3/package.json +++ b/packages/opentelemetry-propagator-b3/package.json @@ -56,7 +56,7 @@ "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api": ">=1.0.0 <1.2.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "codecov": "3.8.3", diff --git a/packages/opentelemetry-propagator-jaeger/package.json b/packages/opentelemetry-propagator-jaeger/package.json index 7ad27c5c7b..04b548f365 100644 --- a/packages/opentelemetry-propagator-jaeger/package.json +++ b/packages/opentelemetry-propagator-jaeger/package.json @@ -53,7 +53,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api": ">=1.0.0 <1.2.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", diff --git a/packages/opentelemetry-resources/package.json b/packages/opentelemetry-resources/package.json index 5f4d044087..4b39205af3 100644 --- a/packages/opentelemetry-resources/package.json +++ b/packages/opentelemetry-resources/package.json @@ -58,7 +58,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api": ">=1.0.0 <1.2.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", diff --git a/packages/opentelemetry-sdk-trace-base/package.json b/packages/opentelemetry-sdk-trace-base/package.json index 68a1906c2c..40027b3c32 100644 --- a/packages/opentelemetry-sdk-trace-base/package.json +++ b/packages/opentelemetry-sdk-trace-base/package.json @@ -61,7 +61,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api": ">=1.0.0 <1.2.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", diff --git a/packages/opentelemetry-sdk-trace-node/package.json b/packages/opentelemetry-sdk-trace-node/package.json index 96b0d7843d..fa867c2810 100644 --- a/packages/opentelemetry-sdk-trace-node/package.json +++ b/packages/opentelemetry-sdk-trace-node/package.json @@ -44,7 +44,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api": ">=1.0.0 <1.2.0", "@opentelemetry/resources": "1.1.1", "@opentelemetry/semantic-conventions": "1.1.1", "@types/mocha": "8.2.3", diff --git a/packages/opentelemetry-sdk-trace-web/package.json b/packages/opentelemetry-sdk-trace-web/package.json index 2880a352bd..c59caa7eb4 100644 --- a/packages/opentelemetry-sdk-trace-web/package.json +++ b/packages/opentelemetry-sdk-trace-web/package.json @@ -55,7 +55,7 @@ }, "devDependencies": { "@babel/core": "7.16.0", - "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api": ">=1.0.0 <1.2.0", "@opentelemetry/context-zone": "1.1.1", "@opentelemetry/propagator-b3": "1.1.1", "@opentelemetry/resources": "1.1.1", diff --git a/packages/opentelemetry-shim-opentracing/package.json b/packages/opentelemetry-shim-opentracing/package.json index d6ce64f348..d66d5cee26 100644 --- a/packages/opentelemetry-shim-opentracing/package.json +++ b/packages/opentelemetry-shim-opentracing/package.json @@ -41,7 +41,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api": ">=1.0.0 <1.2.0", "@opentelemetry/propagator-b3": "1.1.1", "@opentelemetry/propagator-jaeger": "1.1.1", "@opentelemetry/sdk-trace-base": "1.1.1", From d29ce7351a17abd5b3d1f21a9e2b4705d096890a Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 15 Apr 2022 08:44:20 -0400 Subject: [PATCH 15/18] chore: send full string to lerna exec --- .github/workflows/peer-api.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/peer-api.yml b/.github/workflows/peer-api.yml index de9e1a6dcc..a9da0333a7 100644 --- a/.github/workflows/peer-api.yml +++ b/.github/workflows/peer-api.yml @@ -23,4 +23,4 @@ jobs: - name: Check API dependency semantics working-directory: packages - run: lerna exec --ignore propagation-validation-server --ignore @opentelemetry/api-metrics --ignore propagation-validation-server --ignore @opentelemetry/selenium-tests "node $(pwd)/scripts/peer-api-check.js" + run: lerna exec --ignore propagation-validation-server --ignore @opentelemetry/api-metrics --ignore propagation-validation-server --ignore @opentelemetry/selenium-tests \"node $(pwd)/scripts/peer-api-check.js\" From d1e24d0839cd28a69399369cfe07893284f86c13 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 15 Apr 2022 09:05:52 -0400 Subject: [PATCH 16/18] chore: use npm script for peer api check --- .github/workflows/peer-api.yml | 2 +- experimental/backwards-compatability/node10/package.json | 3 ++- experimental/backwards-compatability/node12/package.json | 3 ++- experimental/backwards-compatability/node8/package.json | 3 ++- experimental/packages/exporter-trace-otlp-grpc/package.json | 3 ++- experimental/packages/exporter-trace-otlp-http/package.json | 3 ++- experimental/packages/exporter-trace-otlp-proto/package.json | 3 ++- .../opentelemetry-exporter-metrics-otlp-grpc/package.json | 3 ++- .../opentelemetry-exporter-metrics-otlp-http/package.json | 3 ++- .../opentelemetry-exporter-metrics-otlp-proto/package.json | 3 ++- .../packages/opentelemetry-exporter-prometheus/package.json | 3 ++- .../packages/opentelemetry-instrumentation-fetch/package.json | 3 ++- .../packages/opentelemetry-instrumentation-grpc/package.json | 3 ++- .../packages/opentelemetry-instrumentation-http/package.json | 3 ++- .../package.json | 3 ++- .../packages/opentelemetry-instrumentation/package.json | 3 ++- .../packages/opentelemetry-sdk-metrics-base/package.json | 3 ++- experimental/packages/opentelemetry-sdk-node/package.json | 3 ++- experimental/packages/otlp-transformer/package.json | 3 ++- packages/opentelemetry-context-async-hooks/package.json | 3 ++- packages/opentelemetry-context-zone-peer-dep/package.json | 3 ++- packages/opentelemetry-context-zone/package.json | 3 ++- packages/opentelemetry-core/package.json | 3 ++- packages/opentelemetry-exporter-jaeger/package.json | 3 ++- packages/opentelemetry-exporter-zipkin/package.json | 3 ++- packages/opentelemetry-propagator-b3/package.json | 3 ++- packages/opentelemetry-propagator-jaeger/package.json | 3 ++- packages/opentelemetry-resources/package.json | 3 ++- packages/opentelemetry-sdk-trace-base/package.json | 3 ++- packages/opentelemetry-sdk-trace-node/package.json | 3 ++- packages/opentelemetry-sdk-trace-web/package.json | 3 ++- packages/opentelemetry-semantic-conventions/package.json | 3 ++- packages/opentelemetry-shim-opentracing/package.json | 3 ++- packages/template/package.json | 3 ++- 34 files changed, 67 insertions(+), 34 deletions(-) diff --git a/.github/workflows/peer-api.yml b/.github/workflows/peer-api.yml index a9da0333a7..415166abbe 100644 --- a/.github/workflows/peer-api.yml +++ b/.github/workflows/peer-api.yml @@ -23,4 +23,4 @@ jobs: - name: Check API dependency semantics working-directory: packages - run: lerna exec --ignore propagation-validation-server --ignore @opentelemetry/api-metrics --ignore propagation-validation-server --ignore @opentelemetry/selenium-tests \"node $(pwd)/scripts/peer-api-check.js\" + run: lerna run peer-api-check diff --git a/experimental/backwards-compatability/node10/package.json b/experimental/backwards-compatability/node10/package.json index db101a9e63..a64ec171c5 100644 --- a/experimental/backwards-compatability/node10/package.json +++ b/experimental/backwards-compatability/node10/package.json @@ -5,7 +5,8 @@ "description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK", "main": "index.js", "scripts": { - "test:backcompat": "tsc --noEmit index.ts && tsc --noEmit --esModuleInterop index.ts" + "test:backcompat": "tsc --noEmit index.ts && tsc --noEmit --esModuleInterop index.ts", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "dependencies": { "@opentelemetry/sdk-node": "0.27.0", diff --git a/experimental/backwards-compatability/node12/package.json b/experimental/backwards-compatability/node12/package.json index ed20c03d8f..6841f34928 100644 --- a/experimental/backwards-compatability/node12/package.json +++ b/experimental/backwards-compatability/node12/package.json @@ -5,7 +5,8 @@ "description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK", "main": "index.js", "scripts": { - "test:backcompat": "tsc --noEmit index.ts && tsc --noEmit --esModuleInterop index.ts" + "test:backcompat": "tsc --noEmit index.ts && tsc --noEmit --esModuleInterop index.ts", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "dependencies": { "@opentelemetry/sdk-node": "0.27.0", diff --git a/experimental/backwards-compatability/node8/package.json b/experimental/backwards-compatability/node8/package.json index 1cb27ff79c..517964a547 100644 --- a/experimental/backwards-compatability/node8/package.json +++ b/experimental/backwards-compatability/node8/package.json @@ -5,7 +5,8 @@ "description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK", "main": "index.js", "scripts": { - "test:backcompat": "tsc --noEmit index.ts && tsc --noEmit --esModuleInterop index.ts" + "test:backcompat": "tsc --noEmit index.ts && tsc --noEmit --esModuleInterop index.ts", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "dependencies": { "@opentelemetry/sdk-node": "0.27.0", diff --git a/experimental/packages/exporter-trace-otlp-grpc/package.json b/experimental/packages/exporter-trace-otlp-grpc/package.json index a36d23169f..d6157505c9 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/package.json +++ b/experimental/packages/exporter-trace-otlp-grpc/package.json @@ -19,7 +19,8 @@ "version": "node ../../../scripts/version-update.js", "watch": "npm run protos:copy && tsc -w", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/exporter-trace-otlp-http/package.json b/experimental/packages/exporter-trace-otlp-http/package.json index e73c216de2..0143cc1a29 100644 --- a/experimental/packages/exporter-trace-otlp-http/package.json +++ b/experimental/packages/exporter-trace-otlp-http/package.json @@ -27,7 +27,8 @@ "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/exporter-trace-otlp-proto/package.json b/experimental/packages/exporter-trace-otlp-proto/package.json index 0808f5ec1b..aecc95e3d4 100644 --- a/experimental/packages/exporter-trace-otlp-proto/package.json +++ b/experimental/packages/exporter-trace-otlp-proto/package.json @@ -19,7 +19,8 @@ "version": "node ../../../scripts/version-update.js", "watch": "npm run protos:copy && tsc -w", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json index 7f6ef50a76..4d9dbf326e 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json @@ -19,7 +19,8 @@ "version": "node ../../../scripts/version-update.js", "watch": "npm run protos:copy && tsc -w", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json index 46a0f3537c..8a9c8d55bf 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json @@ -27,7 +27,8 @@ "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json index bcbd44ee96..5dbf37a8a6 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json @@ -19,7 +19,8 @@ "version": "node ../../../scripts/version-update.js", "watch": "npm run protos:copy && tsc -w", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/opentelemetry-exporter-prometheus/package.json b/experimental/packages/opentelemetry-exporter-prometheus/package.json index cff0d5d9d9..c920c392a1 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/package.json +++ b/experimental/packages/opentelemetry-exporter-prometheus/package.json @@ -18,7 +18,8 @@ "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/package.json b/experimental/packages/opentelemetry-instrumentation-fetch/package.json index 7036ac724b..3a10d69c35 100644 --- a/experimental/packages/opentelemetry-instrumentation-fetch/package.json +++ b/experimental/packages/opentelemetry-instrumentation-fetch/package.json @@ -19,7 +19,8 @@ "test:browser": "nyc karma start --single-run", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "node ../../../scripts/version-update.js" + "prewatch": "node ../../../scripts/version-update.js", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "fetch", diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/package.json b/experimental/packages/opentelemetry-instrumentation-grpc/package.json index 9ea75bc0b1..c5a31705c8 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/package.json +++ b/experimental/packages/opentelemetry-instrumentation-grpc/package.json @@ -17,7 +17,8 @@ "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "node ../../../scripts/version-update.js" + "prewatch": "node ../../../scripts/version-update.js", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/opentelemetry-instrumentation-http/package.json b/experimental/packages/opentelemetry-instrumentation-http/package.json index b5cab2bbf5..461b6b2fb7 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/package.json +++ b/experimental/packages/opentelemetry-instrumentation-http/package.json @@ -17,7 +17,8 @@ "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "node ../../../scripts/version-update.js" + "prewatch": "node ../../../scripts/version-update.js", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json b/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json index 0809dbc5cf..73e5b285d2 100644 --- a/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json +++ b/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json @@ -19,7 +19,8 @@ "test:browser": "nyc karma start --single-run", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "node ../../../scripts/version-update.js" + "prewatch": "node ../../../scripts/version-update.js", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/opentelemetry-instrumentation/package.json b/experimental/packages/opentelemetry-instrumentation/package.json index e7e223aa7e..c4c879e51f 100644 --- a/experimental/packages/opentelemetry-instrumentation/package.json +++ b/experimental/packages/opentelemetry-instrumentation/package.json @@ -52,7 +52,8 @@ "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "node ../../../scripts/version-update.js" + "prewatch": "node ../../../scripts/version-update.js", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/package.json b/experimental/packages/opentelemetry-sdk-metrics-base/package.json index 58d98fcb4e..52dba98f7e 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/package.json +++ b/experimental/packages/opentelemetry-sdk-metrics-base/package.json @@ -22,7 +22,8 @@ "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "node ../../../scripts/version-update.js" + "prewatch": "node ../../../scripts/version-update.js", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/opentelemetry-sdk-node/package.json b/experimental/packages/opentelemetry-sdk-node/package.json index 177118f082..18473ec9a5 100644 --- a/experimental/packages/opentelemetry-sdk-node/package.json +++ b/experimental/packages/opentelemetry-sdk-node/package.json @@ -16,7 +16,8 @@ "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/otlp-transformer/package.json b/experimental/packages/otlp-transformer/package.json index f6c44c4dd1..ebb0937dd6 100644 --- a/experimental/packages/otlp-transformer/package.json +++ b/experimental/packages/otlp-transformer/package.json @@ -18,7 +18,8 @@ "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "test:browser": "nyc karma start --single-run", - "watch": "tsc --build -w tsconfig.all.json" + "watch": "tsc --build -w tsconfig.all.json", + "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-context-async-hooks/package.json b/packages/opentelemetry-context-async-hooks/package.json index 9614218dcb..f54f6defff 100644 --- a/packages/opentelemetry-context-async-hooks/package.json +++ b/packages/opentelemetry-context-async-hooks/package.json @@ -16,7 +16,8 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json index 10cf215252..510d75e144 100644 --- a/packages/opentelemetry-context-zone-peer-dep/package.json +++ b/packages/opentelemetry-context-zone-peer-dep/package.json @@ -19,7 +19,8 @@ "test:browser": "nyc karma start --single-run", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-context-zone/package.json b/packages/opentelemetry-context-zone/package.json index f3918bb6df..573cbac009 100644 --- a/packages/opentelemetry-context-zone/package.json +++ b/packages/opentelemetry-context-zone/package.json @@ -16,7 +16,8 @@ "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json index 0c34a3a81c..c16c8a0b80 100644 --- a/packages/opentelemetry-core/package.json +++ b/packages/opentelemetry-core/package.json @@ -29,7 +29,8 @@ "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json index 1ef6791862..b2aec917a4 100644 --- a/packages/opentelemetry-exporter-jaeger/package.json +++ b/packages/opentelemetry-exporter-jaeger/package.json @@ -17,7 +17,8 @@ "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-exporter-zipkin/package.json b/packages/opentelemetry-exporter-zipkin/package.json index 4bc7cb565b..6f40163de4 100644 --- a/packages/opentelemetry-exporter-zipkin/package.json +++ b/packages/opentelemetry-exporter-zipkin/package.json @@ -27,7 +27,8 @@ "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-propagator-b3/package.json b/packages/opentelemetry-propagator-b3/package.json index 17f6b3c940..e88c349da5 100644 --- a/packages/opentelemetry-propagator-b3/package.json +++ b/packages/opentelemetry-propagator-b3/package.json @@ -18,7 +18,8 @@ "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-propagator-jaeger/package.json b/packages/opentelemetry-propagator-jaeger/package.json index 04b548f365..ba952774d8 100644 --- a/packages/opentelemetry-propagator-jaeger/package.json +++ b/packages/opentelemetry-propagator-jaeger/package.json @@ -21,7 +21,8 @@ "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-resources/package.json b/packages/opentelemetry-resources/package.json index 4b39205af3..be6e466534 100644 --- a/packages/opentelemetry-resources/package.json +++ b/packages/opentelemetry-resources/package.json @@ -26,7 +26,8 @@ "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", "version": "node ../../scripts/version-update.js", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-sdk-trace-base/package.json b/packages/opentelemetry-sdk-trace-base/package.json index 40027b3c32..1335fec069 100644 --- a/packages/opentelemetry-sdk-trace-base/package.json +++ b/packages/opentelemetry-sdk-trace-base/package.json @@ -28,7 +28,8 @@ "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-sdk-trace-node/package.json b/packages/opentelemetry-sdk-trace-node/package.json index fa867c2810..c315ce00ab 100644 --- a/packages/opentelemetry-sdk-trace-node/package.json +++ b/packages/opentelemetry-sdk-trace-node/package.json @@ -17,7 +17,8 @@ "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-sdk-trace-web/package.json b/packages/opentelemetry-sdk-trace-web/package.json index c59caa7eb4..01f8be227f 100644 --- a/packages/opentelemetry-sdk-trace-web/package.json +++ b/packages/opentelemetry-sdk-trace-web/package.json @@ -21,7 +21,8 @@ "test:webworker": "nyc karma start karma.worker.js --single-run", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-semantic-conventions/package.json b/packages/opentelemetry-semantic-conventions/package.json index 43cbe79de1..c7cccffee8 100644 --- a/packages/opentelemetry-semantic-conventions/package.json +++ b/packages/opentelemetry-semantic-conventions/package.json @@ -18,7 +18,8 @@ "version": "node ../../scripts/version-update.js", "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-shim-opentracing/package.json b/packages/opentelemetry-shim-opentracing/package.json index d66d5cee26..80e0f391e3 100644 --- a/packages/opentelemetry-shim-opentracing/package.json +++ b/packages/opentelemetry-shim-opentracing/package.json @@ -16,7 +16,8 @@ "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "keywords": [ "opentelemetry", diff --git a/packages/template/package.json b/packages/template/package.json index 61b7c9a693..a98ea590b2 100644 --- a/packages/template/package.json +++ b/packages/template/package.json @@ -31,7 +31,8 @@ "version": "node ../../scripts/version-update.js", "clean": "tsc --build --clean", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", - "prewatch": "npm run precompile" + "prewatch": "npm run precompile", + "peer-api-check": "node ../../scripts/peer-api-check.js" }, "Add these to scripts": { "compile": "tsc --build", From 576ae7b9d80b2dfd563eb4f640258d552a6d9af9 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 15 Apr 2022 09:09:29 -0400 Subject: [PATCH 17/18] chore: use MetricAttributes in metrics --- .../opentelemetry-api-metrics/src/types/Metric.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/experimental/packages/opentelemetry-api-metrics/src/types/Metric.ts b/experimental/packages/opentelemetry-api-metrics/src/types/Metric.ts index 2db00aa481..f066c6873c 100644 --- a/experimental/packages/opentelemetry-api-metrics/src/types/Metric.ts +++ b/experimental/packages/opentelemetry-api-metrics/src/types/Metric.ts @@ -72,27 +72,27 @@ export interface Counter { /** * Increment value of counter by the input. Inputs may not be negative. */ - add(value: number, attributes?: SpanAttributes, context?: Context): void; + add(value: number, attributes?: MetricAttributes, context?: Context): void; } export interface UpDownCounter { /** * Increment value of counter by the input. Inputs may be negative. */ - add(value: number, attributes?: SpanAttributes, context?: Context): void; + add(value: number, attributes?: MetricAttributes, context?: Context): void; } export interface Histogram { /** * Records a measurement. Value of the measurement must not be negative. */ - record(value: number, attributes?: SpanAttributes, context?: Context): void; + record(value: number, attributes?: MetricAttributes, context?: Context): void; } /** * key-value pairs passed by the user. */ -export type SpanAttributes = { [key: string]: string }; +export type MetricAttributes = { [key: string]: string }; /** * The observable callback for Observable instruments. From 2ef536dd47530cbd562127f70d28ce60ce69a813 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 15 Apr 2022 09:15:05 -0400 Subject: [PATCH 18/18] chore: use MetricAttributes when appropriate --- .../opentelemetry-api-metrics/src/NoopMeter.ts | 8 ++++---- .../src/types/ObservableResult.ts | 4 ++-- .../src/PrometheusSerializer.ts | 6 +++--- .../test/PrometheusSerializer.test.ts | 8 ++++---- .../src/Instruments.ts | 8 ++++---- .../src/Measurement.ts | 4 ++-- .../src/ObservableResult.ts | 2 +- .../src/aggregator/types.ts | 4 ++-- .../AlignedHistogramBucketExemplarReservoir.ts | 6 +++--- .../src/exemplar/AlwaysSampleExemplarFilter.ts | 4 ++-- .../src/exemplar/Exemplar.ts | 4 ++-- .../src/exemplar/ExemplarFilter.ts | 6 +++--- .../src/exemplar/ExemplarReservoir.ts | 16 ++++++++-------- .../src/exemplar/NeverSampleExemplarFilter.ts | 4 ++-- .../exemplar/SimpleFixedSizeExemplarReservoir.ts | 6 +++--- .../src/exemplar/WithTraceExemplarFilter.ts | 4 ++-- .../src/export/MetricData.ts | 4 ++-- .../src/state/DeltaMetricProcessor.ts | 6 +++--- .../src/state/HashMap.ts | 4 ++-- .../src/state/MultiWritableMetricStorage.ts | 4 ++-- .../src/state/SyncMetricStorage.ts | 4 ++-- .../src/state/WritableMetricStorage.ts | 6 +++--- .../opentelemetry-sdk-metrics-base/src/utils.ts | 6 +++--- .../src/view/AttributesProcessor.ts | 10 +++++----- .../test/MeterProvider.test.ts | 2 +- .../test/state/HashMap.test.ts | 8 ++++---- .../state/MultiWritableMetricStorage.test.ts | 4 ++-- .../opentelemetry-sdk-metrics-base/test/util.ts | 6 +++--- 28 files changed, 79 insertions(+), 79 deletions(-) diff --git a/experimental/packages/opentelemetry-api-metrics/src/NoopMeter.ts b/experimental/packages/opentelemetry-api-metrics/src/NoopMeter.ts index 06741a606b..80d7b6df77 100644 --- a/experimental/packages/opentelemetry-api-metrics/src/NoopMeter.ts +++ b/experimental/packages/opentelemetry-api-metrics/src/NoopMeter.ts @@ -17,7 +17,7 @@ import { Meter } from './types/Meter'; import { MetricOptions, - SpanAttributes, + MetricAttributes, Counter, Histogram, UpDownCounter, @@ -98,15 +98,15 @@ export class NoopMeter implements Meter { export class NoopMetric {} export class NoopCounterMetric extends NoopMetric implements Counter { - add(_value: number, _attributes: SpanAttributes): void {} + add(_value: number, _attributes: MetricAttributes): void {} } export class NoopUpDownCounterMetric extends NoopMetric implements UpDownCounter { - add(_value: number, _attributes: SpanAttributes): void {} + add(_value: number, _attributes: MetricAttributes): void {} } export class NoopHistogramMetric extends NoopMetric implements Histogram { - record(_value: number, _attributes: SpanAttributes): void {} + record(_value: number, _attributes: MetricAttributes): void {} } export const NOOP_METER = new NoopMeter(); diff --git a/experimental/packages/opentelemetry-api-metrics/src/types/ObservableResult.ts b/experimental/packages/opentelemetry-api-metrics/src/types/ObservableResult.ts index 3c8fce37f9..29800212f0 100644 --- a/experimental/packages/opentelemetry-api-metrics/src/types/ObservableResult.ts +++ b/experimental/packages/opentelemetry-api-metrics/src/types/ObservableResult.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { SpanAttributes } from './Metric'; +import { MetricAttributes } from './Metric'; /** * Interface that is being used in callback function for Observable Metric @@ -28,5 +28,5 @@ export interface ObservableResult { * one values associated with the same attributes values, SDK may pick the * last one or simply drop the entire observable result. */ - observe(value: number, attributes?: SpanAttributes): void; + observe(value: number, attributes?: MetricAttributes): void; } diff --git a/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts b/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts index c079662880..391eeba0a0 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts +++ b/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts @@ -24,7 +24,7 @@ import { DataPoint, Histogram, } from '@opentelemetry/sdk-metrics-base'; -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { hrTimeToMilliseconds } from '@opentelemetry/core'; type PrometheusDataTypeLiteral = @@ -131,10 +131,10 @@ function toPrometheusType( function stringify( metricName: string, - attributes: SpanAttributes, + attributes: MetricAttributes, value: number, timestamp?: number, - additionalAttributes?: SpanAttributes + additionalAttributes?: MetricAttributes ) { let hasAttribute = false; let attributesStr = ''; diff --git a/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts b/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts index d8526f93f6..ec83b35e14 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts +++ b/experimental/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts @@ -15,7 +15,7 @@ */ import * as assert from 'assert'; -import { SpanAttributes, UpDownCounter } from '@opentelemetry/api-metrics'; +import { MetricAttributes, UpDownCounter } from '@opentelemetry/api-metrics'; import { AggregationTemporality, MeterProvider, @@ -341,7 +341,7 @@ describe('PrometheusSerializer', () => { NaN: NaN, null: null, undefined: undefined, - } as unknown) as SpanAttributes); + } as unknown) as MetricAttributes); }); assert.strictEqual( @@ -381,7 +381,7 @@ describe('PrometheusSerializer', () => { backslashN: '\u005c\u006e', // \n => \\n (\u005c\u005c\u006e) backslashDoubleQuote: '\u005c\u0022', // \" => \\\" (\u005c\u005c\u005c\u0022) backslashLineFeed: '\u005c\u000a', // \↵ => \\\n (\u005c\u005c\u005c\u006e) - } as unknown) as SpanAttributes); + } as unknown) as MetricAttributes); }); assert.strictEqual( @@ -406,7 +406,7 @@ describe('PrometheusSerializer', () => { // error while linting: text format parsing error in line 282: expected '=' after label name, found '-' counter.add(1, ({ 'account-id': '123456', - } as unknown) as SpanAttributes); + } as unknown) as MetricAttributes); }); assert.strictEqual( diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/Instruments.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/Instruments.ts index 33fbc00bda..00c6973ed6 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/Instruments.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/Instruments.ts @@ -26,7 +26,7 @@ export class SyncInstrument { return this._descriptor.name; } - protected _record(value: number, attributes: metrics.SpanAttributes = {}, context: api.Context = api.context.active()) { + protected _record(value: number, attributes: metrics.MetricAttributes = {}, context: api.Context = api.context.active()) { if (this._descriptor.valueType === metrics.ValueType.INT && !Number.isInteger(value)) { api.diag.warn( `INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.` @@ -44,7 +44,7 @@ export class UpDownCounterInstrument extends SyncInstrument implements metrics.U /** * Increment value of counter by the input. Inputs may be negative. */ - add(value: number, attributes?: metrics.SpanAttributes, ctx?: api.Context): void { + add(value: number, attributes?: metrics.MetricAttributes, ctx?: api.Context): void { this._record(value, attributes, ctx); } } @@ -56,7 +56,7 @@ export class CounterInstrument extends SyncInstrument implements metrics.Counter /** * Increment value of counter by the input. Inputs may not be negative. */ - add(value: number, attributes?: metrics.SpanAttributes, ctx?: api.Context): void { + add(value: number, attributes?: metrics.MetricAttributes, ctx?: api.Context): void { if (value < 0) { api.diag.warn(`negative value provided to counter ${this.getName()}: ${value}`); return; @@ -73,7 +73,7 @@ export class HistogramInstrument extends SyncInstrument implements metrics.Histo /** * Records a measurement. Value of the measurement must not be negative. */ - record(value: number, attributes?: metrics.SpanAttributes, ctx?: api.Context): void { + record(value: number, attributes?: metrics.MetricAttributes, ctx?: api.Context): void { this._record(value, attributes, ctx); } } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/Measurement.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/Measurement.ts index 4f444d500d..02a7f12418 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/Measurement.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/Measurement.ts @@ -15,13 +15,13 @@ */ import * as api from '@opentelemetry/api'; -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#measurement export type Measurement = { value: number; // TODO use common attributes - attributes: SpanAttributes + attributes: MetricAttributes context?: api.Context; }; diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/ObservableResult.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/ObservableResult.ts index 646cf73475..899f03b5f7 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/ObservableResult.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/ObservableResult.ts @@ -29,7 +29,7 @@ export class ObservableResult implements metrics.ObservableResult { /** * Observe a measurement of the value associated with the given attributes. */ - observe(value: number, attributes: metrics.SpanAttributes = {}): void { + observe(value: number, attributes: metrics.MetricAttributes = {}): void { this.buffer.set(attributes, value); } } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/types.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/types.ts index 48f2b28cd8..7c972070ba 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/types.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/aggregator/types.ts @@ -15,7 +15,7 @@ */ import { HrTime } from '@opentelemetry/api'; -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { MetricData } from '../export/MetricData'; import { InstrumentDescriptor } from '../InstrumentDescriptor'; import { Maybe } from '../utils'; @@ -67,7 +67,7 @@ export interface Accumulation { record(value: number): void; } -export type AccumulationRecord = [SpanAttributes, T]; +export type AccumulationRecord = [MetricAttributes, T]; /** * Base interface for aggregators. Aggregators are responsible for holding diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlignedHistogramBucketExemplarReservoir.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlignedHistogramBucketExemplarReservoir.ts index fa64ce8360..96060d16ae 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlignedHistogramBucketExemplarReservoir.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlignedHistogramBucketExemplarReservoir.ts @@ -16,7 +16,7 @@ import { Context, HrTime } from '@opentelemetry/api'; -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { FixedSizeExemplarReservoirBase } from './ExemplarReservoir'; @@ -32,7 +32,7 @@ export class AlignedHistogramBucketExemplarReservoir extends FixedSizeExemplarRe this._boundaries = boundaries; } - private _findBucketIndex(value: number, _timestamp: HrTime, _attributes: SpanAttributes, _ctx: Context) { + private _findBucketIndex(value: number, _timestamp: HrTime, _attributes: MetricAttributes, _ctx: Context) { for(let i = 0; i < this._boundaries.length; i++) { if (value <= this._boundaries[i]) { return i; @@ -41,7 +41,7 @@ export class AlignedHistogramBucketExemplarReservoir extends FixedSizeExemplarRe return this._boundaries.length; } - offer(value: number, timestamp: HrTime, attributes: SpanAttributes, ctx: Context): void { + offer(value: number, timestamp: HrTime, attributes: MetricAttributes, ctx: Context): void { const index = this._findBucketIndex(value, timestamp, attributes, ctx); this._reservoirStorage[index].offer(value, timestamp, attributes, ctx); } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlwaysSampleExemplarFilter.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlwaysSampleExemplarFilter.ts index dc5ee7f670..83859dd326 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlwaysSampleExemplarFilter.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/AlwaysSampleExemplarFilter.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { Context, HrTime } from '@opentelemetry/api'; import { ExemplarFilter } from './ExemplarFilter'; @@ -24,7 +24,7 @@ export class AlwaysSampleExemplarFilter implements ExemplarFilter { shouldSample( _value: number, _timestamp: HrTime, - _attributes: SpanAttributes, + _attributes: MetricAttributes, _ctx: Context ): boolean { return true; diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/Exemplar.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/Exemplar.ts index 3a7d3da4f2..28628ff04f 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/Exemplar.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/Exemplar.ts @@ -15,7 +15,7 @@ */ import { HrTime } from '@opentelemetry/api'; -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; /** * A representation of an exemplar, which is a sample input measurement. @@ -27,7 +27,7 @@ export type Exemplar = { // The set of key/value pairs that were filtered out by the aggregator, but // recorded alongside the original measurement. Only key/value pairs that were // filtered out by the aggregator should be included - filteredAttributes: SpanAttributes; + filteredAttributes: MetricAttributes; // The value of the measurement that was recorded. value: number; diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarFilter.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarFilter.ts index b7e46fbcd8..956025f253 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarFilter.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarFilter.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { Context, HrTime } from '@opentelemetry/api'; /** @@ -28,13 +28,13 @@ export interface ExemplarFilter { * * @param value The value of the measurement * @param timestamp A timestamp that best represents when the measurement was taken - * @param attributes The complete set of SpanAttributes of the measurement + * @param attributes The complete set of MetricAttributes of the measurement * @param context The Context of the measurement */ shouldSample( value: number, timestamp: HrTime, - attributes: SpanAttributes, + attributes: MetricAttributes, ctx: Context ): boolean; } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarReservoir.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarReservoir.ts index 9cf47df052..6d1245d33b 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarReservoir.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/ExemplarReservoir.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { Context, HrTime, isSpanContextValid, trace } from '@opentelemetry/api'; import { Exemplar } from './Exemplar'; @@ -28,7 +28,7 @@ export interface ExemplarReservoir { offer( value: number, timestamp: HrTime, - attributes: SpanAttributes, + attributes: MetricAttributes, ctx: Context ): void; /** @@ -40,19 +40,19 @@ export interface ExemplarReservoir { * @returns a list of {@link Exemplar}s. Retuned exemplars contain the attributes that were filtered out by the * aggregator, but recorded alongside the original measurement. */ - collect(pointAttributes: SpanAttributes): Exemplar[]; + collect(pointAttributes: MetricAttributes): Exemplar[]; } class ExemplarBucket { private value: number = 0; - private attributes: SpanAttributes = {}; + private attributes: MetricAttributes = {}; private timestamp: HrTime = [0, 0]; private spanId?: string; private traceId?: string; private _offered: boolean = false; - offer(value: number, timestamp: HrTime, attributes: SpanAttributes, ctx: Context) { + offer(value: number, timestamp: HrTime, attributes: MetricAttributes, ctx: Context) { this.value = value; this.timestamp = timestamp; this.attributes = attributes; @@ -64,7 +64,7 @@ class ExemplarBucket { this._offered = true; } - collect(pointAttributes: SpanAttributes): Exemplar | null { + collect(pointAttributes: MetricAttributes): Exemplar | null { if (!this._offered) return null; const currentAttributes = this.attributes; // filter attributes @@ -103,7 +103,7 @@ export abstract class FixedSizeExemplarReservoirBase implements ExemplarReservoi } } - abstract offer(value: number, timestamp: HrTime, attributes: SpanAttributes, ctx: Context): void; + abstract offer(value: number, timestamp: HrTime, attributes: MetricAttributes, ctx: Context): void; maxSize(): number { return this._size; @@ -114,7 +114,7 @@ export abstract class FixedSizeExemplarReservoirBase implements ExemplarReservoi */ protected reset(): void {} - collect(pointAttributes: SpanAttributes): Exemplar[] { + collect(pointAttributes: MetricAttributes): Exemplar[] { const exemplars: Exemplar[] = []; this._reservoirStorage.forEach(storageItem => { const res = storageItem.collect(pointAttributes); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/NeverSampleExemplarFilter.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/NeverSampleExemplarFilter.ts index 72b60dab5d..1f40143f1f 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/NeverSampleExemplarFilter.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/NeverSampleExemplarFilter.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { Context, HrTime } from '@opentelemetry/api'; import { ExemplarFilter } from './ExemplarFilter'; @@ -23,7 +23,7 @@ export class NeverSampleExemplarFilter implements ExemplarFilter { shouldSample( _value: number, _timestamp: HrTime, - _attributes: SpanAttributes, + _attributes: MetricAttributes, _ctx: Context ): boolean { return false; diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/SimpleFixedSizeExemplarReservoir.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/SimpleFixedSizeExemplarReservoir.ts index d1ad8637ea..31b0369d87 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/SimpleFixedSizeExemplarReservoir.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/SimpleFixedSizeExemplarReservoir.ts @@ -15,7 +15,7 @@ */ import { Context, HrTime } from '@opentelemetry/api'; -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { FixedSizeExemplarReservoirBase } from './ExemplarReservoir'; /** @@ -34,13 +34,13 @@ export class SimpleFixedSizeExemplarReservoir extends FixedSizeExemplarReservoir return Math.floor(Math.random() * (max - min) + min); } - private _findBucketIndex(_value: number, _timestamp: HrTime, _attributes: SpanAttributes, _ctx: Context) { + private _findBucketIndex(_value: number, _timestamp: HrTime, _attributes: MetricAttributes, _ctx: Context) { if (this._numMeasurementsSeen < this._size ) return this._numMeasurementsSeen++; const index = this.getRandomInt(0, ++this._numMeasurementsSeen); return index < this._size ? index: -1; } - offer(value: number, timestamp: HrTime, attributes: SpanAttributes, ctx: Context): void { + offer(value: number, timestamp: HrTime, attributes: MetricAttributes, ctx: Context): void { const index = this._findBucketIndex(value, timestamp, attributes, ctx); if (index !== -1) { this._reservoirStorage[index].offer(value, timestamp, attributes, ctx); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/WithTraceExemplarFilter.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/WithTraceExemplarFilter.ts index a18f6fb8a7..1ca0439c0d 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/WithTraceExemplarFilter.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/exemplar/WithTraceExemplarFilter.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { Context, HrTime, isSpanContextValid, trace, TraceFlags } from '@opentelemetry/api'; import { ExemplarFilter } from './ExemplarFilter'; @@ -23,7 +23,7 @@ export class WithTraceExemplarFilter implements ExemplarFilter { shouldSample( value: number, timestamp: HrTime, - attributes: SpanAttributes, + attributes: MetricAttributes, ctx: Context ): boolean { const spanContext = trace.getSpanContext(ctx); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/export/MetricData.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/export/MetricData.ts index d991541135..620039cc23 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/export/MetricData.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/export/MetricData.ts @@ -15,7 +15,7 @@ */ import { HrTime } from '@opentelemetry/api'; -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { InstrumentationLibrary } from '@opentelemetry/core'; import { Resource } from '@opentelemetry/resources'; import { InstrumentDescriptor } from '../InstrumentDescriptor'; @@ -92,7 +92,7 @@ export interface DataPoint { /** * The attributes associated with this DataPoint. */ - readonly attributes: SpanAttributes; + readonly attributes: MetricAttributes; /** * The value for this DataPoint. */ diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/DeltaMetricProcessor.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/DeltaMetricProcessor.ts index 643af9ca0d..8ce7d641b3 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/DeltaMetricProcessor.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/DeltaMetricProcessor.ts @@ -15,7 +15,7 @@ */ import { Context } from '@opentelemetry/api'; -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { Maybe } from '../utils'; import { Accumulation, Aggregator } from '../aggregator/types'; import { AttributeHashMap } from './HashMap'; @@ -36,11 +36,11 @@ export class DeltaMetricProcessor> { constructor(private _aggregator: Aggregator) {} /** Bind an efficient storage handle for a set of attributes. */ - private bind(attributes: SpanAttributes) { + private bind(attributes: MetricAttributes) { return this._activeCollectionStorage.getOrDefault(attributes, () => this._aggregator.createAccumulation()); } - record(value: number, attributes: SpanAttributes, _context: Context) { + record(value: number, attributes: MetricAttributes, _context: Context) { const accumulation = this.bind(attributes); accumulation?.record(value); } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/HashMap.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/HashMap.ts index c652f8aa23..b48551feab 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/HashMap.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/HashMap.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { hashAttributes } from '../utils'; export interface Hash { @@ -74,7 +74,7 @@ export class HashMap { } } -export class AttributeHashMap extends HashMap { +export class AttributeHashMap extends HashMap { constructor() { super(hashAttributes); } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/MultiWritableMetricStorage.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/MultiWritableMetricStorage.ts index 4d7798fcc8..e5f31e378e 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/MultiWritableMetricStorage.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/MultiWritableMetricStorage.ts @@ -15,7 +15,7 @@ */ import { Context } from '@opentelemetry/api'; -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { WritableMetricStorage } from './WritableMetricStorage'; /** @@ -24,7 +24,7 @@ import { WritableMetricStorage } from './WritableMetricStorage'; export class MultiMetricStorage implements WritableMetricStorage { constructor(private readonly _backingStorages: WritableMetricStorage[]) {} - record(value: number, attributes: SpanAttributes, context: Context) { + record(value: number, attributes: MetricAttributes, context: Context) { this._backingStorages.forEach(it => { it.record(value, attributes, context); }); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/SyncMetricStorage.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/SyncMetricStorage.ts index 27ee3456b9..db9e029307 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/SyncMetricStorage.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/SyncMetricStorage.ts @@ -15,7 +15,7 @@ */ import { Context, HrTime } from '@opentelemetry/api'; -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { WritableMetricStorage } from './WritableMetricStorage'; import { Accumulation, Aggregator } from '../aggregator/types'; import { View } from '../view/View'; @@ -50,7 +50,7 @@ export class SyncMetricStorage> extends MetricStor this._temporalMetricStorage = new TemporalMetricProcessor(aggregator); } - record(value: number, attributes: SpanAttributes, context: Context) { + record(value: number, attributes: MetricAttributes, context: Context) { attributes = this._attributesProcessor.process(attributes, context); this._deltaMetricStorage.record(value, attributes, context); } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/WritableMetricStorage.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/WritableMetricStorage.ts index cd94e86864..452ae9b704 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/state/WritableMetricStorage.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/state/WritableMetricStorage.ts @@ -15,7 +15,7 @@ */ import { Context } from '@opentelemetry/api'; -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; /** * Internal interface. @@ -24,9 +24,9 @@ import { SpanAttributes } from '@opentelemetry/api-metrics'; */ export interface WritableMetricStorage { /** Records a measurement. */ - record(value: number, attributes: SpanAttributes, context: Context): void; + record(value: number, attributes: MetricAttributes, context: Context): void; } export class NoopWritableMetricStorage implements WritableMetricStorage { - record(_value: number, _attributes: SpanAttributes, _context: Context): void {} + record(_value: number, _attributes: MetricAttributes, _context: Context): void {} } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/utils.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/utils.ts index 50eec061f3..96475d3be5 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/utils.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/utils.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; export type Maybe = T | undefined; @@ -24,9 +24,9 @@ export function isNotNullish(item: Maybe): item is T { /** * Converting the unordered attributes into unique identifier string. - * @param attributes user provided unordered SpanAttributes. + * @param attributes user provided unordered MetricAttributes. */ -export function hashAttributes(attributes: SpanAttributes): string { +export function hashAttributes(attributes: MetricAttributes): string { let keys = Object.keys(attributes); if (keys.length === 0) return ''; diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/src/view/AttributesProcessor.ts b/experimental/packages/opentelemetry-sdk-metrics-base/src/view/AttributesProcessor.ts index cca9c8fa80..9900daf82f 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/src/view/AttributesProcessor.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/src/view/AttributesProcessor.ts @@ -15,7 +15,7 @@ */ import { Context } from '@opentelemetry/api'; -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; /** * The {@link AttributesProcessor} is responsible for customizing which @@ -30,7 +30,7 @@ export abstract class AttributesProcessor { * @param context The active context when the instrument is synchronous. * `undefined` otherwise. */ - abstract process(incoming: SpanAttributes, context?: Context): SpanAttributes; + abstract process(incoming: MetricAttributes, context?: Context): MetricAttributes; static Noop() { return NOOP; @@ -38,7 +38,7 @@ export abstract class AttributesProcessor { } export class NoopAttributesProcessor extends AttributesProcessor { - process(incoming: SpanAttributes, _context?: Context) { + process(incoming: MetricAttributes, _context?: Context) { return incoming; } } @@ -52,8 +52,8 @@ export class FilteringAttributesProcessor extends AttributesProcessor { super(); } - process(incoming: SpanAttributes, _context: Context): SpanAttributes { - const filteredAttributes: SpanAttributes = {}; + process(incoming: MetricAttributes, _context: Context): MetricAttributes { + const filteredAttributes: MetricAttributes = {}; Object.keys(incoming) .filter(attributeName => this._allowedAttributeNames.includes(attributeName)) .forEach(attributeName => filteredAttributes[attributeName] = incoming[attributeName]); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/MeterProvider.test.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/MeterProvider.test.ts index 779a9256b9..46d8cdff75 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/MeterProvider.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/MeterProvider.test.ts @@ -158,7 +158,7 @@ describe('MeterProvider', () => { // DataPoint matches attributes and point. assertPartialDeepStrictEqual(result?.instrumentationLibraryMetrics[0].metrics[0].dataPoints[0], { - // SpanAttributes are still there. + // MetricAttributes are still there. attributes: { attrib1: 'attrib_value1', attrib2: 'attrib_value2' diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/state/HashMap.test.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/state/HashMap.test.ts index 5068a55893..d41c24e9f4 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/state/HashMap.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/state/HashMap.test.ts @@ -15,14 +15,14 @@ */ import * as assert from 'assert'; -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import { HashMap } from '../../src/state/HashMap'; import { hashAttributes } from '../../src/utils'; describe('HashMap', () => { describe('set & get', () => { it('should get and set with attributes', () => { - const map = new HashMap(hashAttributes); + const map = new HashMap(hashAttributes); const hash = hashAttributes({ foo: 'bar' }); map.set({ foo: 'bar' }, 1); @@ -41,7 +41,7 @@ describe('HashMap', () => { describe('has', () => { it('should return if the key exists in the value map', () => { - const map = new HashMap(hashAttributes); + const map = new HashMap(hashAttributes); const hash = hashAttributes({ foo: 'bar' }); // with pinned hash code @@ -58,7 +58,7 @@ describe('HashMap', () => { describe('entries', () => { it('iterating with entries', () => { - const map = new HashMap(hashAttributes); + const map = new HashMap(hashAttributes); map.set({ foo: '1' }, 1); map.set({ foo: '2' }, 2); map.set({ foo: '3' }, 3); diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MultiWritableMetricStorage.test.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MultiWritableMetricStorage.test.ts index 5da52465cd..934863cefd 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MultiWritableMetricStorage.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/state/MultiWritableMetricStorage.test.ts @@ -15,7 +15,7 @@ */ import * as api from '@opentelemetry/api'; -import { SpanAttributes } from '@opentelemetry/api-metrics'; +import { MetricAttributes } from '@opentelemetry/api-metrics'; import * as assert from 'assert'; import { Measurement } from '../../src/Measurement'; import { MultiMetricStorage } from '../../src/state/MultiWritableMetricStorage'; @@ -37,7 +37,7 @@ describe('MultiMetricStorage', () => { it('record with multiple backing storages', () => { class TestWritableMetricStorage implements WritableMetricStorage { records: Measurement[] = []; - record(value: number, attributes: SpanAttributes, context: api.Context): void { + record(value: number, attributes: MetricAttributes, context: api.Context): void { this.records.push({ value, attributes, context }); } } diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/test/util.ts b/experimental/packages/opentelemetry-sdk-metrics-base/test/util.ts index 4c9552fd79..fde6afd95d 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/test/util.ts +++ b/experimental/packages/opentelemetry-sdk-metrics-base/test/util.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { SpanAttributes, ValueType } from '@opentelemetry/api-metrics'; +import { MetricAttributes, ValueType } from '@opentelemetry/api-metrics'; import { InstrumentationLibrary } from '@opentelemetry/core'; import { Resource } from '@opentelemetry/resources'; import * as assert from 'assert'; @@ -49,7 +49,7 @@ export const defaultInstrumentationLibrary: InstrumentationLibrary = { }; export const commonValues: number[] = [1, -1, 1.0, Infinity, -Infinity, NaN]; -export const commonAttributes: SpanAttributes[] = [{}, { 1: '1' }, { a: '2' }, new (class Foo { +export const commonAttributes: MetricAttributes[] = [{}, { 1: '1' }, { a: '2' }, new (class Foo { a = '1'; })]; @@ -86,7 +86,7 @@ export function assertMetricData( export function assertDataPoint( actual: unknown, - attributes: SpanAttributes, + attributes: MetricAttributes, point: Histogram | number, startTime?: HrTime, endTime?: HrTime,