Merge back into a single lerna monorepo (#2892)
* chore: use a single lerna monorepo * chore: release API dependencies * chore: fix selenium exporter * chore: support old API versions * chore: update changelog * chore: remove peer api check * chore: changelog * chore: fix cache keys and paths * chore: fix lint cache * ci: install when cache misses * chore: apply cache fix to webworker and web * chore: apply cache fix to lint * chore: revert peer api check removal * chore: match peer and dev dependency versions for API * chore: send full string to lerna exec * chore: use npm script for peer api check * chore: use MetricAttributes in metrics * chore: use MetricAttributes when appropriate Co-authored-by: Valentin Marchaud <contact@vmarchaud.fr>
This commit is contained in:
parent
7086d5aa71
commit
ed2f033815
|
@ -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,25 @@ 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
|
||||
package-lock.json
|
||||
packages/*/node_modules
|
||||
packages/*/package-lock.json
|
||||
experimental/packages/*/node_modules
|
||||
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'
|
||||
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
|
||||
|
|
|
@ -1,30 +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"
|
||||
|
||||
- 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"
|
|
@ -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 run peer-api-check
|
|
@ -6,7 +6,7 @@ on:
|
|||
pull_request:
|
||||
|
||||
jobs:
|
||||
node-tests-stable:
|
||||
node-tests:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
@ -28,11 +28,14 @@ jobs:
|
|||
with:
|
||||
path: |
|
||||
node_modules
|
||||
*/*/node_modules
|
||||
key: node-tests-stable-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}
|
||||
package-lock.json
|
||||
packages/*/node_modules
|
||||
packages/*/package-lock.json
|
||||
experimental/packages/*/node_modules
|
||||
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
|
||||
|
@ -46,7 +49,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,16 +62,19 @@ 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') }}
|
||||
package-lock.json
|
||||
packages/*/node_modules
|
||||
packages/*/package-lock.json
|
||||
experimental/packages/*/node_modules
|
||||
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
|
||||
|
@ -83,7 +89,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,16 +102,19 @@ 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') }}
|
||||
package-lock.json
|
||||
packages/*/node_modules
|
||||
packages/*/package-lock.json
|
||||
experimental/packages/*/node_modules
|
||||
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'
|
||||
|
@ -120,129 +129,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
|
||||
|
|
|
@ -10,15 +10,18 @@ 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
|
||||
* 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
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
"index.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-sdk-trace-base"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/opentelemetry-sdk-node"
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
"index.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-sdk-trace-base"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/opentelemetry-sdk-node"
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
"index.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-sdk-trace-base"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/opentelemetry-sdk-node"
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"version": "0.27.0",
|
||||
"npmClient": "npm",
|
||||
"packages": [
|
||||
"packages/*",
|
||||
"backwards-compatability/*"
|
||||
]
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../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",
|
||||
|
@ -49,7 +50,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 +65,7 @@
|
|||
"typescript": "4.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.1.0"
|
||||
"@opentelemetry/api": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/core": "1.1.1",
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
@ -62,7 +63,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 +90,7 @@
|
|||
"webpack-merge": "5.8.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.1.0"
|
||||
"@opentelemetry/api": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/core": "1.1.1",
|
||||
|
|
|
@ -7,5 +7,16 @@
|
|||
"include": [
|
||||
"src/**/*.ts",
|
||||
"test/**/*.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-core"
|
||||
},
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-resources"
|
||||
},
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-sdk-trace-base"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
@ -49,7 +50,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 +65,7 @@
|
|||
"typescript": "4.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.1.0"
|
||||
"@opentelemetry/api": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/core": "1.1.1",
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
import { Meter } from './types/Meter';
|
||||
import {
|
||||
MetricOptions,
|
||||
Attributes,
|
||||
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: Attributes): void {}
|
||||
add(_value: number, _attributes: MetricAttributes): void {}
|
||||
}
|
||||
|
||||
export class NoopUpDownCounterMetric extends NoopMetric implements UpDownCounter {
|
||||
add(_value: number, _attributes: Attributes): void {}
|
||||
add(_value: number, _attributes: MetricAttributes): void {}
|
||||
}
|
||||
|
||||
export class NoopHistogramMetric extends NoopMetric implements Histogram {
|
||||
record(_value: number, _attributes: Attributes): void {}
|
||||
record(_value: number, _attributes: MetricAttributes): void {}
|
||||
}
|
||||
|
||||
export const NOOP_METER = new NoopMeter();
|
||||
|
|
|
@ -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?: MetricAttributes, 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?: MetricAttributes, 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?: MetricAttributes, context?: Context): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* key-value pairs passed by the user.
|
||||
*/
|
||||
export type Attributes = { [key: string]: string };
|
||||
export type MetricAttributes = { [key: string]: string };
|
||||
|
||||
/**
|
||||
* The observable callback for Observable instruments.
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Attributes } 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?: Attributes): void;
|
||||
observe(value: number, attributes?: MetricAttributes): void;
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
@ -49,7 +50,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 +66,7 @@
|
|||
"typescript": "4.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.1.0"
|
||||
"@opentelemetry/api": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@grpc/grpc-js": "^1.5.9",
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
"test/**/*.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-core"
|
||||
},
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-resources"
|
||||
},
|
||||
{
|
||||
"path": "../exporter-trace-otlp-grpc"
|
||||
},
|
||||
|
|
|
@ -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",
|
||||
|
@ -62,7 +63,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 +90,7 @@
|
|||
"webpack-merge": "5.8.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.1.0"
|
||||
"@opentelemetry/api": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/api-metrics": "0.27.0",
|
||||
|
|
|
@ -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) };
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
"test/**/*.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-core"
|
||||
},
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-resources"
|
||||
},
|
||||
{
|
||||
"path": "../exporter-trace-otlp-http"
|
||||
},
|
||||
|
|
|
@ -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",
|
||||
|
@ -49,7 +50,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 +66,7 @@
|
|||
"typescript": "4.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.1.0"
|
||||
"@opentelemetry/api": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@grpc/proto-loader": "0.6.9",
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
"test/**/*.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-core"
|
||||
},
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-resources"
|
||||
},
|
||||
{
|
||||
"path": "../exporter-trace-otlp-http"
|
||||
},
|
||||
|
|
|
@ -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",
|
||||
|
@ -43,7 +44,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 +57,7 @@
|
|||
"typescript": "4.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.0.3"
|
||||
"@opentelemetry/api": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/api-metrics": "0.27.0",
|
||||
|
|
|
@ -24,7 +24,7 @@ import {
|
|||
DataPoint,
|
||||
Histogram,
|
||||
} from '@opentelemetry/sdk-metrics-base';
|
||||
import { Attributes } 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: Attributes,
|
||||
attributes: MetricAttributes,
|
||||
value: number,
|
||||
timestamp?: number,
|
||||
additionalAttributes?: Attributes
|
||||
additionalAttributes?: MetricAttributes
|
||||
) {
|
||||
let hasAttribute = false;
|
||||
let attributesStr = '';
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { Attributes, 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 Attributes);
|
||||
} 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 Attributes);
|
||||
} 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 Attributes);
|
||||
} as unknown) as MetricAttributes);
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
"test/**/*.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-core"
|
||||
},
|
||||
{
|
||||
"path": "../opentelemetry-api-metrics"
|
||||
},
|
||||
|
|
|
@ -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",
|
||||
|
@ -54,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/sdk-trace-base": "1.1.1",
|
||||
|
@ -83,7 +84,7 @@
|
|||
"webpack-merge": "5.8.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.1.0"
|
||||
"@opentelemetry/api": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/core": "1.1.1",
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
@ -46,7 +47,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 +68,7 @@
|
|||
"typescript": "4.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.1.0"
|
||||
"@opentelemetry/api": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/api-metrics": "0.27.0",
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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",
|
||||
|
@ -44,7 +45,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 +71,7 @@
|
|||
"typescript": "4.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.1.0"
|
||||
"@opentelemetry/api": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/core": "1.1.1",
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
@ -54,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/sdk-trace-base": "1.1.1",
|
||||
|
@ -83,7 +84,7 @@
|
|||
"webpack-merge": "5.8.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.1.0"
|
||||
"@opentelemetry/api": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/core": "1.1.1",
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
@ -73,11 +74,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",
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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",
|
||||
|
@ -54,7 +55,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 +75,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": {
|
||||
|
|
|
@ -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.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.Attributes, 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.Attributes, 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.Attributes, ctx?: api.Context): void {
|
||||
record(value: number, attributes?: metrics.MetricAttributes, ctx?: api.Context): void {
|
||||
this._record(value, attributes, ctx);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,13 +15,13 @@
|
|||
*/
|
||||
|
||||
import * as api from '@opentelemetry/api';
|
||||
import { Attributes } 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: Attributes
|
||||
attributes: MetricAttributes
|
||||
context?: api.Context;
|
||||
};
|
||||
|
|
|
@ -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.MetricAttributes = {}): void {
|
||||
this.buffer.set(attributes, value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { HrTime } from '@opentelemetry/api';
|
||||
import { Attributes } 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<T> = [Attributes, T];
|
||||
export type AccumulationRecord<T> = [MetricAttributes, T];
|
||||
|
||||
/**
|
||||
* Base interface for aggregators. Aggregators are responsible for holding
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
|
||||
import { Context, HrTime } from '@opentelemetry/api';
|
||||
import { Attributes } 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: Attributes, _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: Attributes, 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);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Attributes } 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: Attributes,
|
||||
_attributes: MetricAttributes,
|
||||
_ctx: Context
|
||||
): boolean {
|
||||
return true;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { HrTime } from '@opentelemetry/api';
|
||||
import { Attributes } 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: Attributes;
|
||||
filteredAttributes: MetricAttributes;
|
||||
|
||||
// The value of the measurement that was recorded.
|
||||
value: number;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Attributes } 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 Attributes 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: Attributes,
|
||||
attributes: MetricAttributes,
|
||||
ctx: Context
|
||||
): boolean;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Attributes } 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: Attributes,
|
||||
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: Attributes): Exemplar[];
|
||||
collect(pointAttributes: MetricAttributes): Exemplar[];
|
||||
}
|
||||
|
||||
|
||||
class ExemplarBucket {
|
||||
private value: number = 0;
|
||||
private attributes: Attributes = {};
|
||||
private attributes: MetricAttributes = {};
|
||||
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: MetricAttributes, 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: 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: Attributes, 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: Attributes): Exemplar[] {
|
||||
collect(pointAttributes: MetricAttributes): Exemplar[] {
|
||||
const exemplars: Exemplar[] = [];
|
||||
this._reservoirStorage.forEach(storageItem => {
|
||||
const res = storageItem.collect(pointAttributes);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Attributes } 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: Attributes,
|
||||
_attributes: MetricAttributes,
|
||||
_ctx: Context
|
||||
): boolean {
|
||||
return false;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { Context, HrTime } from '@opentelemetry/api';
|
||||
import { Attributes } 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: Attributes, _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: Attributes, 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);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Attributes } 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: Attributes,
|
||||
attributes: MetricAttributes,
|
||||
ctx: Context
|
||||
): boolean {
|
||||
const spanContext = trace.getSpanContext(ctx);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { HrTime } from '@opentelemetry/api';
|
||||
import { Attributes } 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<T> {
|
|||
/**
|
||||
* The attributes associated with this DataPoint.
|
||||
*/
|
||||
readonly attributes: Attributes;
|
||||
readonly attributes: MetricAttributes;
|
||||
/**
|
||||
* The value for this DataPoint.
|
||||
*/
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { Context } from '@opentelemetry/api';
|
||||
import { Attributes } 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<T extends Maybe<Accumulation>> {
|
|||
constructor(private _aggregator: Aggregator<T>) {}
|
||||
|
||||
/** Bind an efficient storage handle for a set of attributes. */
|
||||
private bind(attributes: Attributes) {
|
||||
private bind(attributes: MetricAttributes) {
|
||||
return this._activeCollectionStorage.getOrDefault(attributes, () => this._aggregator.createAccumulation());
|
||||
}
|
||||
|
||||
record(value: number, attributes: Attributes, _context: Context) {
|
||||
record(value: number, attributes: MetricAttributes, _context: Context) {
|
||||
const accumulation = this.bind(attributes);
|
||||
accumulation?.record(value);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Attributes } from '@opentelemetry/api-metrics';
|
||||
import { MetricAttributes } from '@opentelemetry/api-metrics';
|
||||
import { hashAttributes } from '../utils';
|
||||
|
||||
export interface Hash<ValueType, HashCodeType> {
|
||||
|
@ -74,7 +74,7 @@ export class HashMap<KeyType, ValueType, HashCodeType> {
|
|||
}
|
||||
}
|
||||
|
||||
export class AttributeHashMap<ValueType> extends HashMap<Attributes, ValueType, string> {
|
||||
export class AttributeHashMap<ValueType> extends HashMap<MetricAttributes, ValueType, string> {
|
||||
constructor() {
|
||||
super(hashAttributes);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { Context } from '@opentelemetry/api';
|
||||
import { Attributes } 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: Attributes, context: Context) {
|
||||
record(value: number, attributes: MetricAttributes, context: Context) {
|
||||
this._backingStorages.forEach(it => {
|
||||
it.record(value, attributes, context);
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { Context, HrTime } from '@opentelemetry/api';
|
||||
import { Attributes } 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<T extends Maybe<Accumulation>> extends MetricStor
|
|||
this._temporalMetricStorage = new TemporalMetricProcessor(aggregator);
|
||||
}
|
||||
|
||||
record(value: number, attributes: Attributes, context: Context) {
|
||||
record(value: number, attributes: MetricAttributes, context: Context) {
|
||||
attributes = this._attributesProcessor.process(attributes, context);
|
||||
this._deltaMetricStorage.record(value, attributes, context);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { Context } from '@opentelemetry/api';
|
||||
import { Attributes } from '@opentelemetry/api-metrics';
|
||||
import { MetricAttributes } 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: MetricAttributes, context: Context): void;
|
||||
}
|
||||
|
||||
export class NoopWritableMetricStorage implements WritableMetricStorage {
|
||||
record(_value: number, _attributes: Attributes, _context: Context): void {}
|
||||
record(_value: number, _attributes: MetricAttributes, _context: Context): void {}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Attributes } from '@opentelemetry/api-metrics';
|
||||
import { MetricAttributes } from '@opentelemetry/api-metrics';
|
||||
|
||||
export type Maybe<T> = T | undefined;
|
||||
|
||||
|
@ -24,9 +24,9 @@ export function isNotNullish<T>(item: Maybe<T>): item is T {
|
|||
|
||||
/**
|
||||
* Converting the unordered attributes into unique identifier string.
|
||||
* @param attributes user provided unordered Attributes.
|
||||
* @param attributes user provided unordered MetricAttributes.
|
||||
*/
|
||||
export function hashAttributes(attributes: Attributes): string {
|
||||
export function hashAttributes(attributes: MetricAttributes): string {
|
||||
let keys = Object.keys(attributes);
|
||||
if (keys.length === 0) return '';
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { Context } from '@opentelemetry/api';
|
||||
import { Attributes } 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: Attributes, context?: Context): Attributes;
|
||||
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: Attributes, _context?: Context) {
|
||||
process(incoming: MetricAttributes, _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: MetricAttributes, _context: Context): MetricAttributes {
|
||||
const filteredAttributes: MetricAttributes = {};
|
||||
Object.keys(incoming)
|
||||
.filter(attributeName => this._allowedAttributeNames.includes(attributeName))
|
||||
.forEach(attributeName => filteredAttributes[attributeName] = incoming[attributeName]);
|
||||
|
|
|
@ -163,7 +163,7 @@ describe('MeterProvider', () => {
|
|||
|
||||
// DataPoint matches attributes and point.
|
||||
assertPartialDeepStrictEqual(result?.instrumentationLibraryMetrics[0].metrics[0].dataPoints[0], {
|
||||
// Attributes are still there.
|
||||
// MetricAttributes are still there.
|
||||
attributes: {
|
||||
attrib1: 'attrib_value1',
|
||||
attrib2: 'attrib_value2'
|
||||
|
|
|
@ -15,14 +15,14 @@
|
|||
*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { Attributes } 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<Attributes, number, string>(hashAttributes);
|
||||
const map = new HashMap<MetricAttributes, number, string>(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<Attributes, number, string>(hashAttributes);
|
||||
const map = new HashMap<MetricAttributes, number, string>(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<Attributes, number, string>(hashAttributes);
|
||||
const map = new HashMap<MetricAttributes, number, string>(hashAttributes);
|
||||
map.set({ foo: '1' }, 1);
|
||||
map.set({ foo: '2' }, 2);
|
||||
map.set({ foo: '3' }, 3);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import * as api from '@opentelemetry/api';
|
||||
import { Attributes } 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: Attributes, context: api.Context): void {
|
||||
record(value: number, attributes: MetricAttributes, context: api.Context): void {
|
||||
this.records.push({ value, attributes, context });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Attributes, 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: Attributes[] = [{}, { 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: Attributes,
|
||||
attributes: MetricAttributes,
|
||||
point: Histogram | number,
|
||||
startTime?: HrTime,
|
||||
endTime?: HrTime,
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
"test/**/*.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-core"
|
||||
},
|
||||
{
|
||||
"path": "../../../packages/opentelemetry-resources"
|
||||
},
|
||||
{
|
||||
"path": "../opentelemetry-api-metrics"
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
@ -54,10 +55,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 <1.2.0",
|
||||
"@opentelemetry/context-async-hooks": "1.1.0",
|
||||
"@types/mocha": "8.2.3",
|
||||
"@types/node": "14.17.33",
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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",
|
||||
|
@ -42,11 +43,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 <1.2.0",
|
||||
"@opentelemetry/api-metrics": "~0.27.0",
|
||||
"@types/mocha": "8.2.3",
|
||||
"@types/webpack-env": "1.16.3",
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -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",
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
{
|
||||
"version": "1.1.1",
|
||||
"version": "independent",
|
||||
"npmClient": "npm",
|
||||
"packages": [
|
||||
"packages/*",
|
||||
"experimental/packages/*",
|
||||
"experimental/backwards-compatability/*",
|
||||
"integration-tests/*",
|
||||
"selenium-tests"
|
||||
]
|
||||
|
|
|
@ -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",
|
||||
|
@ -43,7 +44,7 @@
|
|||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@opentelemetry/api": "~1.1.0",
|
||||
"@opentelemetry/api": ">=1.0.0 <1.2.0",
|
||||
"@types/mocha": "8.2.3",
|
||||
"@types/node": "14.17.33",
|
||||
"codecov": "3.8.3",
|
||||
|
|
|
@ -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",
|
||||
|
@ -53,7 +54,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.16.0",
|
||||
"@opentelemetry/api": "~1.1.0",
|
||||
"@opentelemetry/api": ">=1.0.0 <1.2.0",
|
||||
"@types/mocha": "8.2.3",
|
||||
"@types/node": "14.17.33",
|
||||
"@types/sinon": "10.0.6",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
@ -63,7 +64,7 @@
|
|||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@opentelemetry/api": "~1.1.0",
|
||||
"@opentelemetry/api": ">=1.0.0 <1.2.0",
|
||||
"@types/mocha": "8.2.3",
|
||||
"@types/node": "14.17.33",
|
||||
"@types/sinon": "10.0.6",
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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",
|
||||
|
@ -43,7 +44,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 +59,7 @@
|
|||
"typescript": "4.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.0.3"
|
||||
"@opentelemetry/api": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/core": "1.1.1",
|
||||
|
|
|
@ -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",
|
||||
|
@ -60,7 +61,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 +88,7 @@
|
|||
"webpack-merge": "5.8.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.0.3"
|
||||
"@opentelemetry/api": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/core": "1.1.1",
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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",
|
||||
|
@ -56,7 +57,7 @@
|
|||
"@opentelemetry/api": ">=1.0.0 <1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@opentelemetry/api": "~1.1.0",
|
||||
"@opentelemetry/api": ">=1.0.0 <1.2.0",
|
||||
"@types/mocha": "8.2.3",
|
||||
"@types/node": "14.17.33",
|
||||
"codecov": "3.8.3",
|
||||
|
|
|
@ -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",
|
||||
|
@ -53,7 +54,7 @@
|
|||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@opentelemetry/api": "~1.1.0",
|
||||
"@opentelemetry/api": ">=1.0.0 <1.2.0",
|
||||
"@types/mocha": "8.2.3",
|
||||
"@types/node": "14.17.33",
|
||||
"@types/sinon": "10.0.6",
|
||||
|
|
|
@ -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",
|
||||
|
@ -58,7 +59,7 @@
|
|||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@opentelemetry/api": "~1.1.0",
|
||||
"@opentelemetry/api": ">=1.0.0 <1.2.0",
|
||||
"@types/mocha": "8.2.3",
|
||||
"@types/node": "14.17.33",
|
||||
"@types/sinon": "10.0.6",
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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",
|
||||
|
@ -61,7 +62,7 @@
|
|||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@opentelemetry/api": "~1.1.0",
|
||||
"@opentelemetry/api": ">=1.0.0 <1.2.0",
|
||||
"@types/mocha": "8.2.3",
|
||||
"@types/node": "14.17.33",
|
||||
"@types/sinon": "10.0.6",
|
||||
|
@ -84,7 +85,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",
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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",
|
||||
|
@ -44,7 +45,7 @@
|
|||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@opentelemetry/api": "~1.1.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",
|
||||
|
@ -60,7 +61,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",
|
||||
|
|
|
@ -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",
|
||||
|
@ -55,7 +56,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.16.0",
|
||||
"@opentelemetry/api": "~1.1.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",
|
||||
|
@ -87,7 +88,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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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',
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue