From 96465c535ab166148294e057f84eb76491691622 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 20 Apr 2022 05:45:27 -0400 Subject: [PATCH 1/6] chore: add coverage scripts to experimental (#2908) * chore: add coverage scripts to experimental * Remove codecov from browser only packages Co-authored-by: Valentin Marchaud --- 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 ++- experimental/packages/otlp-transformer/package.json | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/experimental/packages/exporter-trace-otlp-grpc/package.json b/experimental/packages/exporter-trace-otlp-grpc/package.json index d6157505c9d..0df33205d64 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/package.json +++ b/experimental/packages/exporter-trace-otlp-grpc/package.json @@ -20,7 +20,8 @@ "watch": "npm run protos:copy && tsc -w", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", - "peer-api-check": "node ../../../scripts/peer-api-check.js" + "peer-api-check": "node ../../../scripts/peer-api-check.js", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/exporter-trace-otlp-http/package.json b/experimental/packages/exporter-trace-otlp-http/package.json index 0143cc1a292..e42326a4e1e 100644 --- a/experimental/packages/exporter-trace-otlp-http/package.json +++ b/experimental/packages/exporter-trace-otlp-http/package.json @@ -28,7 +28,8 @@ "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", - "peer-api-check": "node ../../../scripts/peer-api-check.js" + "peer-api-check": "node ../../../scripts/peer-api-check.js", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/exporter-trace-otlp-proto/package.json b/experimental/packages/exporter-trace-otlp-proto/package.json index aecc95e3d45..20347268843 100644 --- a/experimental/packages/exporter-trace-otlp-proto/package.json +++ b/experimental/packages/exporter-trace-otlp-proto/package.json @@ -20,7 +20,8 @@ "watch": "npm run protos:copy && tsc -w", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", - "peer-api-check": "node ../../../scripts/peer-api-check.js" + "peer-api-check": "node ../../../scripts/peer-api-check.js", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" }, "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 4d9dbf326ec..a73dfcbdcc6 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json @@ -20,7 +20,8 @@ "watch": "npm run protos:copy && tsc -w", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", - "peer-api-check": "node ../../../scripts/peer-api-check.js" + "peer-api-check": "node ../../../scripts/peer-api-check.js", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" }, "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 8a9c8d55bfa..b67db1881b6 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json @@ -28,7 +28,8 @@ "watch": "tsc --build --watch tsconfig.all.json", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", - "peer-api-check": "node ../../../scripts/peer-api-check.js" + "peer-api-check": "node ../../../scripts/peer-api-check.js", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" }, "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 5dbf37a8a6b..28fee6697e1 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json @@ -20,7 +20,8 @@ "watch": "npm run protos:copy && tsc -w", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", - "peer-api-check": "node ../../../scripts/peer-api-check.js" + "peer-api-check": "node ../../../scripts/peer-api-check.js", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/otlp-transformer/package.json b/experimental/packages/otlp-transformer/package.json index ebb0937dd63..6b8e3a50a6d 100644 --- a/experimental/packages/otlp-transformer/package.json +++ b/experimental/packages/otlp-transformer/package.json @@ -19,7 +19,8 @@ "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "test:browser": "nyc karma start --single-run", "watch": "tsc --build -w tsconfig.all.json", - "peer-api-check": "node ../../../scripts/peer-api-check.js" + "peer-api-check": "node ../../../scripts/peer-api-check.js", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" }, "keywords": [ "opentelemetry", From 75cbf5d491c174633607bce082508f764f474675 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 20 Apr 2022 13:24:14 -0400 Subject: [PATCH 2/6] Fix code coverage paths (#2913) --- experimental/packages/exporter-trace-otlp-grpc/package.json | 2 +- experimental/packages/exporter-trace-otlp-http/package.json | 4 ++-- experimental/packages/exporter-trace-otlp-proto/package.json | 2 +- experimental/packages/opentelemetry-api-metrics/package.json | 4 ++-- .../opentelemetry-exporter-metrics-otlp-grpc/package.json | 2 +- .../opentelemetry-exporter-metrics-otlp-http/package.json | 4 ++-- .../opentelemetry-exporter-metrics-otlp-proto/package.json | 2 +- .../packages/opentelemetry-exporter-prometheus/package.json | 2 +- .../packages/opentelemetry-instrumentation-fetch/package.json | 2 +- .../packages/opentelemetry-instrumentation-grpc/package.json | 2 +- .../packages/opentelemetry-instrumentation-http/package.json | 2 +- .../package.json | 2 +- .../packages/opentelemetry-instrumentation/package.json | 4 ++-- .../packages/opentelemetry-sdk-metrics-base/package.json | 2 +- experimental/packages/opentelemetry-sdk-node/package.json | 2 +- experimental/packages/otlp-transformer/package.json | 2 +- 16 files changed, 20 insertions(+), 20 deletions(-) diff --git a/experimental/packages/exporter-trace-otlp-grpc/package.json b/experimental/packages/exporter-trace-otlp-grpc/package.json index 0df33205d64..3c1e0f47cac 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/package.json +++ b/experimental/packages/exporter-trace-otlp-grpc/package.json @@ -21,7 +21,7 @@ "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", - "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/exporter-trace-otlp-http/package.json b/experimental/packages/exporter-trace-otlp-http/package.json index e42326a4e1e..bab3b1c6337 100644 --- a/experimental/packages/exporter-trace-otlp-http/package.json +++ b/experimental/packages/exporter-trace-otlp-http/package.json @@ -17,7 +17,7 @@ "prepublishOnly": "npm run compile", "compile": "tsc --build tsconfig.all.json", "clean": "tsc --build --clean tsconfig.all.json", - "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", + "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "tdd": "npm run test -- --watch-extensions ts --watch", @@ -29,7 +29,7 @@ "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", - "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/exporter-trace-otlp-proto/package.json b/experimental/packages/exporter-trace-otlp-proto/package.json index 20347268843..c54476524fd 100644 --- a/experimental/packages/exporter-trace-otlp-proto/package.json +++ b/experimental/packages/exporter-trace-otlp-proto/package.json @@ -21,7 +21,7 @@ "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", - "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/opentelemetry-api-metrics/package.json b/experimental/packages/opentelemetry-api-metrics/package.json index 514316c39e5..bd5fc5b2f9f 100644 --- a/experimental/packages/opentelemetry-api-metrics/package.json +++ b/experimental/packages/opentelemetry-api-metrics/package.json @@ -20,8 +20,8 @@ "clean": "tsc --build --clean tsconfig.all.json", "test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts", "test:browser": "nyc karma start --single-run", - "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", - "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", + "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "build": "npm run compile", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json index a73dfcbdcc6..bb7d7e4ba49 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json @@ -21,7 +21,7 @@ "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", - "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" }, "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 b67db1881b6..339a705158b 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json @@ -17,7 +17,7 @@ "prepublishOnly": "npm run compile", "compile": "tsc --build tsconfig.all.json", "clean": "tsc --build --clean tsconfig.all.json", - "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", + "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "tdd": "npm run test -- --watch-extensions ts --watch", @@ -29,7 +29,7 @@ "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", - "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" }, "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 28fee6697e1..4e31d16d554 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json @@ -21,7 +21,7 @@ "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", - "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" }, "keywords": [ "opentelemetry", diff --git a/experimental/packages/opentelemetry-exporter-prometheus/package.json b/experimental/packages/opentelemetry-exporter-prometheus/package.json index c920c392a15..781d6b23a20 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/package.json +++ b/experimental/packages/opentelemetry-exporter-prometheus/package.json @@ -12,7 +12,7 @@ "clean": "tsc --build --clean", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "tdd": "npm run test -- --watch-extensions ts --watch", - "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../../scripts/version-update.js", diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/package.json b/experimental/packages/opentelemetry-instrumentation-fetch/package.json index 3a10d69c35c..046c7087624 100644 --- a/experimental/packages/opentelemetry-instrumentation-fetch/package.json +++ b/experimental/packages/opentelemetry-instrumentation-fetch/package.json @@ -13,7 +13,7 @@ "clean": "tsc --build --clean tsconfig.all.json", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", + "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "version": "node ../../../scripts/version-update.js", "tdd": "karma start", "test:browser": "nyc karma start --single-run", diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/package.json b/experimental/packages/opentelemetry-instrumentation-grpc/package.json index c5a31705c87..e69148d97a8 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/package.json +++ b/experimental/packages/opentelemetry-instrumentation-grpc/package.json @@ -13,7 +13,7 @@ "tdd": "npm run test -- --watch-extensions ts --watch", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", diff --git a/experimental/packages/opentelemetry-instrumentation-http/package.json b/experimental/packages/opentelemetry-instrumentation-http/package.json index 461b6b2fb73..1106536b75b 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/package.json +++ b/experimental/packages/opentelemetry-instrumentation-http/package.json @@ -13,7 +13,7 @@ "tdd": "npm run test -- --watch-extensions ts --watch", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "version": "node ../../../scripts/version-update.js", "watch": "tsc --build --watch", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", diff --git a/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json b/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json index 73e5b285d21..e2b83b74050 100644 --- a/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json +++ b/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json @@ -13,7 +13,7 @@ "clean": "tsc --build --clean tsconfig.all.json", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", + "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "version": "node ../../../scripts/version-update.js", "tdd": "karma start", "test:browser": "nyc karma start --single-run", diff --git a/experimental/packages/opentelemetry-instrumentation/package.json b/experimental/packages/opentelemetry-instrumentation/package.json index c4c879e51f8..cd2871378bf 100644 --- a/experimental/packages/opentelemetry-instrumentation/package.json +++ b/experimental/packages/opentelemetry-instrumentation/package.json @@ -40,8 +40,8 @@ "prepublishOnly": "npm run compile", "compile": "tsc --build tsconfig.all.json", "clean": "tsc --build --clean tsconfig.all.json", - "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", - "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", + "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "tdd": "npm run tdd:node", diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/package.json b/experimental/packages/opentelemetry-sdk-metrics-base/package.json index 52dba98f7e6..715edd2feca 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/package.json +++ b/experimental/packages/opentelemetry-sdk-metrics-base/package.json @@ -16,7 +16,7 @@ "test:browser": "nyc karma start --single-run", "tdd": "npm run test -- --watch-extensions ts --watch", "tdd:browser": "karma start", - "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../../scripts/version-update.js", diff --git a/experimental/packages/opentelemetry-sdk-node/package.json b/experimental/packages/opentelemetry-sdk-node/package.json index 18473ec9a5f..aa3efbd2159 100644 --- a/experimental/packages/opentelemetry-sdk-node/package.json +++ b/experimental/packages/opentelemetry-sdk-node/package.json @@ -10,7 +10,7 @@ "compile": "tsc --build", "clean": "tsc --build --clean", "test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts", - "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../../scripts/version-update.js", diff --git a/experimental/packages/otlp-transformer/package.json b/experimental/packages/otlp-transformer/package.json index 6b8e3a50a6d..675bf64c8de 100644 --- a/experimental/packages/otlp-transformer/package.json +++ b/experimental/packages/otlp-transformer/package.json @@ -20,7 +20,7 @@ "test:browser": "nyc karma start --single-run", "watch": "tsc --build -w tsconfig.all.json", "peer-api-check": "node ../../../scripts/peer-api-check.js", - "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../" }, "keywords": [ "opentelemetry", From 0f3e4dea3c2cf9f1dc37dc13fbae23608eabd4e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerhard=20St=C3=B6bich?= Date: Wed, 20 Apr 2022 20:52:52 +0200 Subject: [PATCH 3/6] chore: cleanup API dependencies (#2904) --- .../src/PrometheusSerializer.ts | 2 +- .../opentelemetry-sdk-metrics-base/package.json | 1 - .../packages/opentelemetry-sdk-node/package.json | 10 +++++----- experimental/packages/otlp-transformer/package.json | 5 ++--- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts b/experimental/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts index 391eeba0a05..710ceaf8d89 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 { MetricAttributes } from '@opentelemetry/api-metrics'; +import type { MetricAttributes } from '@opentelemetry/api-metrics'; import { hrTimeToMilliseconds } from '@opentelemetry/core'; type PrometheusDataTypeLiteral = diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/package.json b/experimental/packages/opentelemetry-sdk-metrics-base/package.json index 715edd2feca..d380ffe9b2a 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/package.json +++ b/experimental/packages/opentelemetry-sdk-metrics-base/package.json @@ -77,7 +77,6 @@ "peerDependencies": { "@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": { "@opentelemetry/api-metrics": "0.27.0", "@opentelemetry/core": "1.1.1", diff --git a/experimental/packages/opentelemetry-sdk-node/package.json b/experimental/packages/opentelemetry-sdk-node/package.json index aa3efbd2159..6cca89666fe 100644 --- a/experimental/packages/opentelemetry-sdk-node/package.json +++ b/experimental/packages/opentelemetry-sdk-node/package.json @@ -45,21 +45,21 @@ }, "dependencies": { "@opentelemetry/api-metrics": "0.27.0", - "@opentelemetry/core": "~1.1.1", + "@opentelemetry/core": "1.1.1", "@opentelemetry/instrumentation": "0.27.0", "@opentelemetry/resource-detector-aws": "~1.0.0", "@opentelemetry/resource-detector-gcp": "~0.26.0", - "@opentelemetry/resources": "~1.1.1", + "@opentelemetry/resources": "1.1.1", "@opentelemetry/sdk-metrics-base": "0.27.0", - "@opentelemetry/sdk-trace-base": "~1.1.1", - "@opentelemetry/sdk-trace-node": "~1.1.1" + "@opentelemetry/sdk-trace-base": "1.1.1", + "@opentelemetry/sdk-trace-node": "1.1.1" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "devDependencies": { "@opentelemetry/api": ">=1.0.0 <1.2.0", - "@opentelemetry/context-async-hooks": "1.1.0", + "@opentelemetry/context-async-hooks": "1.1.1", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/semver": "7.3.9", diff --git a/experimental/packages/otlp-transformer/package.json b/experimental/packages/otlp-transformer/package.json index 675bf64c8de..dd848efbd8b 100644 --- a/experimental/packages/otlp-transformer/package.json +++ b/experimental/packages/otlp-transformer/package.json @@ -44,12 +44,10 @@ "README.md" ], "peerDependencies": { - "@opentelemetry/api": ">=1.0.0 <1.2.0", - "@opentelemetry/api-metrics": "~0.27.0" + "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "devDependencies": { "@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", "codecov": "3.8.3", @@ -71,6 +69,7 @@ "webpack": "4.46.0" }, "dependencies": { + "@opentelemetry/api-metrics": "0.27.0", "@opentelemetry/core": "1.1.1", "@opentelemetry/resources": "1.1.1", "@opentelemetry/sdk-metrics-base": "0.27.0", From e5031bdf65a709538e230b794b7177ddb127b301 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Thu, 21 Apr 2022 14:49:31 +0200 Subject: [PATCH 4/6] refactor(exporters): introduce packages for shared exporter classes (#2893) Co-authored-by: Daniel Dyla --- .gitmodules | 14 +- experimental/CHANGELOG.md | 4 + .../exporter-trace-otlp-grpc/package.json | 7 +- .../src/OTLPTraceExporter.ts | 27 +- .../exporter-trace-otlp-grpc/src/index.ts | 3 - .../exporter-trace-otlp-grpc/submodule.md | 46 --- .../test/OTLPTraceExporter.test.ts | 10 +- .../exporter-trace-otlp-grpc/tsconfig.json | 6 + .../exporter-trace-otlp-http/package.json | 3 +- .../exporter-trace-otlp-http/src/index.ts | 2 - .../src/platform/browser/OTLPTraceExporter.ts | 5 +- .../src/platform/browser/index.ts | 1 - .../src/platform/index.ts | 1 - .../src/platform/node/OTLPTraceExporter.ts | 26 +- .../src/platform/node/index.ts | 3 - .../exporter-trace-otlp-http/src/transform.ts | 3 +- .../exporter-trace-otlp-http/src/types.ts | 40 +-- .../browser/CollectorTraceExporter.test.ts | 202 ++++++++++- .../test/common/transform.test.ts | 41 ++- .../test/node/CollectorTraceExporter.test.ts | 35 +- .../exporter-trace-otlp-http/tsconfig.json | 3 + .../exporter-trace-otlp-proto/package.json | 7 +- .../src/OTLPTraceExporter.ts | 10 +- .../exporter-trace-otlp-proto/src/index.ts | 3 - .../test/OTLPTraceExporter.test.ts | 7 +- .../exporter-trace-otlp-proto/tsconfig.json | 6 + .../package.json | 7 +- .../protos | 1 - .../src/OTLPMetricExporter.ts | 14 +- .../submodule.md | 45 --- .../test/OTLPMetricExporter.test.ts | 6 +- .../tsconfig.json | 6 +- .../package.json | 1 + .../src/OTLPMetricExporterBase.ts | 3 +- .../src/OTLPMetricExporterOptions.ts | 5 +- .../platform/browser/OTLPMetricExporter.ts | 13 +- .../src/platform/node/OTLPMetricExporter.ts | 8 +- .../src/transformMetrics.ts | 7 +- .../browser/CollectorMetricExporter.test.ts | 3 +- .../common/CollectorMetricExporter.test.ts | 5 +- .../test/node/CollectorMetricExporter.test.ts | 5 +- .../tsconfig.json | 3 + .../package.json | 8 +- .../protos | 1 - .../src/OTLPMetricExporter.ts | 9 +- .../test/OTLPMetricExporter.test.ts | 6 +- .../tsconfig.json | 9 +- .../packages/otlp-exporter-base/.eslintignore | 1 + .../packages/otlp-exporter-base/.eslintrc.js | 9 + .../packages/otlp-exporter-base/.npmignore | 4 + .../packages/otlp-exporter-base/LICENSE | 201 +++++++++++ .../packages/otlp-exporter-base/README.md | 42 +++ .../packages/otlp-exporter-base/karma.conf.js | 26 ++ .../packages/otlp-exporter-base/package.json | 78 +++++ .../src/OTLPExporterBase.ts | 2 +- .../packages/otlp-exporter-base/src/index.ts | 19 + .../browser/OTLPExporterBrowserBase.ts | 0 .../src/platform/browser/index.ts | 17 + .../src/platform/browser/util.ts | 15 +- .../otlp-exporter-base/src/platform/index.ts | 17 + .../src/platform/node/OTLPExporterNodeBase.ts | 0 .../src/platform/node/index.ts | 19 + .../src/platform/node/types.ts | 0 .../src/platform/node/util.ts | 6 +- .../packages/otlp-exporter-base/src/types.ts | 55 +++ .../src/util.ts | 0 .../test/browser/index-webpack.ts | 23 ++ .../test/browser/util.test.ts | 6 +- .../otlp-exporter-base/test/certs/ca.crt | 33 ++ .../otlp-exporter-base/test/certs/ca.key | 54 +++ .../otlp-exporter-base/test/certs/client.crt | 31 ++ .../otlp-exporter-base/test/certs/client.csr | 28 ++ .../otlp-exporter-base/test/certs/client.key | 51 +++ .../test/certs/regenerate.sh | 22 ++ .../otlp-exporter-base/test/certs/server.crt | 31 ++ .../otlp-exporter-base/test/certs/server.csr | 28 ++ .../otlp-exporter-base/test/certs/server.key | 51 +++ .../test/common/CollectorExporter.test.ts} | 36 +- .../test/common/util.test.ts} | 0 .../test/node/util.test.ts} | 0 .../otlp-exporter-base/test/testHelper.ts | 79 +++++ .../otlp-exporter-base/tsconfig.all.json | 9 + .../otlp-exporter-base/tsconfig.esm.json | 11 + .../otlp-exporter-base/tsconfig.esnext.json | 11 + .../packages/otlp-exporter-base/tsconfig.json | 16 + .../otlp-grpc-exporter-base/.eslintignore | 1 + .../otlp-grpc-exporter-base/.eslintrc.js | 8 + .../otlp-grpc-exporter-base/.npmignore | 4 + .../packages/otlp-grpc-exporter-base/LICENSE | 201 +++++++++++ .../otlp-grpc-exporter-base/README.md | 31 ++ .../otlp-grpc-exporter-base/package.json | 79 +++++ .../protos | 0 .../src/OTLPGRPCExporterNodeBase.ts} | 27 +- .../otlp-grpc-exporter-base/src/index.ts | 19 + .../src/types.ts | 16 +- .../src/util.ts | 46 ++- .../submodule.md | 1 + .../test/OTLPGRPCExporterNodeBase.test.ts} | 19 +- .../otlp-grpc-exporter-base/test/certs/ca.crt | 33 ++ .../otlp-grpc-exporter-base/test/certs/ca.key | 54 +++ .../test/certs/client.crt | 31 ++ .../test/certs/client.csr | 28 ++ .../test/certs/client.key | 51 +++ .../test/certs/regenerate.sh | 22 ++ .../test/certs/server.crt | 31 ++ .../test/certs/server.csr | 28 ++ .../test/certs/server.key | 51 +++ .../test/traceHelper.ts | 331 ++++++++++++++++++ .../test/util.test.ts | 12 +- .../otlp-grpc-exporter-base/tsconfig.json | 28 ++ .../otlp-proto-exporter-base/.eslintignore | 1 + .../otlp-proto-exporter-base/.eslintrc.js | 8 + .../otlp-proto-exporter-base/.npmignore | 4 + .../packages/otlp-proto-exporter-base/LICENSE | 201 +++++++++++ .../otlp-proto-exporter-base/README.md | 31 ++ .../otlp-proto-exporter-base/package.json | 76 ++++ .../protos | 0 .../src/OTLPProtoExporterNodeBase.ts} | 20 +- .../otlp-proto-exporter-base/src/index.ts | 19 + .../src/types.ts | 0 .../src/util.ts | 22 +- .../submodule.md | 2 +- .../otlp-proto-exporter-base/tsconfig.json | 19 + tsconfig.json | 9 + 124 files changed, 2873 insertions(+), 402 deletions(-) delete mode 100644 experimental/packages/exporter-trace-otlp-grpc/submodule.md delete mode 160000 experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/protos delete mode 100644 experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/submodule.md delete mode 160000 experimental/packages/opentelemetry-exporter-metrics-otlp-proto/protos create mode 100644 experimental/packages/otlp-exporter-base/.eslintignore create mode 100644 experimental/packages/otlp-exporter-base/.eslintrc.js create mode 100644 experimental/packages/otlp-exporter-base/.npmignore create mode 100644 experimental/packages/otlp-exporter-base/LICENSE create mode 100644 experimental/packages/otlp-exporter-base/README.md create mode 100644 experimental/packages/otlp-exporter-base/karma.conf.js create mode 100644 experimental/packages/otlp-exporter-base/package.json rename experimental/packages/{exporter-trace-otlp-http => otlp-exporter-base}/src/OTLPExporterBase.ts (99%) create mode 100644 experimental/packages/otlp-exporter-base/src/index.ts rename experimental/packages/{exporter-trace-otlp-http => otlp-exporter-base}/src/platform/browser/OTLPExporterBrowserBase.ts (100%) create mode 100644 experimental/packages/otlp-exporter-base/src/platform/browser/index.ts rename experimental/packages/{exporter-trace-otlp-http => otlp-exporter-base}/src/platform/browser/util.ts (87%) create mode 100644 experimental/packages/otlp-exporter-base/src/platform/index.ts rename experimental/packages/{exporter-trace-otlp-http => otlp-exporter-base}/src/platform/node/OTLPExporterNodeBase.ts (100%) create mode 100644 experimental/packages/otlp-exporter-base/src/platform/node/index.ts rename experimental/packages/{exporter-trace-otlp-http => otlp-exporter-base}/src/platform/node/types.ts (100%) rename experimental/packages/{exporter-trace-otlp-http => otlp-exporter-base}/src/platform/node/util.ts (96%) create mode 100644 experimental/packages/otlp-exporter-base/src/types.ts rename experimental/packages/{exporter-trace-otlp-http => otlp-exporter-base}/src/util.ts (100%) create mode 100644 experimental/packages/otlp-exporter-base/test/browser/index-webpack.ts rename experimental/packages/{exporter-trace-otlp-http => otlp-exporter-base}/test/browser/util.test.ts (97%) create mode 100644 experimental/packages/otlp-exporter-base/test/certs/ca.crt create mode 100644 experimental/packages/otlp-exporter-base/test/certs/ca.key create mode 100644 experimental/packages/otlp-exporter-base/test/certs/client.crt create mode 100644 experimental/packages/otlp-exporter-base/test/certs/client.csr create mode 100644 experimental/packages/otlp-exporter-base/test/certs/client.key create mode 100755 experimental/packages/otlp-exporter-base/test/certs/regenerate.sh create mode 100644 experimental/packages/otlp-exporter-base/test/certs/server.crt create mode 100644 experimental/packages/otlp-exporter-base/test/certs/server.csr create mode 100644 experimental/packages/otlp-exporter-base/test/certs/server.key rename experimental/packages/{exporter-trace-otlp-http/test/common/CollectorTraceExporter.test.ts => otlp-exporter-base/test/common/CollectorExporter.test.ts} (88%) rename experimental/packages/{exporter-trace-otlp-http/test/common/utils.test.ts => otlp-exporter-base/test/common/util.test.ts} (100%) rename experimental/packages/{exporter-trace-otlp-http/test/node/utils.test.ts => otlp-exporter-base/test/node/util.test.ts} (100%) create mode 100644 experimental/packages/otlp-exporter-base/test/testHelper.ts create mode 100644 experimental/packages/otlp-exporter-base/tsconfig.all.json create mode 100644 experimental/packages/otlp-exporter-base/tsconfig.esm.json create mode 100644 experimental/packages/otlp-exporter-base/tsconfig.esnext.json create mode 100644 experimental/packages/otlp-exporter-base/tsconfig.json create mode 100644 experimental/packages/otlp-grpc-exporter-base/.eslintignore create mode 100644 experimental/packages/otlp-grpc-exporter-base/.eslintrc.js create mode 100644 experimental/packages/otlp-grpc-exporter-base/.npmignore create mode 100644 experimental/packages/otlp-grpc-exporter-base/LICENSE create mode 100644 experimental/packages/otlp-grpc-exporter-base/README.md create mode 100644 experimental/packages/otlp-grpc-exporter-base/package.json rename experimental/packages/{exporter-trace-otlp-grpc => otlp-grpc-exporter-base}/protos (100%) rename experimental/packages/{exporter-trace-otlp-grpc/src/OTLPExporterNodeBase.ts => otlp-grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts} (83%) create mode 100644 experimental/packages/otlp-grpc-exporter-base/src/index.ts rename experimental/packages/{exporter-trace-otlp-grpc => otlp-grpc-exporter-base}/src/types.ts (79%) rename experimental/packages/{exporter-trace-otlp-grpc => otlp-grpc-exporter-base}/src/util.ts (75%) rename experimental/packages/{opentelemetry-exporter-metrics-otlp-proto => otlp-grpc-exporter-base}/submodule.md (93%) rename experimental/packages/{exporter-trace-otlp-grpc/test/OTLPExporterNodeBase.test.ts => otlp-grpc-exporter-base/test/OTLPGRPCExporterNodeBase.test.ts} (89%) create mode 100644 experimental/packages/otlp-grpc-exporter-base/test/certs/ca.crt create mode 100644 experimental/packages/otlp-grpc-exporter-base/test/certs/ca.key create mode 100644 experimental/packages/otlp-grpc-exporter-base/test/certs/client.crt create mode 100644 experimental/packages/otlp-grpc-exporter-base/test/certs/client.csr create mode 100644 experimental/packages/otlp-grpc-exporter-base/test/certs/client.key create mode 100755 experimental/packages/otlp-grpc-exporter-base/test/certs/regenerate.sh create mode 100644 experimental/packages/otlp-grpc-exporter-base/test/certs/server.crt create mode 100644 experimental/packages/otlp-grpc-exporter-base/test/certs/server.csr create mode 100644 experimental/packages/otlp-grpc-exporter-base/test/certs/server.key create mode 100644 experimental/packages/otlp-grpc-exporter-base/test/traceHelper.ts rename experimental/packages/{exporter-trace-otlp-grpc => otlp-grpc-exporter-base}/test/util.test.ts (86%) create mode 100644 experimental/packages/otlp-grpc-exporter-base/tsconfig.json create mode 100644 experimental/packages/otlp-proto-exporter-base/.eslintignore create mode 100644 experimental/packages/otlp-proto-exporter-base/.eslintrc.js create mode 100644 experimental/packages/otlp-proto-exporter-base/.npmignore create mode 100644 experimental/packages/otlp-proto-exporter-base/LICENSE create mode 100644 experimental/packages/otlp-proto-exporter-base/README.md create mode 100644 experimental/packages/otlp-proto-exporter-base/package.json rename experimental/packages/{exporter-trace-otlp-proto => otlp-proto-exporter-base}/protos (100%) rename experimental/packages/{exporter-trace-otlp-proto/src/OTLPExporterNodeBase.ts => otlp-proto-exporter-base/src/OTLPProtoExporterNodeBase.ts} (84%) create mode 100644 experimental/packages/otlp-proto-exporter-base/src/index.ts rename experimental/packages/{exporter-trace-otlp-proto => otlp-proto-exporter-base}/src/types.ts (100%) rename experimental/packages/{exporter-trace-otlp-proto => otlp-proto-exporter-base}/src/util.ts (86%) rename experimental/packages/{exporter-trace-otlp-proto => otlp-proto-exporter-base}/submodule.md (93%) create mode 100644 experimental/packages/otlp-proto-exporter-base/tsconfig.json diff --git a/.gitmodules b/.gitmodules index 817382141b0..33a9a7d9b21 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,6 @@ -[submodule "experimental/packages/exporter-trace-otlp-proto/protos"] - path = experimental/packages/exporter-trace-otlp-proto/protos +[submodule "experimental/packages/otlp-grpc-exporter-base/protos"] + path = experimental/packages/otlp-grpc-exporter-base/protos url = https://github.com/open-telemetry/opentelemetry-proto.git -[submodule "experimental/packages/exporter-trace-otlp-grpc/protos"] - path = experimental/packages/exporter-trace-otlp-grpc/protos - url = https://github.com/open-telemetry/opentelemetry-proto.git -[submodule "experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/protos"] - path = experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/protos - url = https://github.com/open-telemetry/opentelemetry-proto.git -[submodule "experimental/packages/opentelemetry-exporter-metrics-otlp-proto/protos"] - path = experimental/packages/opentelemetry-exporter-metrics-otlp-proto/protos +[submodule "experimental/packages/otlp-proto-exporter-base/protos"] + path = experimental/packages/otlp-proto-exporter-base/protos url = https://github.com/open-telemetry/opentelemetry-proto.git diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 58681558d42..343e435b2d3 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -16,6 +16,10 @@ All notable changes to experimental packages in this project will be documented * updated `opentelemetry-sdk-node` to the latest Metrics SDK. * updated `otlp-transformer` to the latest Metrics SDK. * updated all `instrumentation-*` packages to use local implementations of `parseUrl()` due to #2884 +* refactor(otlp-exporters) move base classes and associated types into their own packages #2893 @pichlermarc + * `otlp-exporter-base` => `OTLPExporterBase`, `OTLPExporterBrowserBase`, `OTLPExporterNodeBase` + * `otlp-grpc-exporter-base` => `OTLPGRPCExporterNodeBase` + * `otlp-proto-exporter-base` => `OTLPProtoExporterNodeBase` ### :rocket: (Enhancement) diff --git a/experimental/packages/exporter-trace-otlp-grpc/package.json b/experimental/packages/exporter-trace-otlp-grpc/package.json index 3c1e0f47cac..c8349a70388 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/package.json +++ b/experimental/packages/exporter-trace-otlp-grpc/package.json @@ -11,13 +11,10 @@ "clean": "tsc --build --clean", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "postcompile": "npm run submodule && npm run protos:copy", - "protos:copy": "cpx protos/opentelemetry/**/*.* build/protos/opentelemetry", - "submodule": "git submodule sync --recursive && git submodule update --init --recursive", "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "version": "node ../../../scripts/version-update.js", - "watch": "npm run protos:copy && tsc -w", + "watch": "tsc -w", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", @@ -52,6 +49,7 @@ "devDependencies": { "@babel/core": "7.16.0", "@opentelemetry/api": "^1.0.0", + "@opentelemetry/otlp-exporter-base": "0.27.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", @@ -73,6 +71,7 @@ "@grpc/grpc-js": "^1.5.9", "@grpc/proto-loader": "^0.6.9", "@opentelemetry/exporter-trace-otlp-http": "0.27.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.27.0", "@opentelemetry/resources": "1.1.1", "@opentelemetry/sdk-trace-base": "1.1.1" } diff --git a/experimental/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts b/experimental/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts index 871d3f31dbc..d08e679e990 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts +++ b/experimental/packages/exporter-trace-otlp-grpc/src/OTLPTraceExporter.ts @@ -15,15 +15,18 @@ */ import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base'; -import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; import { otlpTypes, toOTLPExportTraceServiceRequest, } from '@opentelemetry/exporter-trace-otlp-http'; -import { OTLPExporterConfigNode, ServiceClientType } from './types'; import { baggageUtils, getEnv } from '@opentelemetry/core'; -import { validateAndNormalizeUrl } from './util'; import { Metadata } from '@grpc/grpc-js'; +import { + OTLPGRPCExporterConfigNode, + OTLPGRPCExporterNodeBase, + ServiceClientType, + validateAndNormalizeUrl +} from '@opentelemetry/otlp-grpc-exporter-base'; const DEFAULT_COLLECTOR_URL = 'localhost:4317'; @@ -31,13 +34,11 @@ const DEFAULT_COLLECTOR_URL = 'localhost:4317'; * OTLP Trace Exporter for Node */ export class OTLPTraceExporter - extends OTLPExporterNodeBase< - ReadableSpan, - otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest - > + extends OTLPGRPCExporterNodeBase implements SpanExporter { - constructor(config: OTLPExporterConfigNode = {}) { + constructor(config: OTLPGRPCExporterConfigNode = {}) { super(config); const headers = baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_TRACES_HEADERS); this.metadata ||= new Metadata(); @@ -52,14 +53,14 @@ export class OTLPTraceExporter return toOTLPExportTraceServiceRequest(spans, this); } - getDefaultUrl(config: OTLPExporterConfigNode) { + getDefaultUrl(config: OTLPGRPCExporterConfigNode) { return typeof config.url === 'string' ? validateAndNormalizeUrl(config.url) : getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length > 0 - ? validateAndNormalizeUrl(getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT) - : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 - ? validateAndNormalizeUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT) - : DEFAULT_COLLECTOR_URL; + ? validateAndNormalizeUrl(getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT) + : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 + ? validateAndNormalizeUrl(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT) + : DEFAULT_COLLECTOR_URL; } getServiceClientType() { diff --git a/experimental/packages/exporter-trace-otlp-grpc/src/index.ts b/experimental/packages/exporter-trace-otlp-grpc/src/index.ts index 34975b3ed5c..761e8a92624 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/src/index.ts +++ b/experimental/packages/exporter-trace-otlp-grpc/src/index.ts @@ -14,7 +14,4 @@ * limitations under the License. */ -export * from './OTLPExporterNodeBase'; export * from './OTLPTraceExporter'; -export { ServiceClientType, OTLPExporterConfigNode } from './types'; -export { validateAndNormalizeUrl } from './util'; diff --git a/experimental/packages/exporter-trace-otlp-grpc/submodule.md b/experimental/packages/exporter-trace-otlp-grpc/submodule.md deleted file mode 100644 index c091e096929..00000000000 --- a/experimental/packages/exporter-trace-otlp-grpc/submodule.md +++ /dev/null @@ -1,46 +0,0 @@ -# Important - -**Submodule is always pointing to certain revision number. So updating the submodule repo will not have impact on your code. -Knowing this if you want to change the submodule to point to a different version (when for example proto has changed) here is how to do it:** - -## Updating submodule to point to certain revision number - -1. Make sure you are in the same folder as this instruction - -2. Update your submodules by running this command - - ```shell script - git submodule sync --recursive - git submodule update --init --recursive - ``` - -3. Find the SHA which you want to update to and copy it (the long one) -the latest sha when this guide was written is `b54688569186e0b862bf7462a983ccf2c50c0547` - -4. Enter a submodule directory from this directory - - ```shell script - cd protos - ``` - -5. Updates files in the submodule tree to given commit: - - ```shell script - git checkout -q - ``` - -6. Return to the main directory: - - ```shell script - cd ../ - ``` - -7. Please run `git status` you should see something like `Head detached at`. This is correct, go to next step - -8. Now thing which is very important. You have to commit this to apply these changes - - ```shell script - git commit -am "chore: updating submodule for opentelemetry-proto" - ``` - -9. If you look now at git log you will notice that the folder `protos` has been changed and it will show what was the previous sha and what is current one. diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts index 412dfd822d5..7d44d4938ee 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts +++ b/experimental/packages/exporter-trace-otlp-grpc/test/OTLPTraceExporter.test.ts @@ -35,12 +35,12 @@ import { ensureResourceIsCorrect, mockedReadableSpan, } from './traceHelper'; - -import { CompressionAlgorithm } from '../src/types'; +import { CompressionAlgorithm } from '@opentelemetry/otlp-exporter-base'; +import { GrpcCompressionAlgorithm } from '@opentelemetry/otlp-grpc-exporter-base'; const traceServiceProtoPath = 'opentelemetry/proto/collector/trace/v1/trace_service.proto'; -const includeDirs = [path.resolve(__dirname, '../protos')]; +const includeDirs = [path.resolve(__dirname, '../../otlp-grpc-exporter-base/protos')]; const address = 'localhost:1501'; @@ -267,7 +267,7 @@ const testCollectorExporter = (params: TestParams) => credentials, metadata: params.metadata, }); - assert.strictEqual(collectorExporter.compression, CompressionAlgorithm.GZIP); + assert.strictEqual(collectorExporter.compression, GrpcCompressionAlgorithm.GZIP); delete envSource.OTEL_EXPORTER_OTLP_COMPRESSION; }); }); @@ -337,3 +337,5 @@ describe('when configuring via environment', () => { testCollectorExporter({ useTLS: true }); testCollectorExporter({ useTLS: false }); testCollectorExporter({ metadata }); + + diff --git a/experimental/packages/exporter-trace-otlp-grpc/tsconfig.json b/experimental/packages/exporter-trace-otlp-grpc/tsconfig.json index 3b28c06f67e..4a71bbfef6a 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/tsconfig.json +++ b/experimental/packages/exporter-trace-otlp-grpc/tsconfig.json @@ -20,6 +20,12 @@ }, { "path": "../exporter-trace-otlp-http" + }, + { + "path": "../otlp-exporter-base" + }, + { + "path": "../otlp-grpc-exporter-base" } ] } diff --git a/experimental/packages/exporter-trace-otlp-http/package.json b/experimental/packages/exporter-trace-otlp-http/package.json index bab3b1c6337..8f301a65054 100644 --- a/experimental/packages/exporter-trace-otlp-http/package.json +++ b/experimental/packages/exporter-trace-otlp-http/package.json @@ -96,6 +96,7 @@ "dependencies": { "@opentelemetry/core": "1.1.1", "@opentelemetry/resources": "1.1.1", - "@opentelemetry/sdk-trace-base": "1.1.1" + "@opentelemetry/sdk-trace-base": "1.1.1", + "@opentelemetry/otlp-exporter-base": "0.27.0" } } diff --git a/experimental/packages/exporter-trace-otlp-http/src/index.ts b/experimental/packages/exporter-trace-otlp-http/src/index.ts index bd025cd4d6f..d22bb9029d6 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/index.ts +++ b/experimental/packages/exporter-trace-otlp-http/src/index.ts @@ -14,8 +14,6 @@ * limitations under the License. */ -export * from './OTLPExporterBase'; export * from './platform'; export * as otlpTypes from './types'; export { toCollectorResource, toOTLPExportTraceServiceRequest } from './transform'; -export { appendResourcePathToUrlIfNotPresent } from './util'; diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/browser/OTLPTraceExporter.ts b/experimental/packages/exporter-trace-otlp-http/src/platform/browser/OTLPTraceExporter.ts index 91ee1014234..28411089f6c 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/platform/browser/OTLPTraceExporter.ts +++ b/experimental/packages/exporter-trace-otlp-http/src/platform/browser/OTLPTraceExporter.ts @@ -14,13 +14,12 @@ * limitations under the License. */ -import { OTLPExporterConfigBase } from '../../types'; -import { OTLPExporterBrowserBase } from './OTLPExporterBrowserBase'; +import { appendResourcePathToUrlIfNotPresent, OTLPExporterBrowserBase } from '@opentelemetry/otlp-exporter-base'; import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base'; import { toOTLPExportTraceServiceRequest } from '../../transform'; import * as otlpTypes from '../../types'; import { getEnv, baggageUtils } from '@opentelemetry/core'; -import { appendResourcePathToUrlIfNotPresent } from '../../util'; +import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/traces'; const DEFAULT_COLLECTOR_URL=`http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`; diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/browser/index.ts b/experimental/packages/exporter-trace-otlp-http/src/platform/browser/index.ts index 6a322e976af..761e8a92624 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/platform/browser/index.ts +++ b/experimental/packages/exporter-trace-otlp-http/src/platform/browser/index.ts @@ -15,4 +15,3 @@ */ export * from './OTLPTraceExporter'; -export * from './OTLPExporterBrowserBase'; diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/index.ts b/experimental/packages/exporter-trace-otlp-http/src/platform/index.ts index a33b81cffb7..cdaf8858ce5 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/platform/index.ts +++ b/experimental/packages/exporter-trace-otlp-http/src/platform/index.ts @@ -15,4 +15,3 @@ */ export * from './node'; -export { OTLPExporterBrowserBase } from './browser'; diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPTraceExporter.ts b/experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPTraceExporter.ts index 82bdff3aef9..d4a6e21a937 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPTraceExporter.ts +++ b/experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPTraceExporter.ts @@ -15,24 +15,24 @@ */ import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base'; -import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; -import { OTLPExporterNodeConfigBase } from './types'; import * as otlpTypes from '../../types'; import { toOTLPExportTraceServiceRequest } from '../../transform'; import { getEnv, baggageUtils } from '@opentelemetry/core'; -import { appendResourcePathToUrlIfNotPresent } from '../../util'; +import { OTLPExporterNodeBase } from '@opentelemetry/otlp-exporter-base'; +import { + OTLPExporterNodeConfigBase, + appendResourcePathToUrlIfNotPresent +} from '@opentelemetry/otlp-exporter-base'; const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/traces'; -const DEFAULT_COLLECTOR_URL=`http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`; +const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`; /** * Collector Trace Exporter for Node */ export class OTLPTraceExporter - extends OTLPExporterNodeBase< - ReadableSpan, - otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest - > + extends OTLPExporterNodeBase implements SpanExporter { constructor(config: OTLPExporterNodeConfigBase = {}) { super(config); @@ -50,13 +50,13 @@ export class OTLPTraceExporter return toOTLPExportTraceServiceRequest(spans, this, true); } - getDefaultUrl(config: OTLPExporterNodeConfigBase) : string { + getDefaultUrl(config: OTLPExporterNodeConfigBase): string { return typeof config.url === 'string' ? config.url : getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length > 0 - ? getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 - ? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) - : DEFAULT_COLLECTOR_URL; + ? getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT + : getEnv().OTEL_EXPORTER_OTLP_ENDPOINT.length > 0 + ? appendResourcePathToUrlIfNotPresent(getEnv().OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_COLLECTOR_RESOURCE_PATH) + : DEFAULT_COLLECTOR_URL; } } diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/node/index.ts b/experimental/packages/exporter-trace-otlp-http/src/platform/node/index.ts index ab18e724e08..761e8a92624 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/platform/node/index.ts +++ b/experimental/packages/exporter-trace-otlp-http/src/platform/node/index.ts @@ -15,6 +15,3 @@ */ export * from './OTLPTraceExporter'; -export * from './OTLPExporterNodeBase'; -export * from './util'; -export * from './types'; diff --git a/experimental/packages/exporter-trace-otlp-http/src/transform.ts b/experimental/packages/exporter-trace-otlp-http/src/transform.ts index c6ddffea198..5224c527fa6 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/transform.ts +++ b/experimental/packages/exporter-trace-otlp-http/src/transform.ts @@ -24,12 +24,11 @@ import { import * as core from '@opentelemetry/core'; import { Resource } from '@opentelemetry/resources'; import { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base'; -import { OTLPExporterBase } from './OTLPExporterBase'; import { OTLP_SPAN_KIND_MAPPING, opentelemetryProto, - OTLPExporterConfigBase, } from './types'; +import { OTLPExporterBase, OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; const MAX_INTEGER_VALUE = 2147483647; const MIN_INTEGER_VALUE = -2147483648; diff --git a/experimental/packages/exporter-trace-otlp-http/src/types.ts b/experimental/packages/exporter-trace-otlp-http/src/types.ts index 3f2bd27a01b..02be0ed2e44 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/types.ts +++ b/experimental/packages/exporter-trace-otlp-http/src/types.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { SpanAttributes, SpanKind, SpanStatusCode } from '@opentelemetry/api'; +import { SpanKind, SpanStatusCode } from '@opentelemetry/api'; /* eslint-disable @typescript-eslint/no-namespace */ /* eslint-disable @typescript-eslint/no-unused-vars */ @@ -311,44 +311,6 @@ export namespace opentelemetryProto { } } -/** - * Interface for handling error - */ -export class OTLPExporterError extends Error { - readonly code?: number; - override readonly name: string = 'OTLPExporterError'; - readonly data?: string; - - constructor(message?: string, code?: number, data?: string) { - super(message); - this.data = data; - this.code = code; - } -} - -/** - * Interface for handling export service errors - */ -export interface ExportServiceError { - name: string; - code: number; - details: string; - metadata: { [key: string]: unknown }; - message: string; - stack: string; -} - -/** - * Collector Exporter base config - */ -export interface OTLPExporterConfigBase { - headers?: Partial>; - hostname?: string; - attributes?: SpanAttributes; - url?: string; - concurrencyLimit?: number; -} - /** * Mapping between api SpanKind and proto SpanKind */ diff --git a/experimental/packages/exporter-trace-otlp-http/test/browser/CollectorTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-http/test/browser/CollectorTraceExporter.test.ts index a66a7c59d08..1f57a5e959a 100644 --- a/experimental/packages/exporter-trace-otlp-http/test/browser/CollectorTraceExporter.test.ts +++ b/experimental/packages/exporter-trace-otlp-http/test/browser/CollectorTraceExporter.test.ts @@ -14,13 +14,12 @@ * limitations under the License. */ -import { diag } from '@opentelemetry/api'; +import { diag, DiagLogger, DiagLogLevel } from '@opentelemetry/api'; import { ExportResultCode } from '@opentelemetry/core'; import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; import * as assert from 'assert'; import * as sinon from 'sinon'; import { OTLPTraceExporter } from '../../src/platform/browser/index'; -import { OTLPExporterConfigBase } from '../../src/types'; import * as otlpTypes from '../../src/types'; import { @@ -30,6 +29,7 @@ import { ensureHeadersContain, mockedReadableSpan, } from '../traceHelper'; +import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; describe('OTLPTraceExporter - web', () => { let collectorTraceExporter: OTLPTraceExporter; @@ -50,6 +50,38 @@ describe('OTLPTraceExporter - web', () => { sinon.restore(); }); + describe('constructor', () => { + let onInitSpy: any; + + beforeEach(() => { + onInitSpy = sinon.stub(OTLPTraceExporter.prototype, 'onInit'); + collectorExporterConfig = { + hostname: 'foo', + attributes: {}, + url: 'http://foo.bar.com', + }; + collectorTraceExporter = new OTLPTraceExporter(collectorExporterConfig); + }); + + it('should create an instance', () => { + assert.ok(typeof collectorTraceExporter !== 'undefined'); + }); + + it('should call onInit', () => { + assert.strictEqual(onInitSpy.callCount, 1); + }); + + describe('when config contains certain params', () => { + it('should set hostname', () => { + assert.strictEqual(collectorTraceExporter.hostname, 'foo'); + }); + + it('should set url', () => { + assert.strictEqual(collectorTraceExporter.url, 'http://foo.bar.com'); + }); + }); + }); + describe('export', () => { beforeEach(() => { collectorExporterConfig = { @@ -67,7 +99,8 @@ describe('OTLPTraceExporter - web', () => { }); it('should successfully send the spans using sendBeacon', done => { - collectorTraceExporter.export(spans, () => { }); + collectorTraceExporter.export(spans, () => { + }); setTimeout(async () => { const args = stubBeacon.args[0]; @@ -103,15 +136,27 @@ describe('OTLPTraceExporter - web', () => { }); it('should log the successful message', done => { - // Need to stub/spy on the underlying logger as the "diag" instance is global - const spyLoggerDebug = sinon.stub(diag, 'debug'); - const spyLoggerError = sinon.stub(diag, 'error'); + const spyLoggerDebug = sinon.stub(); + const spyLoggerError = sinon.stub(); + const nop = () => { + }; + const diagLogger: DiagLogger = { + debug: spyLoggerDebug, + error: spyLoggerError, + info: nop, + verbose: nop, + warn: nop + }; + + diag.setLogger(diagLogger, DiagLogLevel.ALL); + stubBeacon.returns(true); - collectorTraceExporter.export(spans, () => { }); + collectorTraceExporter.export(spans, () => { + }); setTimeout(() => { - const response: any = spyLoggerDebug.args[1][0]; + const response: any = spyLoggerDebug.args[2][0]; assert.strictEqual(response, 'sendBeacon - can send'); assert.strictEqual(spyLoggerError.args.length, 0); @@ -144,7 +189,8 @@ describe('OTLPTraceExporter - web', () => { }); it('should successfully send the spans using XMLHttpRequest', done => { - collectorTraceExporter.export(spans, () => { }); + collectorTraceExporter.export(spans, () => { + }); setTimeout(() => { const request = server.requests[0]; @@ -178,17 +224,28 @@ describe('OTLPTraceExporter - web', () => { }); it('should log the successful message', done => { - // Need to stub/spy on the underlying logger as the "diag" instance is global - const spyLoggerDebug = sinon.stub(diag, 'debug'); - const spyLoggerError = sinon.stub(diag, 'error'); - - collectorTraceExporter.export(spans, () => { }); + const spyLoggerDebug = sinon.stub(); + const spyLoggerError = sinon.stub(); + const nop = () => { + }; + const diagLogger: DiagLogger = { + debug: spyLoggerDebug, + error: spyLoggerError, + info: nop, + verbose: nop, + warn: nop + }; + + diag.setLogger(diagLogger, DiagLogLevel.ALL); + + collectorTraceExporter.export(spans, () => { + }); setTimeout(() => { const request = server.requests[0]; request.respond(200); - const response: any = spyLoggerDebug.args[1][0]; + const response: any = spyLoggerDebug.args[2][0]; assert.strictEqual(response, 'xhr success'); assert.strictEqual(spyLoggerError.args.length, 0); @@ -211,7 +268,8 @@ describe('OTLPTraceExporter - web', () => { }); it('should send custom headers', done => { - collectorTraceExporter.export(spans, () => { }); + collectorTraceExporter.export(spans, () => { + }); setTimeout(() => { const request = server.requests[0]; @@ -224,6 +282,83 @@ describe('OTLPTraceExporter - web', () => { }); }); + + describe('export - common', () => { + let spySend: any; + beforeEach(() => { + spySend = sinon.stub(OTLPTraceExporter.prototype, 'send'); + collectorTraceExporter = new OTLPTraceExporter(collectorExporterConfig); + }); + + it('should export spans as otlpTypes.Spans', done => { + const spans: ReadableSpan[] = []; + spans.push(Object.assign({}, mockedReadableSpan)); + + collectorTraceExporter.export(spans, () => { + }); + setTimeout(() => { + const span1 = spySend.args[0][0][0] as ReadableSpan; + assert.deepStrictEqual(spans[0], span1); + done(); + }); + assert.strictEqual(spySend.callCount, 1); + }); + + describe('when exporter is shutdown', () => { + it( + 'should not export anything but return callback with code' + + ' "FailedNotRetryable"', + async () => { + const spans: ReadableSpan[] = []; + spans.push(Object.assign({}, mockedReadableSpan)); + await collectorTraceExporter.shutdown(); + spySend.resetHistory(); + + const callbackSpy = sinon.spy(); + collectorTraceExporter.export(spans, callbackSpy); + const returnCode = callbackSpy.args[0][0]; + + assert.strictEqual( + returnCode.code, + ExportResultCode.FAILED, + 'return value is wrong' + ); + assert.strictEqual(spySend.callCount, 0, 'should not call send'); + } + ); + }); + describe('when an error occurs', () => { + it('should return failed export result', done => { + const spans: ReadableSpan[] = []; + spans.push(Object.assign({}, mockedReadableSpan)); + spySend.throws({ + code: 100, + details: 'Test error', + metadata: {}, + message: 'Non-retryable', + stack: 'Stack', + }); + const callbackSpy = sinon.spy(); + collectorTraceExporter.export(spans, callbackSpy); + setTimeout(() => { + const returnCode = callbackSpy.args[0][0]; + assert.strictEqual( + returnCode.code, + ExportResultCode.FAILED, + 'return value is wrong' + ); + assert.strictEqual( + returnCode.error.message, + 'Non-retryable', + 'return error message is wrong' + ); + assert.strictEqual(spySend.callCount, 1, 'should call send'); + done(); + }); + }); + }); + }); + describe('export with custom headers', () => { let server: any; const customHeaders = { @@ -249,7 +384,8 @@ describe('OTLPTraceExporter - web', () => { ); }); it('should successfully send custom headers using XMLHTTPRequest', done => { - collectorTraceExporter.export(spans, () => { }); + collectorTraceExporter.export(spans, () => { + }); setTimeout(() => { const [{ requestHeaders }] = server.requests; @@ -272,7 +408,8 @@ describe('OTLPTraceExporter - web', () => { }); it('should successfully send spans using XMLHttpRequest', done => { - collectorTraceExporter.export(spans, () => { }); + collectorTraceExporter.export(spans, () => { + }); setTimeout(() => { const [{ requestHeaders }] = server.requests; @@ -286,6 +423,35 @@ describe('OTLPTraceExporter - web', () => { }); }); }); + + describe('export - concurrency limit', () => { + it('should error if too many concurrent exports are queued', done => { + const collectorExporterWithConcurrencyLimit = new OTLPTraceExporter({ + ...collectorExporterConfig, + concurrencyLimit: 3, + }); + const spans: ReadableSpan[] = [{ ...mockedReadableSpan }]; + const callbackSpy = sinon.spy(); + for (let i = 0; i < 7; i++) { + collectorExporterWithConcurrencyLimit.export(spans, callbackSpy); + } + + const failures = callbackSpy.args.filter(([result]) => result.code === ExportResultCode.FAILED); + + setTimeout(() => { + // Expect 4 failures + assert.strictEqual(failures.length, 4); + failures.forEach(([result]) => { + assert.strictEqual(result.code, ExportResultCode.FAILED); + assert.strictEqual( + result.error!.message, + 'Concurrent export limit reached' + ); + }); + done(); + }); + }); + }); }); describe('OTLPTraceExporter - browser (getDefaultUrl)', () => { diff --git a/experimental/packages/exporter-trace-otlp-http/test/common/transform.test.ts b/experimental/packages/exporter-trace-otlp-http/test/common/transform.test.ts index b2dfdf2145f..94932201b74 100644 --- a/experimental/packages/exporter-trace-otlp-http/test/common/transform.test.ts +++ b/experimental/packages/exporter-trace-otlp-http/test/common/transform.test.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { SpanAttributes } from '@opentelemetry/api'; +import { SpanAttributes, SpanStatusCode } from '@opentelemetry/api'; import { TimedEvent } from '@opentelemetry/sdk-trace-base'; import * as assert from 'assert'; import * as transform from '../../src/transform'; @@ -27,6 +27,7 @@ import { multiInstrumentationLibraryTrace, } from '../traceHelper'; import { Resource } from '@opentelemetry/resources'; + describe('transform', () => { describe('toCollectorAttributes', () => { it('should convert attribute string', () => { @@ -102,6 +103,44 @@ describe('transform', () => { }); }); + describe('toCollectorAnyValue', () => { + it('should use correct type on array', () => { + assert.deepStrictEqual(transform.toCollectorAnyValue(['string', true, 1]), { + arrayValue: { + values: + [ + { stringValue: 'string' }, + { boolValue: true }, + { intValue: 1 } + ] + } + }); + }); + + it('should use correct type on kvlist', () => { + assert.deepStrictEqual(transform.toCollectorAnyValue({ string: 'string', boolean: true, integer: 1 }), { + kvlistValue: { + values: + [ + { key: 'string', value: { stringValue: 'string' } }, + { key: 'boolean', value: { boolValue: true } }, + { key: 'integer', value: { intValue: 1 } } + ] + } + }); + }); + }); + + describe('toCollectorStatus', () => { + it('should set message if status is not undefined', () => { + const result = transform.toCollectorStatus({ + code: SpanStatusCode.OK, + message: 'message' + }); + assert.deepStrictEqual(result.message, 'message'); + }); + }); + describe('toCollectorSpan', () => { it('should convert span using hex', () => { ensureSpanIsCorrect(transform.toCollectorSpan(mockedReadableSpan, true)); diff --git a/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts index e01ff2980c9..6ddd63a0fcb 100644 --- a/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts +++ b/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts @@ -14,27 +14,29 @@ * limitations under the License. */ -import { diag } from '@opentelemetry/api'; +import { diag, DiagLogger } from '@opentelemetry/api'; import * as core from '@opentelemetry/core'; +import { + CompressionAlgorithm, + OTLPExporterError, + OTLPExporterNodeConfigBase +} from '@opentelemetry/otlp-exporter-base'; import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; -import * as http from 'http'; import * as assert from 'assert'; +import * as http from 'http'; import * as sinon from 'sinon'; import { PassThrough, Stream } from 'stream'; import * as zlib from 'zlib'; import { - OTLPTraceExporter, - OTLPExporterNodeConfigBase, - CompressionAlgorithm, + OTLPTraceExporter } from '../../src/platform/node'; import * as otlpTypes from '../../src/types'; -import { MockedResponse } from './nodeHelpers'; - import { ensureExportTraceServiceRequestIsSet, ensureSpanIsCorrect, - mockedReadableSpan, + mockedReadableSpan } from '../traceHelper'; +import { MockedResponse } from './nodeHelpers'; let fakeRequest: PassThrough; @@ -56,12 +58,23 @@ describe('OTLPTraceExporter - node with json over http', () => { it('should warn about metadata when using json', () => { const metadata = 'foo'; // Need to stub/spy on the underlying logger as the "diag" instance is global - const spyLoggerWarn = sinon.stub(diag, 'warn'); + const warnStub = sinon.stub(); + const nop = () => { + }; + const diagLogger: DiagLogger = { + debug: nop, + error: nop, + info: nop, + verbose: nop, + warn: warnStub + }; + diag.setLogger(diagLogger); + collectorExporter = new OTLPTraceExporter({ metadata, url: address, } as any); - const args = spyLoggerWarn.args[0]; + const args = warnStub.args[0]; assert.strictEqual(args[0], 'Metadata cannot be set when using http'); }); }); @@ -272,7 +285,7 @@ describe('OTLPTraceExporter - node with json over http', () => { setTimeout(() => { const result = responseSpy.args[0][0] as core.ExportResult; assert.strictEqual(result.code, core.ExportResultCode.FAILED); - const error = result.error as otlpTypes.OTLPExporterError; + const error = result.error as OTLPExporterError; assert.ok(error !== undefined); assert.strictEqual(error.code, 400); assert.strictEqual(error.data, 'failed'); diff --git a/experimental/packages/exporter-trace-otlp-http/tsconfig.json b/experimental/packages/exporter-trace-otlp-http/tsconfig.json index 8892d54c12e..82df98e67bc 100644 --- a/experimental/packages/exporter-trace-otlp-http/tsconfig.json +++ b/experimental/packages/exporter-trace-otlp-http/tsconfig.json @@ -17,6 +17,9 @@ }, { "path": "../../../packages/opentelemetry-sdk-trace-base" + }, + { + "path": "../otlp-exporter-base" } ] } diff --git a/experimental/packages/exporter-trace-otlp-proto/package.json b/experimental/packages/exporter-trace-otlp-proto/package.json index c54476524fd..6aae7831384 100644 --- a/experimental/packages/exporter-trace-otlp-proto/package.json +++ b/experimental/packages/exporter-trace-otlp-proto/package.json @@ -11,13 +11,10 @@ "clean": "tsc --build --clean", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "postcompile": "npm run submodule && npm run protos:copy", - "protos:copy": "cpx protos/opentelemetry/**/*.* build/protos/opentelemetry", - "submodule": "git submodule sync --recursive && git submodule update --init --recursive", "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "version": "node ../../../scripts/version-update.js", - "watch": "npm run protos:copy && tsc -w", + "watch": "tsc -w", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", @@ -74,6 +71,8 @@ "@opentelemetry/exporter-trace-otlp-http": "0.27.0", "@opentelemetry/resources": "1.1.1", "@opentelemetry/sdk-trace-base": "1.1.1", + "@opentelemetry/otlp-exporter-base": "0.27.0", + "@opentelemetry/otlp-proto-exporter-base": "0.27.0", "protobufjs": "^6.9.0" } } diff --git a/experimental/packages/exporter-trace-otlp-proto/src/OTLPTraceExporter.ts b/experimental/packages/exporter-trace-otlp-proto/src/OTLPTraceExporter.ts index 9b3c5a6effc..bb26b949bcc 100644 --- a/experimental/packages/exporter-trace-otlp-proto/src/OTLPTraceExporter.ts +++ b/experimental/packages/exporter-trace-otlp-proto/src/OTLPTraceExporter.ts @@ -15,15 +15,13 @@ */ import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base'; -import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; import { otlpTypes, - toOTLPExportTraceServiceRequest, - OTLPExporterNodeConfigBase, - appendResourcePathToUrlIfNotPresent, + toOTLPExportTraceServiceRequest } from '@opentelemetry/exporter-trace-otlp-http'; -import { ServiceClientType } from './types'; import { getEnv, baggageUtils } from '@opentelemetry/core'; +import { appendResourcePathToUrlIfNotPresent, OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base'; +import { OTLPProtoExporterNodeBase, ServiceClientType } from '@opentelemetry/otlp-proto-exporter-base'; const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/traces'; const DEFAULT_COLLECTOR_URL=`http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`; @@ -32,7 +30,7 @@ const DEFAULT_COLLECTOR_URL=`http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_P * Collector Trace Exporter for Node with protobuf */ export class OTLPTraceExporter - extends OTLPExporterNodeBase< + extends OTLPProtoExporterNodeBase< ReadableSpan, otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest > diff --git a/experimental/packages/exporter-trace-otlp-proto/src/index.ts b/experimental/packages/exporter-trace-otlp-proto/src/index.ts index bf4ab432ce8..761e8a92624 100644 --- a/experimental/packages/exporter-trace-otlp-proto/src/index.ts +++ b/experimental/packages/exporter-trace-otlp-proto/src/index.ts @@ -15,6 +15,3 @@ */ export * from './OTLPTraceExporter'; -export * from './OTLPExporterNodeBase'; -export * from './types'; -export * from './util'; diff --git a/experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts index 67b8c178680..9554fea1d84 100644 --- a/experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts +++ b/experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts @@ -17,9 +17,7 @@ import { diag } from '@opentelemetry/api'; import { ExportResultCode } from '@opentelemetry/core'; import { - OTLPExporterNodeConfigBase, - otlpTypes, - CompressionAlgorithm, + otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; import * as assert from 'assert'; @@ -28,13 +26,14 @@ import * as sinon from 'sinon'; import { Stream } from 'stream'; import * as zlib from 'zlib'; import { OTLPTraceExporter } from '../src'; -import { getExportRequestProto } from '../src/util'; import { ensureExportTraceServiceRequestIsSet, ensureProtoSpanIsCorrect, mockedReadableSpan, MockedResponse, } from './traceHelper'; +import { CompressionAlgorithm, OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base'; +import { getExportRequestProto } from '@opentelemetry/otlp-proto-exporter-base'; const fakeRequest = { end: function () { }, diff --git a/experimental/packages/exporter-trace-otlp-proto/tsconfig.json b/experimental/packages/exporter-trace-otlp-proto/tsconfig.json index 3b28c06f67e..69212c48784 100644 --- a/experimental/packages/exporter-trace-otlp-proto/tsconfig.json +++ b/experimental/packages/exporter-trace-otlp-proto/tsconfig.json @@ -20,6 +20,12 @@ }, { "path": "../exporter-trace-otlp-http" + }, + { + "path": "../otlp-exporter-base" + }, + { + "path": "../otlp-proto-exporter-base" } ] } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json index bb7d7e4ba49..72b18aa960c 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json @@ -11,13 +11,10 @@ "clean": "tsc --build --clean", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "postcompile": "npm run submodule && npm run protos:copy", - "protos:copy": "cpx protos/opentelemetry/**/*.* build/protos/opentelemetry", - "submodule": "git submodule sync --recursive && git submodule update --init --recursive", "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "version": "node ../../../scripts/version-update.js", - "watch": "npm run protos:copy && tsc -w", + "watch": "tsc -w", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", @@ -74,7 +71,7 @@ "@grpc/proto-loader": "^0.6.9", "@opentelemetry/core": "1.1.1", "@opentelemetry/exporter-metrics-otlp-http": "0.27.0", - "@opentelemetry/exporter-trace-otlp-grpc": "0.27.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.27.0", "@opentelemetry/exporter-trace-otlp-http": "0.27.0", "@opentelemetry/resources": "1.1.1", "@opentelemetry/sdk-metrics-base": "0.27.0" diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/protos b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/protos deleted file mode 160000 index 59c488bfb8f..00000000000 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/protos +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 59c488bfb8fb6d0458ad6425758b70259ff4a2bd diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts index 5ec71ef7ed5..af5960eace7 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/OTLPMetricExporter.ts @@ -23,22 +23,22 @@ import { } from '@opentelemetry/exporter-metrics-otlp-http'; import { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; import { - OTLPExporterConfigNode, - OTLPExporterNodeBase, + OTLPGRPCExporterConfigNode, + OTLPGRPCExporterNodeBase, ServiceClientType, validateAndNormalizeUrl -} from '@opentelemetry/exporter-trace-otlp-grpc'; +} from '@opentelemetry/otlp-grpc-exporter-base'; import { baggageUtils, getEnv } from '@opentelemetry/core'; import { Metadata } from '@grpc/grpc-js'; const DEFAULT_COLLECTOR_URL = 'localhost:4317'; -class OTLPMetricExporterProxy extends OTLPExporterNodeBase { protected readonly _aggregationTemporality: AggregationTemporality; - constructor(config: OTLPExporterConfigNode & OTLPMetricExporterOptions= defaultOptions) { + constructor(config: OTLPGRPCExporterConfigNode & OTLPMetricExporterOptions= defaultOptions) { super(config); this.metadata ||= new Metadata(); const headers = baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS); @@ -56,7 +56,7 @@ class OTLPMetricExporterProxy extends OTLPExporterNodeBase 0 @@ -79,7 +79,7 @@ class OTLPMetricExporterProxy extends OTLPExporterNodeBase{ - constructor(config: OTLPExporterConfigNode & OTLPMetricExporterOptions = defaultOptions) { + constructor(config: OTLPGRPCExporterConfigNode & OTLPMetricExporterOptions = defaultOptions) { super(new OTLPMetricExporterProxy(config), config); } } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/submodule.md b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/submodule.md deleted file mode 100644 index 4985e69dade..00000000000 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/submodule.md +++ /dev/null @@ -1,45 +0,0 @@ -# Important - -**Submodule is always pointing to certain revision number. So updating the submodule repo will not have impact on your code. -Knowing this if you want to change the submodule to point to a different version (when for example proto has changed) here is how to do it:** - -## Updating submodule to point to certain revision number - -1. Make sure you are in the same folder as this instruction - -2. Update your submodules by running this command - - ```shell script - git submodule sync --recursive - git submodule update --init --recursive - ``` - -3. Find the commit SHA which you want to update to and copy it (the long one) - -4. Enter a submodule directory from this directory - - ```shell script - cd protos - ``` - -5. Updates files in the submodule tree to given commit: - - ```shell script - git checkout -q - ``` - -6. Return to the main directory: - - ```shell script - cd ../ - ``` - -7. Please run `git status` you should see something like `Head detached at`. This is correct, go to next step - -8. Now thing which is very important. You have to commit this to apply these changes - - ```shell script - git commit -am "chore: updating submodule for opentelemetry-proto" - ``` - -9. If you look now at git log you will notice that the folder `protos` has been changed and it will show what was the previous sha and what is current one. diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts index fff613ec84e..b6d7e62b234 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/test/OTLPMetricExporter.test.ts @@ -38,9 +38,9 @@ import { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metr const metricsServiceProtoPath = 'opentelemetry/proto/collector/metrics/v1/metrics_service.proto'; -const includeDirs = [path.resolve(__dirname, '../protos')]; +const includeDirs = [path.resolve(__dirname, '../../otlp-grpc-exporter-base/protos')]; -const address = 'localhost:1501'; +const address = 'localhost:1502'; type TestParams = { useTLS?: boolean; @@ -325,3 +325,5 @@ describe('', () => { testOTLPMetricExporter({ metadata }); }); + + diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/tsconfig.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/tsconfig.json index fb3bcd8afa1..6380e3f172d 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/tsconfig.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/tsconfig.json @@ -15,9 +15,6 @@ { "path": "../../../packages/opentelemetry-resources" }, - { - "path": "../exporter-trace-otlp-grpc" - }, { "path": "../exporter-trace-otlp-http" }, @@ -29,6 +26,9 @@ }, { "path": "../opentelemetry-sdk-metrics-base" + }, + { + "path": "../otlp-grpc-exporter-base" } ] } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json index 339a705158b..c9d71652a84 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json @@ -97,6 +97,7 @@ "@opentelemetry/api-metrics": "0.27.0", "@opentelemetry/core": "1.1.1", "@opentelemetry/exporter-trace-otlp-http": "0.27.0", + "@opentelemetry/otlp-exporter-base": "0.27.0", "@opentelemetry/resources": "1.1.1", "@opentelemetry/sdk-metrics-base": "0.27.0" } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts index 39b238c39b7..7e99662ada5 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts @@ -16,8 +16,9 @@ import { ExportResult } from '@opentelemetry/core'; import { AggregationTemporality, PushMetricExporter, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; -import { OTLPExporterBase, otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; +import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; import { defaultOptions, OTLPMetricExporterOptions } from './OTLPMetricExporterOptions'; +import { OTLPExporterBase } from '@opentelemetry/otlp-exporter-base'; export class OTLPMetricExporterBase { protected readonly _aggregationTemporality: AggregationTemporality; - constructor(config: OTLPMetricExporterOptions & otlpTypes.OTLPExporterConfigBase = defaultOptions) { + constructor(config: OTLPMetricExporterOptions & OTLPExporterConfigBase = defaultOptions) { super(config); this._headers = Object.assign( this._headers, @@ -43,7 +46,7 @@ class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase 0 @@ -68,7 +71,7 @@ class OTLPExporterBrowserProxy extends OTLPExporterBrowserBase { - constructor(config: otlpTypes.OTLPExporterConfigBase & OTLPMetricExporterOptions = defaultOptions) { + constructor(config: OTLPExporterConfigBase & OTLPMetricExporterOptions = defaultOptions) { super(new OTLPExporterBrowserProxy(config), config); } } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts index 59d3e339cd3..bdf858113d9 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/OTLPMetricExporter.ts @@ -16,15 +16,17 @@ import { ResourceMetrics, AggregationTemporality } from '@opentelemetry/sdk-metrics-base'; import { - OTLPExporterNodeBase, - OTLPExporterNodeConfigBase, otlpTypes, - appendResourcePathToUrlIfNotPresent } from '@opentelemetry/exporter-trace-otlp-http'; import { toOTLPExportMetricServiceRequest } from '../../transformMetrics'; import { getEnv, baggageUtils} from '@opentelemetry/core'; import { defaultExporterTemporality, defaultOptions, OTLPMetricExporterOptions } from '../../OTLPMetricExporterOptions'; import { OTLPMetricExporterBase } from '../../OTLPMetricExporterBase'; +import { + appendResourcePathToUrlIfNotPresent, + OTLPExporterNodeBase, + OTLPExporterNodeConfigBase +} from '@opentelemetry/otlp-exporter-base'; const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics'; const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`; 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 955e8e6a8a0..819c02d0adb 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/transformMetrics.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/transformMetrics.ts @@ -15,8 +15,10 @@ */ import { SpanAttributes } from '@opentelemetry/api'; +import { ValueType } from '@opentelemetry/api-metrics'; import * as core from '@opentelemetry/core'; -import { OTLPExporterBase, otlpTypes, toCollectorResource } from '@opentelemetry/exporter-trace-otlp-http'; +import { otlpTypes, toCollectorResource } from '@opentelemetry/exporter-trace-otlp-http'; +import { OTLPExporterBase, OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; import { AggregationTemporality, DataPointType, @@ -25,7 +27,6 @@ import { MetricData, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; -import { ValueType } from '@opentelemetry/api-metrics'; /** * Converts {@link SpanAttributes} to a collector-compatible format. @@ -171,7 +172,7 @@ export function toCollectorMetric( * @param aggregationTemporality * @param collectorExporterBase */ -export function toOTLPExportMetricServiceRequest( +export function toOTLPExportMetricServiceRequest( metrics: ResourceMetrics, aggregationTemporality: AggregationTemporality, collectorExporterBase: OTLPExporterBase { let collectorExporter: OTLPMetricExporter; @@ -332,7 +333,7 @@ describe('OTLPMetricExporter - web', () => { foo: 'bar', bar: 'baz', }; - let collectorExporterConfig: (otlpTypes.OTLPExporterConfigBase & OTLPMetricExporterOptions) | undefined; + let collectorExporterConfig: (OTLPExporterConfigBase & OTLPMetricExporterOptions) | undefined; beforeEach(() => { collectorExporterConfig = { diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/common/CollectorMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/common/CollectorMetricExporter.test.ts index 0e941ed7e20..9c2b4e4c898 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/common/CollectorMetricExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/common/CollectorMetricExporter.test.ts @@ -20,10 +20,11 @@ import { } from '@opentelemetry/sdk-metrics-base'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import { OTLPExporterBase, otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; +import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; import { collect, mockCounter, mockObservableGauge, setUp, shutdown } from '../metricsHelper'; +import { OTLPExporterBase, OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; -type CollectorExporterConfig = otlpTypes.OTLPExporterConfigBase; +type CollectorExporterConfig = OTLPExporterConfigBase; class OTLPMetricExporter extends OTLPExporterBase< CollectorExporterConfig, ResourceMetrics, diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts index 1e11f733d4c..d5eb13986da 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts @@ -27,7 +27,7 @@ import { import { OTLPMetricExporter } from '../../src/platform/node'; -import { OTLPExporterNodeConfigBase, otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; +import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; import { ensureCounterIsCorrect, ensureExportMetricsServiceRequestIsSet, @@ -40,6 +40,7 @@ import { } from '../metricsHelper'; import { MockedResponse } from './nodeHelpers'; import { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; +import { OTLPExporterError, OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base'; const fakeRequest = { end: function () { @@ -308,7 +309,7 @@ describe('OTLPMetricExporter - node with json over http', () => { setTimeout(() => { const result = responseSpy.args[0][0] as core.ExportResult; assert.strictEqual(result.code, core.ExportResultCode.FAILED); - const error = result.error as otlpTypes.OTLPExporterError; + const error = result.error as OTLPExporterError; assert.ok(error !== undefined); assert.strictEqual(error.code, 400); assert.strictEqual(error.data, 'failed'); diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/tsconfig.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/tsconfig.json index 7bf7d7dfbda..db701b33104 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/tsconfig.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/tsconfig.json @@ -23,6 +23,9 @@ }, { "path": "../opentelemetry-sdk-metrics-base" + }, + { + "path": "../otlp-exporter-base" } ] } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json index 4e31d16d554..c0a77777a41 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json @@ -11,13 +11,10 @@ "clean": "tsc --build --clean", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "postcompile": "npm run submodule && npm run protos:copy", - "protos:copy": "cpx protos/opentelemetry/**/*.* build/protos/opentelemetry", - "submodule": "git submodule sync --recursive && git submodule update --init --recursive", "tdd": "npm run test -- --watch-extensions ts --watch", "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "version": "node ../../../scripts/version-update.js", - "watch": "npm run protos:copy && tsc -w", + "watch": "tsc -w", "precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies", "prewatch": "npm run precompile", "peer-api-check": "node ../../../scripts/peer-api-check.js", @@ -73,8 +70,9 @@ "@grpc/proto-loader": "0.6.9", "@opentelemetry/core": "1.1.1", "@opentelemetry/exporter-metrics-otlp-http": "0.27.0", + "@opentelemetry/otlp-proto-exporter-base": "0.27.0", + "@opentelemetry/otlp-exporter-base": "0.27.0", "@opentelemetry/exporter-trace-otlp-http": "0.27.0", - "@opentelemetry/exporter-trace-otlp-proto": "0.27.0", "@opentelemetry/resources": "1.1.1", "@opentelemetry/sdk-metrics-base": "0.27.0", "protobufjs": "^6.9.0" diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/protos b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/protos deleted file mode 160000 index 59c488bfb8f..00000000000 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/protos +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 59c488bfb8fb6d0458ad6425758b70259ff4a2bd diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/OTLPMetricExporter.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/OTLPMetricExporter.ts index 95648bb35e4..105f0c2cf39 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/OTLPMetricExporter.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/OTLPMetricExporter.ts @@ -15,9 +15,7 @@ */ import { - otlpTypes, - OTLPExporterNodeConfigBase, - appendResourcePathToUrlIfNotPresent, + otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; import { defaultExporterTemporality, @@ -25,16 +23,17 @@ import { OTLPMetricExporterOptions, toOTLPExportMetricServiceRequest } from '@opentelemetry/exporter-metrics-otlp-http'; -import { ServiceClientType, OTLPExporterNodeBase } from '@opentelemetry/exporter-trace-otlp-proto'; +import { ServiceClientType, OTLPProtoExporterNodeBase } from '@opentelemetry/otlp-proto-exporter-base'; import { getEnv, baggageUtils} from '@opentelemetry/core'; import { AggregationTemporality, ResourceMetrics} from '@opentelemetry/sdk-metrics-base'; import { OTLPMetricExporterBase } from '@opentelemetry/exporter-metrics-otlp-http'; +import { appendResourcePathToUrlIfNotPresent, OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base'; const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics'; const DEFAULT_COLLECTOR_URL = `http://localhost:4318${DEFAULT_COLLECTOR_RESOURCE_PATH}`; -class OTLPMetricExporterNodeProxy extends OTLPExporterNodeBase { protected readonly _aggregationTemporality: AggregationTemporality; diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts index 429096aff09..910e02739f4 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts @@ -17,10 +17,9 @@ import { diag } from '@opentelemetry/api'; import { ExportResultCode } from '@opentelemetry/core'; import { - OTLPExporterNodeConfigBase, - otlpTypes, + otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; -import { getExportRequestProto } from '@opentelemetry/exporter-trace-otlp-proto'; +import { getExportRequestProto } from '@opentelemetry/otlp-proto-exporter-base'; import * as assert from 'assert'; import * as http from 'http'; import * as sinon from 'sinon'; @@ -38,6 +37,7 @@ import { } from './metricsHelper'; import { AggregationTemporality, ResourceMetrics } from '@opentelemetry/sdk-metrics-base'; import { OTLPMetricExporterOptions } from '@opentelemetry/exporter-metrics-otlp-http'; +import { OTLPExporterNodeConfigBase } from '@opentelemetry/otlp-exporter-base'; const fakeRequest = { end: function () { diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.json index 0a777291345..d81d9c0a675 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/tsconfig.json @@ -18,9 +18,6 @@ { "path": "../exporter-trace-otlp-http" }, - { - "path": "../exporter-trace-otlp-proto" - }, { "path": "../opentelemetry-api-metrics" }, @@ -29,6 +26,12 @@ }, { "path": "../opentelemetry-sdk-metrics-base" + }, + { + "path": "../otlp-exporter-base" + }, + { + "path": "../otlp-proto-exporter-base" } ] } diff --git a/experimental/packages/otlp-exporter-base/.eslintignore b/experimental/packages/otlp-exporter-base/.eslintignore new file mode 100644 index 00000000000..378eac25d31 --- /dev/null +++ b/experimental/packages/otlp-exporter-base/.eslintignore @@ -0,0 +1 @@ +build diff --git a/experimental/packages/otlp-exporter-base/.eslintrc.js b/experimental/packages/otlp-exporter-base/.eslintrc.js new file mode 100644 index 00000000000..e41d9a9299b --- /dev/null +++ b/experimental/packages/otlp-exporter-base/.eslintrc.js @@ -0,0 +1,9 @@ +module.exports = { + "env": { + "mocha": true, + "commonjs": true, + "node": true, + "browser": true + }, + ...require('../../../eslint.config.js') +} diff --git a/experimental/packages/otlp-exporter-base/.npmignore b/experimental/packages/otlp-exporter-base/.npmignore new file mode 100644 index 00000000000..9505ba9450f --- /dev/null +++ b/experimental/packages/otlp-exporter-base/.npmignore @@ -0,0 +1,4 @@ +/bin +/coverage +/doc +/test diff --git a/experimental/packages/otlp-exporter-base/LICENSE b/experimental/packages/otlp-exporter-base/LICENSE new file mode 100644 index 00000000000..5d6f747bfde --- /dev/null +++ b/experimental/packages/otlp-exporter-base/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2020 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 + + http://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. diff --git a/experimental/packages/otlp-exporter-base/README.md b/experimental/packages/otlp-exporter-base/README.md new file mode 100644 index 00000000000..cdb8a26cdcb --- /dev/null +++ b/experimental/packages/otlp-exporter-base/README.md @@ -0,0 +1,42 @@ +# OpenTelemetry Collector Exporter for web and node + +[![NPM Published Version][npm-img]][npm-url] +[![Apache License][license-image]][license-image] + +This module provides a base exporter for web and node to be used with [opentelemetry-collector][opentelemetry-collector-url]. + +## Installation + +```bash +npm install --save @opentelemetry/otlp-exporter-base +``` + +## GRPC + +For GRPC please check [npm-url-grpc] + +## PROTOBUF + +For PROTOBUF please check [npm-url-proto] + +## Useful links + +- For more information on OpenTelemetry, visit: +- For more about OpenTelemetry JavaScript: +- For help or feedback on this project, join us in [GitHub Discussions][discussions-url] + +## License + +Apache 2.0 - See [LICENSE][license-url] for more information. + +[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions +[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE +[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat +[npm-url]: https://www.npmjs.com/package/@opentelemetry/otlp-exporter-base +[npm-url-grpc]: https://www.npmjs.com/package/@opentelemetry/otlp-grpc-exporter-base +[npm-url-proto]: https://www.npmjs.com/package/@opentelemetry/otlp-proto-exporter-base +[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fotlp-exporter-base.svg +[opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector +[opentelemetry-spec-protocol-exporter]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options +[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service +[metrics-exporter-url]: https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-http diff --git a/experimental/packages/otlp-exporter-base/karma.conf.js b/experimental/packages/otlp-exporter-base/karma.conf.js new file mode 100644 index 00000000000..4c60b54edba --- /dev/null +++ b/experimental/packages/otlp-exporter-base/karma.conf.js @@ -0,0 +1,26 @@ +/*! + * 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 + * + * http://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 karmaWebpackConfig = require('../../../karma.webpack'); +const karmaBaseConfig = require('../../../karma.base'); + +module.exports = (config) => { + config.set(Object.assign({}, karmaBaseConfig, { + webpack: karmaWebpackConfig, + files: ['test/browser/index-webpack.ts'], + preprocessors: { 'test/browser/index-webpack.ts': ['webpack'] } + })) +}; diff --git a/experimental/packages/otlp-exporter-base/package.json b/experimental/packages/otlp-exporter-base/package.json new file mode 100644 index 00000000000..f389ac9650e --- /dev/null +++ b/experimental/packages/otlp-exporter-base/package.json @@ -0,0 +1,78 @@ +{ + "name": "@opentelemetry/otlp-exporter-base", + "version": "0.27.0", + "description": "OpenTelemetry OTLP Exporter base (for internal use only)", + "main": "build/src/index.js", + "module": "build/esm/index.js", + "esnext": "build/esnext/index.js", + "types": "build/src/index.d.ts", + "repository": "open-telemetry/opentelemetry-js", + "browser": { + "./src/platform/index.ts": "./src/platform/browser/index.ts", + "./build/esm/platform/index.js": "./build/esm/platform/browser/index.js", + "./build/esnext/platform/index.js": "./build/esnext/platform/browser/index.js", + "./build/src/platform/index.js": "./build/src/platform/browser/index.js" + }, + "scripts": { + "prepublishOnly": "npm run compile", + "compile": "tsc --build tsconfig.all.json", + "clean": "tsc --build --clean tsconfig.all.json", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", + "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", + "lint": "eslint . --ext .ts", + "lint:fix": "eslint . --ext .ts --fix", + "tdd": "npm run test -- --watch-extensions ts --watch", + "tdd:browser": "karma start", + "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", + "test:browser": "nyc karma start --single-run", + "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" + }, + "keywords": [ + "opentelemetry", + "nodejs", + "tracing", + "profiling", + "metrics", + "stats", + "monitoring" + ], + "author": "OpenTelemetry Authors", + "license": "Apache-2.0", + "engines": { + "node": ">=8.12.0" + }, + "files": [ + "build/src/**/*.js", + "build/src/**/*.js.map", + "build/src/**/*.d.ts", + "LICENSE", + "README.md" + ], + "publishConfig": { + "access": "public" + }, + "dependencies": { + "@opentelemetry/core": "1.1.1" + }, + "devDependencies": { + "@opentelemetry/api": "^1.0.0", + "@types/mocha": "8.2.3", + "@types/node": "14.17.33", + "@types/sinon": "10.0.6", + "codecov": "3.8.3", + "istanbul-instrumenter-loader": "3.0.1", + "mocha": "7.2.0", + "nock": "13.0.11", + "nyc": "15.1.0", + "sinon": "12.0.1", + "ts-loader": "8.3.0", + "ts-mocha": "8.0.0", + "typescript": "4.4.4" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0" + } +} diff --git a/experimental/packages/exporter-trace-otlp-http/src/OTLPExporterBase.ts b/experimental/packages/otlp-exporter-base/src/OTLPExporterBase.ts similarity index 99% rename from experimental/packages/exporter-trace-otlp-http/src/OTLPExporterBase.ts rename to experimental/packages/otlp-exporter-base/src/OTLPExporterBase.ts index 1679aae11ea..421ceae2e92 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/OTLPExporterBase.ts +++ b/experimental/packages/otlp-exporter-base/src/OTLPExporterBase.ts @@ -29,7 +29,7 @@ export abstract class OTLPExporterBase< T extends OTLPExporterConfigBase, ExportItem, ServiceRequest -> { + > { public readonly url: string; public readonly hostname: string | undefined; public readonly attributes?: SpanAttributes; diff --git a/experimental/packages/otlp-exporter-base/src/index.ts b/experimental/packages/otlp-exporter-base/src/index.ts new file mode 100644 index 00000000000..e1149d2add1 --- /dev/null +++ b/experimental/packages/otlp-exporter-base/src/index.ts @@ -0,0 +1,19 @@ +/* + * 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. + */ +export * from './OTLPExporterBase'; +export * from './platform'; +export * from './types'; +export * from './util'; diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/browser/OTLPExporterBrowserBase.ts b/experimental/packages/otlp-exporter-base/src/platform/browser/OTLPExporterBrowserBase.ts similarity index 100% rename from experimental/packages/exporter-trace-otlp-http/src/platform/browser/OTLPExporterBrowserBase.ts rename to experimental/packages/otlp-exporter-base/src/platform/browser/OTLPExporterBrowserBase.ts diff --git a/experimental/packages/otlp-exporter-base/src/platform/browser/index.ts b/experimental/packages/otlp-exporter-base/src/platform/browser/index.ts new file mode 100644 index 00000000000..c9678a80178 --- /dev/null +++ b/experimental/packages/otlp-exporter-base/src/platform/browser/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './OTLPExporterBrowserBase'; diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/browser/util.ts b/experimental/packages/otlp-exporter-base/src/platform/browser/util.ts similarity index 87% rename from experimental/packages/exporter-trace-otlp-http/src/platform/browser/util.ts rename to experimental/packages/otlp-exporter-base/src/platform/browser/util.ts index 8030552c17f..af47f4bebf2 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/platform/browser/util.ts +++ b/experimental/packages/otlp-exporter-base/src/platform/browser/util.ts @@ -14,11 +14,13 @@ * limitations under the License. */ import { diag } from '@opentelemetry/api'; -import * as otlpTypes from '../../types'; +import { OTLPExporterError } from '../../types'; /** * Send metrics/spans using browser navigator.sendBeacon * @param body + * @param url + * @param blobPropertyBag * @param onSuccess * @param onError */ @@ -27,13 +29,13 @@ export function sendWithBeacon( url: string, blobPropertyBag: BlobPropertyBag, onSuccess: () => void, - onError: (error: otlpTypes.OTLPExporterError) => void + onError: (error: OTLPExporterError) => void ): void { if (navigator.sendBeacon(url, new Blob([body], blobPropertyBag))) { diag.debug('sendBeacon - can send', body); onSuccess(); } else { - const error = new otlpTypes.OTLPExporterError( + const error = new OTLPExporterError( `sendBeacon - cannot send ${body}` ); onError(error); @@ -44,6 +46,8 @@ export function sendWithBeacon( * function to send metrics/spans using browser XMLHttpRequest * used when navigator.sendBeacon is not available * @param body + * @param url + * @param headers * @param onSuccess * @param onError */ @@ -52,7 +56,7 @@ export function sendWithXhr( url: string, headers: Record, onSuccess: () => void, - onError: (error: otlpTypes.OTLPExporterError) => void + onError: (error: OTLPExporterError) => void ): void { const xhr = new XMLHttpRequest(); xhr.open('POST', url); @@ -77,11 +81,10 @@ export function sendWithXhr( diag.debug('xhr success', body); onSuccess(); } else { - const error = new otlpTypes.OTLPExporterError( + const error = new OTLPExporterError( `Failed to export with XHR (status: ${xhr.status})`, xhr.status ); - onError(error); } } diff --git a/experimental/packages/otlp-exporter-base/src/platform/index.ts b/experimental/packages/otlp-exporter-base/src/platform/index.ts new file mode 100644 index 00000000000..86a320fde66 --- /dev/null +++ b/experimental/packages/otlp-exporter-base/src/platform/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export * from './node'; +export { OTLPExporterBrowserBase } from './browser'; diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPExporterNodeBase.ts b/experimental/packages/otlp-exporter-base/src/platform/node/OTLPExporterNodeBase.ts similarity index 100% rename from experimental/packages/exporter-trace-otlp-http/src/platform/node/OTLPExporterNodeBase.ts rename to experimental/packages/otlp-exporter-base/src/platform/node/OTLPExporterNodeBase.ts diff --git a/experimental/packages/otlp-exporter-base/src/platform/node/index.ts b/experimental/packages/otlp-exporter-base/src/platform/node/index.ts new file mode 100644 index 00000000000..8a75162ea2d --- /dev/null +++ b/experimental/packages/otlp-exporter-base/src/platform/node/index.ts @@ -0,0 +1,19 @@ +/* + * 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. + */ + +export * from './OTLPExporterNodeBase'; +export * from './util'; +export * from './types'; diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/node/types.ts b/experimental/packages/otlp-exporter-base/src/platform/node/types.ts similarity index 100% rename from experimental/packages/exporter-trace-otlp-http/src/platform/node/types.ts rename to experimental/packages/otlp-exporter-base/src/platform/node/types.ts diff --git a/experimental/packages/exporter-trace-otlp-http/src/platform/node/util.ts b/experimental/packages/otlp-exporter-base/src/platform/node/util.ts similarity index 96% rename from experimental/packages/exporter-trace-otlp-http/src/platform/node/util.ts rename to experimental/packages/otlp-exporter-base/src/platform/node/util.ts index 8ea6d49f4de..392063cea72 100644 --- a/experimental/packages/exporter-trace-otlp-http/src/platform/node/util.ts +++ b/experimental/packages/otlp-exporter-base/src/platform/node/util.ts @@ -18,12 +18,12 @@ import * as http from 'http'; import * as https from 'https'; import * as zlib from 'zlib'; import { Readable } from 'stream'; -import * as otlpTypes from '../../types'; import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; import { OTLPExporterNodeConfigBase } from '.'; import { diag } from '@opentelemetry/api'; import { CompressionAlgorithm } from './types'; import { getEnv } from '@opentelemetry/core'; +import { OTLPExporterError } from '../../types'; let gzip: zlib.Gzip | undefined; @@ -40,7 +40,7 @@ export function sendWithHttp( data: string | Buffer, contentType: string, onSuccess: () => void, - onError: (error: otlpTypes.OTLPExporterError) => void + onError: (error: OTLPExporterError) => void ): void { const parsedUrl = new url.URL(collector.url); @@ -66,7 +66,7 @@ export function sendWithHttp( diag.debug(`statusCode: ${res.statusCode}`, responseData); onSuccess(); } else { - const error = new otlpTypes.OTLPExporterError( + const error = new OTLPExporterError( res.statusMessage, res.statusCode, responseData diff --git a/experimental/packages/otlp-exporter-base/src/types.ts b/experimental/packages/otlp-exporter-base/src/types.ts new file mode 100644 index 00000000000..ffe91fda80b --- /dev/null +++ b/experimental/packages/otlp-exporter-base/src/types.ts @@ -0,0 +1,55 @@ +/* + * 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. + */ + +import { SpanAttributes } from '@opentelemetry/api'; + +/** + * Interface for handling error + */ +export class OTLPExporterError extends Error { + readonly code?: number; + override readonly name: string = 'OTLPExporterError'; + readonly data?: string; + + constructor(message?: string, code?: number, data?: string) { + super(message); + this.data = data; + this.code = code; + } +} + +/** + * Interface for handling export service errors + */ +export interface ExportServiceError { + name: string; + code: number; + details: string; + metadata: { [key: string]: unknown }; + message: string; + stack: string; +} + +/** + * Collector Exporter base config + */ +export interface OTLPExporterConfigBase { + headers?: Partial>; + hostname?: string; + attributes?: SpanAttributes; + url?: string; + concurrencyLimit?: number; +} diff --git a/experimental/packages/exporter-trace-otlp-http/src/util.ts b/experimental/packages/otlp-exporter-base/src/util.ts similarity index 100% rename from experimental/packages/exporter-trace-otlp-http/src/util.ts rename to experimental/packages/otlp-exporter-base/src/util.ts diff --git a/experimental/packages/otlp-exporter-base/test/browser/index-webpack.ts b/experimental/packages/otlp-exporter-base/test/browser/index-webpack.ts new file mode 100644 index 00000000000..99100a0f6ee --- /dev/null +++ b/experimental/packages/otlp-exporter-base/test/browser/index-webpack.ts @@ -0,0 +1,23 @@ +/* + * 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 testsContext = require.context('../browser', true, /test$/); +testsContext.keys().forEach(testsContext); + +const testsContextCommon = require.context('../common', true, /test$/); +testsContextCommon.keys().forEach(testsContextCommon); + +const srcContext = require.context('.', true, /src$/); +srcContext.keys().forEach(srcContext); diff --git a/experimental/packages/exporter-trace-otlp-http/test/browser/util.test.ts b/experimental/packages/otlp-exporter-base/test/browser/util.test.ts similarity index 97% rename from experimental/packages/exporter-trace-otlp-http/test/browser/util.test.ts rename to experimental/packages/otlp-exporter-base/test/browser/util.test.ts index 3cb6aa44740..106e04b4da4 100644 --- a/experimental/packages/exporter-trace-otlp-http/test/browser/util.test.ts +++ b/experimental/packages/otlp-exporter-base/test/browser/util.test.ts @@ -16,7 +16,7 @@ import * as sinon from 'sinon'; import { sendWithXhr } from '../../src/platform/browser/util'; -import { ensureHeadersContain } from '../traceHelper'; +import { ensureHeadersContain } from '../testHelper'; describe('util - browser', () => { let server: any; @@ -49,8 +49,8 @@ describe('util - browser', () => { describe('and Content-Type header is set', () => { beforeEach(()=>{ const explicitContentType = { - 'Content-Type': 'application/json', - }; + 'Content-Type': 'application/json', + }; sendWithXhr(body, url, explicitContentType, onSuccessStub, onErrorStub); }); it('Request Headers should contain "Content-Type" header', done => { diff --git a/experimental/packages/otlp-exporter-base/test/certs/ca.crt b/experimental/packages/otlp-exporter-base/test/certs/ca.crt new file mode 100644 index 00000000000..529ce2f7b86 --- /dev/null +++ b/experimental/packages/otlp-exporter-base/test/certs/ca.crt @@ -0,0 +1,33 @@ +-----BEGIN CERTIFICATE----- +MIIFozCCA4ugAwIBAgIUa6OxgyEYxNjpjac0jTAKn+IkGTYwDQYJKoZIhvcNAQEL +BQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRow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SMocah0cTqX4owoPL4+zV1pe5FQzAPBgNVHRMBAf8EBTAD +AQH/MA0GCSqGSIb3DQEBCwUAA4ICAQCIpnaYSMXT+nrdOgw2zKHTk47wANGf6nfK +76VwsQfzVkJm/tzEgq+saEznGRW1ttdQfXHJM3NCfneVhjXDkihrHsxiL4S+5OMq +cusp2tKupGXlxwOt7tsAhH5j4SQLyEUiWMmm/Wvwtx2HWuNO8LZGhoAcUrT7r94f +vqr3tYyb3D06/rBRj2QcybYGJHsQAULEQvmWJvCveh5gqxkRjDJlwmqV/lIarPCt +diKbsZqHJMNaRMbgsxV8hVSvD6RKtBG+K8hpuHF2ZKfzb7Yt1IDPtUGCL811ykzh +2PjumjaQ2JCP6vtYAhTS1r/+cbOi+4v5JzF+kxHxFc9vK/gzBT88174S2MQaqwhF +jQiS3YfElLXkr37E9gxMKLDanbFsxPPiXO96s0RSjNK2mzSbz/gfmsjGqxKNq3t1 +IwAfjePmmx4FJ1O/FwOA5RWE+KRhzNucktjxz39oZrnqtPeTqHnAivNOyK3XB68v +5HRjP79TrzIbLCauyJD/qM5UtCRXW2La1rsH8lIBtcxUcZOkvDnE6Po44D5hH2kQ +swRqF9Vy7PL9MWJPTgn4+WFLNoBe+nMY82y7xstRv7c2ctXpAxSWxIXgBN+B9nXo +3Lqpgg0UkjTiCp13Mejq/7DYAw+/Ou8bxWs3BuCQvFcG2+FBMWh0dL1FxVq3BPyq +oveTgr1sfQ== +-----END CERTIFICATE----- diff --git a/experimental/packages/otlp-exporter-base/test/certs/ca.key b/experimental/packages/otlp-exporter-base/test/certs/ca.key new file mode 100644 index 00000000000..df94d44c380 --- /dev/null +++ b/experimental/packages/otlp-exporter-base/test/certs/ca.key @@ -0,0 +1,54 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CBC,7EE0C188F59416E9 + +C6U1lvr1RyEnqzF5P05cyDgQChQICuJIj1C6N8CA/5izdK1kk84qSHlrHYZD9bOC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VI515OyaZffvnU5KL60AMxp71iqDycsB1IIw/aJFJDYL7jf6y52pX5e/79JiSx +v9+J3TekWrDOcZ4aryujneZng5b/PzH+vidGcSw1lMBb9KUPwb+6nk5aFl97lbsz +sEFon4fuDHdf5X4PbSzjsDw7584OqXIXOVhSnNZg2bGj622E3SCicJl1cjx7bHmf +Zl1RrVcrMqQuy6M6NXJT8H7vp+wXWW0wgHG+VEyvxNKkQC9TMM9R3qcAn1ByFp4i +Q/L0EcDeuoTbAyHRYY6W+R3sWcEikayU8lDndqjGyM8qI31suxHFdcy4z5UaE/59 +4Iosr7DpxD8Ny51VLF3yF/HeQhTD8EE/nMtHUPOBkjSZ6A/wUiHl9fWRtaZJASwK +1lVXUe4n9vNOWlSXkY7QNKYAPf1ZLjZOrutiXny8nPWeMggaalCRIucP/rK2icae +McSOb8Jzp01OSRfft1MN8qQHZENE3GheKSnU4upC+anjpsF4yWoFE7wVSLom76AO +N2OqwPQFEgzn5BZRuPXiOsfhoafr+GtiC8mY87GE9cIFPtoVTVUbDgspAzxszy4d +VGunmfyRPaedUAlqy510ygdUzWTfZsKPC6XJEM9gSTOblERvIGOOquUk4F1vC/Wu +ihjhHr4usrXV/FinfYbCIrU+9WPNp8fKoNajHEkge5gWwBE75xkouSK20JRdfE90 +2d2g87EdcE7BTlcQGqCAe4N6RwK6V+kEZrHrBCQoXGtSM96opTM878krkcRap7ci +nwnP/EvD5CfNgT7uGn/dleNs5f4325PYA2uGPgBfJIpTkgGR7DyUjR8AU4mP8hwc +j0GydgSuYF0AOUNQRZuiNlHT3Buio7lKJMmwuuLFSACcnp9LVBhRgbypDRIxGSFw +GST/70V5OaDibFC7bl37pbKh1qzBqVB1qlylqxvS/ZID3iMEqjuuumYBO11Pkm1f +-----END RSA PRIVATE KEY----- diff --git a/experimental/packages/otlp-exporter-base/test/certs/client.crt b/experimental/packages/otlp-exporter-base/test/certs/client.crt new file mode 100644 index 00000000000..b1519dede6e --- /dev/null +++ b/experimental/packages/otlp-exporter-base/test/certs/client.crt @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV +BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAxMDExWhcN +MjIwNjA3MjAxMDExWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZD +bGllbnQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIP +ADCCAgoCggIBAN1or7F+548RpVIgdrzYmuWgKMfWsO5FhgqpGp+xuoVgMMTlZM3i +yiarMnAE0G6ZVMwqCeXkiUGL9QLatJ1S/HO2sWLUkWaPD7X7O4k1yGtl6UsRcr4K ++YBUbucxfrCQjaWKlBc1GMBrDyY/u/rl0CIYu3GtegniN6HG6rBXC2e98DVctQ3M +r/RXB9DWqMC2KW2X92X+FyWqTfGjv8wjRnhQdDNXPA/PCembzhfCL8VlmG65rDiz +VQxiTotTOCmaxULdF307jorMTLIHZVV2OnAA/udeDcxITnKcksLiRKKAiHUXMIPq +RGxNtLX1sdBD/FoQ28sr8o6Ko7qb3uaA4CZhp2I4RR925oZISyObzY3QxrlafN4g +hFnWkTFJY0K+43cxta8K3gAnQXxN/BANDEydS1YM9adqYbt09wctSUjMqJHGZWnn +IVOged+/DEIW9EmyLSPM1DC1s1owOrgwBXzHRRNXuUFjZPPrMC8TkBexNjsapLjr +nE/xa5cB80DIntkM8ysfLU6p39NihM2hmeyI2YS8osheElXEL3dz5vM8Wzv28qgF +PvGpdYz6cAibE9qJ+oT416dVc+9G6i1fcBl7X8w+KUGVFsRnftovwjoSToGlckqg +dv1Tsf6FBDpSMro3BbGogpDhkSxy//eWvzejjHBemz06Kh2DGkKhnT9rAgMBAAEw +DQYJKoZIhvcNAQELBQADggIBAIGWBdgWOoqGIy0fuSbqQgjgrhDrPGBV15TfvB4T +84xfk9YZxdRKkG3J65uLffTnnotZs6gqLx6MfosR6zQYhSK27fTXpJJdRaI55kgT +2e/xNCe867Bz/3nW+vwWIGTuFn6hFq9f8HNLZMpHu3DClj7AB7ga6qp1uFWIn5oq +xC4da8/JTR6FY2srIktyH5Vr64FnhtX9cLSa/U7df7asZjRUm6ndPS49X01G6BJQ +vH0RO1caCCbpDVqPwJnAf3BXD1MkKsNe4hULt25XCxSsyM7v0Ru4KcSSGxiYHowQ ++VzRdJVYe8ytpcg1eVlWutOlDXGLaeGNQ0/u5OEQ8iqZvp1/qiq/LQIRZlxa+ZlL +vsVAgOxolRpm6W01cYCCWX8utsrMq8lKjMIal0SZhj6oP/rwtH8UVRhqhrQyAn6y +K6IYGLGvXGacJYuHpcAFQ0f8LUCCs0kxN/zZOZ98atF0MvgUWKZFNgrvcX5se8iV +kS/7UHH4Ie9ZO6Hv9IvnElOfZY9dnFPNxcbWnA7U0kLa5CWh8CD55ScAGHrvcz3O +JXPW0SHb2xZmXDTfgmS4vMI5PYDyipSCoUDClA3BPr/dkAVssj8SMikJZWhVvDrK +IcKRHpkmrzLJbatxeDNlCtLRSAXeuTheLqqSA2HACReNYkQLPd5V7mY6uRw3d3o6 +3rKe +-----END CERTIFICATE----- diff --git a/experimental/packages/otlp-exporter-base/test/certs/client.csr b/experimental/packages/otlp-exporter-base/test/certs/client.csr new file mode 100644 index 00000000000..2d99fab566a --- /dev/null +++ b/experimental/packages/otlp-exporter-base/test/certs/client.csr @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH +DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEV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Ayu +OHL+uwUdBYBk3NS4xKyXWXhG58AyNvGYWIO0tWTYmIVVuL2JDrNGY4QdIDQBoj+4 +hppmh0mYbvDCXolKjUVFC0wHRACaRCN1WLIKP8heE0vZsvXq/7ssuP3DtCDHRadk +pHn+6CpEwbT4bCNsW4bsci9v82npoY6YJKW8mokR+1dhcari6g1W2R80VCuWmB6E +ntJFZpILjPrCf8QCjs9Act0l87xx3+5K0LpFHQiKHygTbOrzE8++Lds+6yC/uzp/ +QtdLC20/iQMJ5GaOxSCwzBe1dUhC+ABF1/ZN1p9wgKFTFQMR+B/bR5q9l/d2AyMY +1pTorKIX7yg14OHehzL0s1tVq3QEtNl14c84hLh0m4Rf7nmRRcKDP8l6EwDujJVD +nR8cHM8ajiyC9tjjdyiQ32NLgzo+6OGiugctUxfw/ZLp7Qr0mT07IvPLcqBiRAC6 +E+9O +-----END CERTIFICATE REQUEST----- diff --git a/experimental/packages/otlp-exporter-base/test/certs/client.key b/experimental/packages/otlp-exporter-base/test/certs/client.key new file mode 100644 index 00000000000..00f82cfeebc --- /dev/null +++ b/experimental/packages/otlp-exporter-base/test/certs/client.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKgIBAAKCAgEA3WivsX7njxGlUiB2vNia5aAox9aw7kWGCqkan7G6hWAwxOVk +zeLKJqsycATQbplUzCoJ5eSJQYv1Atq0nVL8c7axYtSRZo8Ptfs7iTXIa2XpSxFy +vgr5gFRu5zF+sJCNpYqUFzUYwGsPJj+7+uXQIhi7ca16CeI3ocbqsFcLZ73wNVy1 +Dcyv9FcH0NaowLYpbZf3Zf4XJapN8aO/zCNGeFB0M1c8D88J6ZvOF8IvxWWYbrms +OLNVDGJOi1M4KZrFQt0XfTuOisxMsgdlVXY6cAD+514NzEhOcpySwuJEooCIdRcw +g+pEbE20tfWx0EP8WhDbyyvyjoqjupve5oDgJmGnYjhFH3bmhkhLI5vNjdDGuVp8 +3iCEWdaRMUljQr7jdzG1rwreACdBfE38EA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NebO+orSolXpFxGr+XvPP +yt2kU5v2Ff+9kGigncd2QHa7mbfdR30Gn+MWJuix7yxhsIe3J0hZR7EM4qHIUP1T +gxrqlvr0waN5tlUiIeNWSACf85yRiBTK+7P6tV9cqnv3VskMnGBj7ZCK5JthhYn9 +NdeuMjk8PeAIvo6QN28wY/UMbl3mWtUSWe8XEL2xGgD60Y+qbKVm8+3vh+/1MRzZ +tBM836ginHHApya0bNBPmtGoya2rVTDliQKCAQEAiiX5sNs3uvKyz7Z+LIiXaVL6 +C4CaNUMgyNv536FBzmMKXAsBFiAw/G96OPlwrNsIATVwumjq5mxYxeeMLwuodNJL +uNczdyNmsT9721tQEMTnS99VrtqISZZlAR0jVhTATU/cla/BMykqWTiAYUSHcFHw +2gOnyCTnBbW1EI3fdLQOqPiRNvpDwp4xNhXLnr8ANuewnw3yRCdZvJVsAmUpMLME +vjT3lzh4i2diKnAHF2l+ZTkqHFzg7oEOOms38Vi8rrhhwN0uvRdrbtcdrFc9YiW0 +IVJ5JWQ60oBdytnuoRvTLsnWrqfvgwcQYtZ3oFo+qO4fXFB1X54+IoyZFC1saA== +-----END RSA PRIVATE KEY----- diff --git a/experimental/packages/otlp-exporter-base/test/certs/regenerate.sh b/experimental/packages/otlp-exporter-base/test/certs/regenerate.sh new file mode 100755 index 00000000000..9e2e972c991 --- /dev/null +++ b/experimental/packages/otlp-exporter-base/test/certs/regenerate.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env sh +# +# Usage: regenerate.sh +# +# regenerate.sh regenerates certificates that are used to test gRPC with TLS +# Make sure you run it in test/certs directory. +# It also serves as a documentation on how existing certificates were generated. + +rm ca.crt ca.key client.crt client.csr client.key server.crt server.csr server.key + +openssl genrsa -des3 -out ca.key 4096 +openssl req -new -x509 -days 365 -sha256 -key ca.key -out ca.crt -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Root/OU=Test/CN=ca" + +openssl genrsa -des3 -out server.key 4096 +openssl req -new -sha256 -key server.key -out server.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Server/CN=localhost" +openssl x509 -req -days 365 -sha256 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt +openssl rsa -in server.key -out server.key + +openssl genrsa -des3 -out client.key 4096 +openssl req -new -sha256 -key client.key -out client.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Client/CN=localhost" +openssl x509 -req -days 365 -sha256 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt +openssl rsa -in client.key -out client.key diff --git a/experimental/packages/otlp-exporter-base/test/certs/server.crt b/experimental/packages/otlp-exporter-base/test/certs/server.crt new file mode 100644 index 00000000000..55f0c3dbb9e --- /dev/null +++ b/experimental/packages/otlp-exporter-base/test/certs/server.crt @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV +BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAxMDExWhcN +MjIwNjA3MjAxMDExWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZT +ZXJ2ZXIxEjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIP +ADCCAgoCggIBALaskMk0FpoAZ8eHpOiNYIW2yOeizGsvJ7PsNZujbUFQ/f7/AYTZ +CBQ9Hc8lKz+3YHklZnTsAJW6QLCBKSgsrjPAXA25zBFQazUuKb+QrjoIqeaq8D8w +6iHL7zdHsplbWZjYrnPjLWPqoc1ga6H0p8NsH7eC6hFXJRp2ZilyZXUR4jvyMc3D +2q/MXoI0VvQ3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tCcgg4dHixOre8oXgauhZ5 +jMOv9lUI6Glf61xt8mamicohSf9CFyH5PgZqRM0aSacdJ7jH6EitABOx21ZqwiBp +o4W37lV55oy+N0r7yxaNy/mSUUcjsQo6kGw/4cMpYTSEzRMtfwYPOS1DeTl9zArE +7TBI +-----END CERTIFICATE----- diff --git a/experimental/packages/otlp-exporter-base/test/certs/server.csr b/experimental/packages/otlp-exporter-base/test/certs/server.csr new file mode 100644 index 00000000000..0c5e9291bfc --- /dev/null +++ b/experimental/packages/otlp-exporter-base/test/certs/server.csr @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH +DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGU2Vy +dmVyMRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw +ggIKAoICAQC2rJDJNBaaAGfHh6TojWCFtsjnosxrLyez7DWbo21BUP3+/wGE2QgU +PR3PJSs/t2B5JWZ07ACVukCwgSkoLK4zwFwNucwRUGs1Lim/kK46CKnmqvA/MOoh +y+83R7KZW1mY2K5z4y1j6qHNYGuh9KfDbB+3guoRVyUadmYpcmV1EeI78jHNw9qv +zF6CNFb0N7SP0Gi61NomjdA2QbMiYa+Af4zczmMxgLlYnhMledsBZzrFJSQzaY7E +/79f0PCa4zl0m/pKP++FZUi0wmrqD0rIlG9a2tE27t2dBOm+75RSnmWjscFMlni4 +umE+mfWUzhCboiWp/+0k6aytTa6i/jj53itQND5a9dIWO+kqbQLtn06oBjhRqEJM +U6LJ7KaYkpAlWg4iygla+A0MwZv9Ai6EoF5OHyTYYjayE/m9+YF/F5pt4VKvlBmp +2cl4SWH6IwVLoTyRQFCqVFI0rIkVPA4/Ee5yGU/nFFr7JWJqzhuGYwp6SF56KKQI +xZWmZL+tv7RBsCZsgZBpNpWM5/SmtRv2jvdiI388qVJUilwp7U8Sw+gc1jRe/6o7 +dfV0zlj4woUB0HGF5pU0jVL1ENPRzGkSFHuTAnsZVmJXl+pVRul7TMDm9OsOTsp1 +bjB44gBn5Iy61JBkKksR60tr/2n9SexfgiApTYCPqtqc+XWFmDGghQIDAQABoAAw +DQYJKoZIhvcNAQELBQADggIBAIJ7KMLIZbomgrup1rrizG3aU4bREy6HfHZ9Ylcr +Lo1vdL5/UZH3AHVhoccb0ua3qXDtsc8pDQAXIMzBu8BjfpbwCvrgz7YXsNsBU9zV +el8p394QB20WoPHebYDBUXPiq3JhLfjzOXBS9Ke3MBl1jDamOFmZW8dg8EpowIXv +ODFP8sErFb7Bmq7x2d0EJyX7+HydBiRWRa376oXcZ/VLl/CnNzpJeACFWPI4d0lg +P5nsadtdLyAwXF6cRQx3pOdN0sS5b3llXX3jVwGzm+kNjVTDWJiJmqWfwIF15pPr +bypoUmPpeQ4I9F+oFm9+Ff776PemqBD7NSJdG0iHRndm3oa6o2bTpn9ZypCO1Skv +UWr3ATduFylA3/YeoN6dQwP4Ol+3WJ2UbXzTbmEfoSEzmwMI5MTidOuA62A0afyN +VM0SjHaLvfD1mK4w+3BKdUivYh4TWbcLU7s1SeDwYiEP6DFZHLBPHDcNLz77d6nQ +zgvOgXqeNfk9uI5NdYBMbtdHW/mwGgEfPlDkKbY2KveOJjLlTM1EduGFsYHAXyhI +SiYozrbFeS5ts4f1EZ5tVT73KBv97MiQkKhBoVXtF1CHPUP1LTkGxtH2uoDiVfDi +r1OkRzoO05pHAh2o+4gujThsc0d3T5mmoeSySs56lgqDmC4blXNOS0kBZ4+I2u7A +C2YH +-----END CERTIFICATE REQUEST----- diff --git a/experimental/packages/otlp-exporter-base/test/certs/server.key b/experimental/packages/otlp-exporter-base/test/certs/server.key new file mode 100644 index 00000000000..9fa740554ac --- /dev/null +++ b/experimental/packages/otlp-exporter-base/test/certs/server.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY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xzX658 +k9oMwXSRC4JhGZfOuWaf7/NeCCEUrzckRpshAsuUK5fDyUDUWhVdODFnuSBnELsI +238QCII4u78RN4Z45XPthR2fj4K1TDQMBooQwsy2JJio0zbM1lrnAS1NI1zxBsKO +JHu8RpC1/jNNVPojaqti5md3nFMUljL06QIXQtP5yoA75exGxhimtP+au0pZLjjo +xgiHxRr0PocVoGWeeow5eFXHFzZQcXqAkcaMoWkrmlIUdw4y0ibaJpaMGlj++oTS +b3KDTFG6V8HbeOiHOmpYQw73feXk26w70r+GHtIYQ6pg/SKKGw+RAGeDxHoHQCs1 +VGB/AoIBAQDSzRQx5lLjYGoAv06GaXW2P8PxLoljdNEhRpxLFjQ/zRdcV2mikC0U +4HccEow4J+m1fD3BizflWHc4aV1HEa+A2yCkQIWgXjngGIXmzCaYWA4qOCvsK5d7 +VmngnII63CgEQTTAfbN9VwmnqEIy/OOqsdgF+oCWAMRIf6OJbwivsAgKBagGCUCg +xY42aMyVQ9YOrDZbkrYkXaiM4LZIEGdxKZiUDDFuMYfD98ctJfJ2oe22hxBjeIzM +/soPdy6M2HgNpCbUw/mBhoXWeA348V2SuWSpLVp2IqDHLPXwI7mTAqmPz/YqPfab +r49uSDTYI/XoMAQOlaHnj9nsNXbSEgQBAoIBAQC6RnqNrsHki+CGdddEtRdxYVtf +ZEP3rc5xIEe3zG4L0FfjYxWk/aOW5Xl4akm6ddudEgndpJxa6T6ut4geMDIfSrvL +r2t/7WZ31fpAtwnI7exV6D230dWnSWf0u0sQc23TJhTSKd4R+Mm8WLzJQHY0rm3y +jOL0bWrEm5BXOcewXeSzQkcYbrViniHUv1OQDmNdTGw+bLCyM3fY3Ud2oBJGTfTw +wDoyG6D6zdLztGxTQQ2C39DXdRelGhYwrz2MlKJK5K2EVNLJ8O91c+VjvxKKJmJ1 +fkxF7omyNBh5dBnvFC/jFuxVL+PRqnvO0SH1YH1Y9eiqNhXrds0B4U+/YBDZ +-----END RSA PRIVATE KEY----- diff --git a/experimental/packages/exporter-trace-otlp-http/test/common/CollectorTraceExporter.test.ts b/experimental/packages/otlp-exporter-base/test/common/CollectorExporter.test.ts similarity index 88% rename from experimental/packages/exporter-trace-otlp-http/test/common/CollectorTraceExporter.test.ts rename to experimental/packages/otlp-exporter-base/test/common/CollectorExporter.test.ts index 945c059e5b7..c03fafc1597 100644 --- a/experimental/packages/exporter-trace-otlp-http/test/common/CollectorTraceExporter.test.ts +++ b/experimental/packages/otlp-exporter-base/test/common/CollectorExporter.test.ts @@ -15,20 +15,24 @@ */ import { ExportResultCode } from '@opentelemetry/core'; -import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; import * as assert from 'assert'; import * as sinon from 'sinon'; import { OTLPExporterBase } from '../../src/OTLPExporterBase'; import { OTLPExporterConfigBase } from '../../src/types'; -import { mockedReadableSpan } from '../traceHelper'; +import { ComplexTestObject, mockedComplexTestObject } from '../testHelper'; import * as otlpTypes from '../../src/types'; + +interface ExportRequest { + resourceSpans: object[] +} + type CollectorExporterConfig = OTLPExporterConfigBase; class OTLPTraceExporter extends OTLPExporterBase< CollectorExporterConfig, - ReadableSpan, - otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest -> { + ComplexTestObject, + ExportRequest + > { onInit() {} onShutdown() {} send( @@ -48,8 +52,8 @@ class OTLPTraceExporter extends OTLPExporterBase< } convert( - spans: ReadableSpan[] - ): otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest { + spans: ComplexTestObject[] + ): ExportRequest { return { resourceSpans: [] }; } } @@ -102,12 +106,12 @@ describe('OTLPTraceExporter - common', () => { }); it('should export spans as otlpTypes.Spans', done => { - const spans: ReadableSpan[] = []; - spans.push(Object.assign({}, mockedReadableSpan)); + const spans: ComplexTestObject[] = []; + spans.push(Object.assign({}, mockedComplexTestObject)); collectorExporter.export(spans, () => {}); setTimeout(() => { - const span1 = spySend.args[0][0][0] as ReadableSpan; + const span1 = spySend.args[0][0][0] as ComplexTestObject; assert.deepStrictEqual(spans[0], span1); done(); }); @@ -117,10 +121,10 @@ describe('OTLPTraceExporter - common', () => { describe('when exporter is shutdown', () => { it( 'should not export anything but return callback with code' + - ' "FailedNotRetryable"', + ' "FailedNotRetryable"', async () => { - const spans: ReadableSpan[] = []; - spans.push(Object.assign({}, mockedReadableSpan)); + const spans: ComplexTestObject[] = []; + spans.push(Object.assign({}, mockedComplexTestObject)); await collectorExporter.shutdown(); spySend.resetHistory(); @@ -139,8 +143,8 @@ describe('OTLPTraceExporter - common', () => { }); describe('when an error occurs', () => { it('should return failed export result', done => { - const spans: ReadableSpan[] = []; - spans.push(Object.assign({}, mockedReadableSpan)); + const spans: ComplexTestObject[] = []; + spans.push(Object.assign({}, mockedComplexTestObject)); spySend.throws({ code: 100, details: 'Test error', @@ -174,7 +178,7 @@ describe('OTLPTraceExporter - common', () => { ...collectorExporterConfig, concurrencyLimit: 3, }); - const spans: ReadableSpan[] = [{ ...mockedReadableSpan }]; + const spans: ComplexTestObject[] = [{ ...mockedComplexTestObject }]; const callbackSpy = sinon.spy(); for (let i = 0; i < 7; i++) { collectorExporterWithConcurrencyLimit.export(spans, callbackSpy); diff --git a/experimental/packages/exporter-trace-otlp-http/test/common/utils.test.ts b/experimental/packages/otlp-exporter-base/test/common/util.test.ts similarity index 100% rename from experimental/packages/exporter-trace-otlp-http/test/common/utils.test.ts rename to experimental/packages/otlp-exporter-base/test/common/util.test.ts diff --git a/experimental/packages/exporter-trace-otlp-http/test/node/utils.test.ts b/experimental/packages/otlp-exporter-base/test/node/util.test.ts similarity index 100% rename from experimental/packages/exporter-trace-otlp-http/test/node/utils.test.ts rename to experimental/packages/otlp-exporter-base/test/node/util.test.ts diff --git a/experimental/packages/otlp-exporter-base/test/testHelper.ts b/experimental/packages/otlp-exporter-base/test/testHelper.ts new file mode 100644 index 00000000000..4656cf17fc3 --- /dev/null +++ b/experimental/packages/otlp-exporter-base/test/testHelper.ts @@ -0,0 +1,79 @@ +/* + * 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. + */ +import { HrTime } from '@opentelemetry/api'; +import * as assert from 'assert'; + +export interface SimpleTestObject{ + readonly propString: string; + readonly propNumber: number; + readonly propArray: number[]; +} + +export interface ComplexTestObject { + readonly propString: string; + readonly propNumber: number; + readonly propFunction: () => SimpleTestObject; + readonly propOptional?: string; + readonly propTime: HrTime; + readonly propObject: SimpleTestObject; + readonly propArray: SimpleTestObject[]; + readonly propBoolean: boolean; +} + +export const mockedComplexTestObject: ComplexTestObject = { + propArray: [ + { + propArray: [1, 2, 3], + propNumber: 42, + propString: 'this is a string.' + }, + { + propArray: [3, 2, 1], + propNumber: 3, + propString: 'this is a second string.' + } + ], + propBoolean: true, + propFunction: () => { + return { + propArray: [30, 20, 10], + propNumber: 24, + propString: 'created by function' + }; + }, + propObject: { + propArray: [4, 3, 77], + propNumber: 44, + propString: 'this is a string that is part of propObject.' + }, + propNumber: 12, + propOptional: undefined, + propString: 'this is just a string in a complex test object.', + propTime: [12, 455] +}; + +export function ensureHeadersContain( + actual: { [key: string]: string }, + expected: { [key: string]: string } +) { + Object.entries(expected).forEach(([k, v]) => { + assert.strictEqual( + v, + actual[k], + `Expected ${actual} to contain ${k}: ${v}` + ); + }); +} diff --git a/experimental/packages/otlp-exporter-base/tsconfig.all.json b/experimental/packages/otlp-exporter-base/tsconfig.all.json new file mode 100644 index 00000000000..06c54913342 --- /dev/null +++ b/experimental/packages/otlp-exporter-base/tsconfig.all.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../tsconfig.base.json", + "files": [], + "references": [ + { "path": "./tsconfig.json" }, + { "path": "./tsconfig.esm.json" }, + { "path": "./tsconfig.esnext.json" } + ] +} diff --git a/experimental/packages/otlp-exporter-base/tsconfig.esm.json b/experimental/packages/otlp-exporter-base/tsconfig.esm.json new file mode 100644 index 00000000000..379f547a469 --- /dev/null +++ b/experimental/packages/otlp-exporter-base/tsconfig.esm.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.base.esm.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build/esm", + "tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ] +} diff --git a/experimental/packages/otlp-exporter-base/tsconfig.esnext.json b/experimental/packages/otlp-exporter-base/tsconfig.esnext.json new file mode 100644 index 00000000000..cb78dd6ff39 --- /dev/null +++ b/experimental/packages/otlp-exporter-base/tsconfig.esnext.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.base.esnext.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build/esnext", + "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ] +} diff --git a/experimental/packages/otlp-exporter-base/tsconfig.json b/experimental/packages/otlp-exporter-base/tsconfig.json new file mode 100644 index 00000000000..3e284c16fce --- /dev/null +++ b/experimental/packages/otlp-exporter-base/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build" + }, + "include": [ + "src/**/*.ts", + "test/**/*.ts" + ], + "references": [ + { + "path": "../../../packages/opentelemetry-core" + } + ] +} diff --git a/experimental/packages/otlp-grpc-exporter-base/.eslintignore b/experimental/packages/otlp-grpc-exporter-base/.eslintignore new file mode 100644 index 00000000000..378eac25d31 --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/.eslintignore @@ -0,0 +1 @@ +build diff --git a/experimental/packages/otlp-grpc-exporter-base/.eslintrc.js b/experimental/packages/otlp-grpc-exporter-base/.eslintrc.js new file mode 100644 index 00000000000..3ed0fbeba38 --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/.eslintrc.js @@ -0,0 +1,8 @@ +module.exports = { + "env": { + "mocha": true, + "commonjs": true, + "node": true, + }, + ...require('../../../eslint.config.js') +} diff --git a/experimental/packages/otlp-grpc-exporter-base/.npmignore b/experimental/packages/otlp-grpc-exporter-base/.npmignore new file mode 100644 index 00000000000..9505ba9450f --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/.npmignore @@ -0,0 +1,4 @@ +/bin +/coverage +/doc +/test diff --git a/experimental/packages/otlp-grpc-exporter-base/LICENSE b/experimental/packages/otlp-grpc-exporter-base/LICENSE new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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 + + http://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. diff --git a/experimental/packages/otlp-grpc-exporter-base/README.md b/experimental/packages/otlp-grpc-exporter-base/README.md new file mode 100644 index 00000000000..c55d7d2e2a0 --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/README.md @@ -0,0 +1,31 @@ +# OpenTelemetry Collector Exporter for node with grpc + +[![NPM Published Version][npm-img]][npm-url] +[![Apache License][license-image]][license-image] + +This module provides a gRPC exporter base for Node.js (browsers not supported) to be used with [opentelemetry-collector][opentelemetry-collector-url]. + +## Installation + +```bash +npm install --save @opentelemetry/otlp-grpc-exporter-base +``` + +## Useful links + +- For more information on OpenTelemetry, visit: +- For more about OpenTelemetry JavaScript: +- For help or feedback on this project, join us in [GitHub Discussions][discussions-url] + +## License + +Apache 2.0 - See [LICENSE][license-url] for more information. + +[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions +[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE +[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat +[npm-url]: https://www.npmjs.com/package/@opentelemetry/otlp-grpc-exporter-base +[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fotlp-grpc-exporter-base.svg +[opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector +[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service +[metrics-exporter-url]: https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc diff --git a/experimental/packages/otlp-grpc-exporter-base/package.json b/experimental/packages/otlp-grpc-exporter-base/package.json new file mode 100644 index 00000000000..e73931b5143 --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/package.json @@ -0,0 +1,79 @@ +{ + "name": "@opentelemetry/otlp-grpc-exporter-base", + "version": "0.27.0", + "description": "OpenTelemetry OTLP-gRPC Exporter base (for internal use only)", + "main": "build/src/index.js", + "types": "build/src/index.d.ts", + "repository": "open-telemetry/opentelemetry-js", + "scripts": { + "prepublishOnly": "npm run compile", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", + "compile": "tsc --build", + "clean": "tsc --build --clean", + "lint": "eslint . --ext .ts", + "lint:fix": "eslint . --ext .ts --fix", + "postcompile": "npm run submodule && npm run protos:copy", + "protos:copy": "cpx protos/opentelemetry/**/*.* build/protos/opentelemetry", + "submodule": "git submodule sync --recursive && git submodule update --init --recursive", + "tdd": "npm run test -- --watch-extensions ts --watch", + "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", + "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" + }, + "keywords": [ + "opentelemetry", + "nodejs", + "grpc", + "tracing", + "profiling", + "metrics", + "stats" + ], + "author": "OpenTelemetry Authors", + "license": "Apache-2.0", + "engines": { + "node": ">=8.12.0" + }, + "files": [ + "build/src/**/*.js", + "build/src/**/*.js.map", + "build/src/**/*.d.ts", + "build/protos/**/*.proto", + "doc", + "LICENSE", + "README.md" + ], + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "@babel/core": "7.16.0", + "@opentelemetry/api": "^1.0.0", + "@types/mocha": "8.2.3", + "@types/node": "14.17.33", + "@types/sinon": "10.0.6", + "codecov": "3.8.3", + "cpx": "1.5.0", + "mocha": "7.2.0", + "nyc": "15.1.0", + "rimraf": "3.0.2", + "sinon": "12.0.1", + "ts-loader": "8.3.0", + "ts-mocha": "8.0.0", + "typescript": "4.4.4", + "@opentelemetry/sdk-trace-base": "1.1.1", + "@opentelemetry/resources": "1.1.1", + "@opentelemetry/exporter-trace-otlp-http": "0.27.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0" + }, + "dependencies": { + "@opentelemetry/core": "1.1.1", + "@grpc/grpc-js": "^1.5.9", + "@grpc/proto-loader": "^0.6.9", + "@opentelemetry/otlp-exporter-base": "0.27.0" + } +} diff --git a/experimental/packages/exporter-trace-otlp-grpc/protos b/experimental/packages/otlp-grpc-exporter-base/protos similarity index 100% rename from experimental/packages/exporter-trace-otlp-grpc/protos rename to experimental/packages/otlp-grpc-exporter-base/protos diff --git a/experimental/packages/exporter-trace-otlp-grpc/src/OTLPExporterNodeBase.ts b/experimental/packages/otlp-grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts similarity index 83% rename from experimental/packages/exporter-trace-otlp-grpc/src/OTLPExporterNodeBase.ts rename to experimental/packages/otlp-grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts index 19d46d0cd57..9cc349fe4ea 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/src/OTLPExporterNodeBase.ts +++ b/experimental/packages/otlp-grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts @@ -15,28 +15,25 @@ */ import { diag } from '@opentelemetry/api'; -import { - OTLPExporterBase, - otlpTypes, -} from '@opentelemetry/exporter-trace-otlp-http'; import { Metadata } from '@grpc/grpc-js'; import { - OTLPExporterConfigNode, + OTLPGRPCExporterConfigNode, GRPCQueueItem, ServiceClientType, } from './types'; -import { ServiceClient, CompressionAlgorithm } from './types'; +import { ServiceClient } from './types'; import { getEnv, baggageUtils } from '@opentelemetry/core'; -import { configureCompression } from './util'; +import { configureCompression, GrpcCompressionAlgorithm } from './util'; +import { OTLPExporterBase, OTLPExporterError } from '@opentelemetry/otlp-exporter-base'; /** - * OTLP Metric Exporter abstract base class + * OTLP Exporter abstract base class */ -export abstract class OTLPExporterNodeBase< +export abstract class OTLPGRPCExporterNodeBase< ExportItem, ServiceRequest > extends OTLPExporterBase< - OTLPExporterConfigNode, + OTLPGRPCExporterConfigNode, ExportItem, ServiceRequest > { @@ -44,9 +41,9 @@ export abstract class OTLPExporterNodeBase< metadata?: Metadata; serviceClient?: ServiceClient = undefined; private _send!: Function; - compression: CompressionAlgorithm; + compression: GrpcCompressionAlgorithm; - constructor(config: OTLPExporterConfigNode = {}) { + constructor(config: OTLPGRPCExporterConfigNode = {}) { super(config); if (config.headers) { diag.warn('Headers cannot be set when using grpc'); @@ -62,7 +59,7 @@ export abstract class OTLPExporterNodeBase< private _sendPromise( objects: ExportItem[], onSuccess: () => void, - onError: (error: otlpTypes.OTLPExporterError) => void + onError: (error: OTLPExporterError) => void ): void { const promise = new Promise((resolve, reject) => { this._send(this, objects, resolve, reject); @@ -77,7 +74,7 @@ export abstract class OTLPExporterNodeBase< promise.then(popPromise, popPromise); } - onInit(config: OTLPExporterConfigNode): void { + onInit(config: OTLPGRPCExporterConfigNode): void { // defer to next tick and lazy load to avoid loading grpc too early // and making this impossible to be instrumented setImmediate(() => { @@ -90,7 +87,7 @@ export abstract class OTLPExporterNodeBase< send( objects: ExportItem[], onSuccess: () => void, - onError: (error: otlpTypes.OTLPExporterError) => void + onError: (error: OTLPExporterError) => void ): void { if (this._shutdownOnce.isCalled) { diag.debug('Shutdown already started. Cannot send objects'); diff --git a/experimental/packages/otlp-grpc-exporter-base/src/index.ts b/experimental/packages/otlp-grpc-exporter-base/src/index.ts new file mode 100644 index 00000000000..6ddb52ade2b --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/src/index.ts @@ -0,0 +1,19 @@ +/* + * 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. + */ + +export * from './OTLPGRPCExporterNodeBase'; +export { ServiceClientType, OTLPGRPCExporterConfigNode } from './types'; +export { validateAndNormalizeUrl, GrpcCompressionAlgorithm } from './util'; diff --git a/experimental/packages/exporter-trace-otlp-grpc/src/types.ts b/experimental/packages/otlp-grpc-exporter-base/src/types.ts similarity index 79% rename from experimental/packages/exporter-trace-otlp-grpc/src/types.ts rename to experimental/packages/otlp-grpc-exporter-base/src/types.ts index 34977f8fd2d..b015a4aef22 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/src/types.ts +++ b/experimental/packages/otlp-grpc-exporter-base/src/types.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; import * as grpc from '@grpc/grpc-js'; +import { CompressionAlgorithm, OTLPExporterConfigBase, OTLPExporterError } from '@opentelemetry/otlp-exporter-base'; /** * Queue item to be used to save temporary spans/metrics in case the GRPC service @@ -24,7 +24,7 @@ import * as grpc from '@grpc/grpc-js'; export interface GRPCQueueItem { objects: ExportedItem[]; onSuccess: () => void; - onError: (error: otlpTypes.OTLPExporterError) => void; + onError: (error: OTLPExporterError) => void; } /** @@ -41,8 +41,8 @@ export interface ServiceClient extends grpc.Client { /** * OTLP Exporter Config for Node */ -export interface OTLPExporterConfigNode - extends otlpTypes.OTLPExporterConfigBase { +export interface OTLPGRPCExporterConfigNode + extends OTLPExporterConfigBase { credentials?: grpc.ChannelCredentials; metadata?: grpc.Metadata; compression?: CompressionAlgorithm; @@ -52,11 +52,3 @@ export enum ServiceClientType { SPANS, METRICS, } - -/** - * These values are defined by grpc client - */ -export enum CompressionAlgorithm { - NONE = 0, - GZIP = 2 -} diff --git a/experimental/packages/exporter-trace-otlp-grpc/src/util.ts b/experimental/packages/otlp-grpc-exporter-base/src/util.ts similarity index 75% rename from experimental/packages/exporter-trace-otlp-grpc/src/util.ts rename to experimental/packages/otlp-grpc-exporter-base/src/util.ts index 8adc3dba012..7165f77d5ac 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/src/util.ts +++ b/experimental/packages/otlp-grpc-exporter-base/src/util.ts @@ -17,21 +17,16 @@ import * as grpc from '@grpc/grpc-js'; import * as protoLoader from '@grpc/proto-loader'; import { diag } from '@opentelemetry/api'; -import { globalErrorHandler, getEnv } from '@opentelemetry/core'; -import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; +import { getEnv, globalErrorHandler } from '@opentelemetry/core'; import * as path from 'path'; -import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; +import { OTLPGRPCExporterNodeBase } from './OTLPGRPCExporterNodeBase'; import { URL } from 'url'; -import { - OTLPExporterConfigNode, - GRPCQueueItem, - ServiceClientType, - CompressionAlgorithm -} from './types'; +import { GRPCQueueItem, OTLPGRPCExporterConfigNode, ServiceClientType, } from './types'; +import { CompressionAlgorithm, ExportServiceError, OTLPExporterError } from '@opentelemetry/otlp-exporter-base'; export function onInit( - collector: OTLPExporterNodeBase, - config: OTLPExporterConfigNode + collector: OTLPGRPCExporterNodeBase, + config: OTLPGRPCExporterConfigNode ): void { collector.grpcQueue = []; const credentials: grpc.ChannelCredentials = @@ -82,10 +77,10 @@ export function onInit( } export function send( - collector: OTLPExporterNodeBase, + collector: OTLPGRPCExporterNodeBase, objects: ExportItem[], onSuccess: () => void, - onError: (error: otlpTypes.OTLPExporterError) => void + onError: (error: OTLPExporterError) => void ): void { if (collector.serviceClient) { const serviceRequest = collector.convert(objects); @@ -93,7 +88,7 @@ export function send( collector.serviceClient.export( serviceRequest, collector.metadata || new grpc.Metadata(), - (err: otlpTypes.ExportServiceError) => { + (err: ExportServiceError) => { if (err) { diag.error('Service request', serviceRequest); onError(err); @@ -131,12 +126,29 @@ export function validateAndNormalizeUrl(url: string): string { return target.host; } -export function configureCompression(compression: CompressionAlgorithm | undefined): CompressionAlgorithm { +function toGrpcCompression(compression: CompressionAlgorithm): GrpcCompressionAlgorithm { + if(compression === CompressionAlgorithm.NONE) + return GrpcCompressionAlgorithm.NONE; + else if (compression === CompressionAlgorithm.GZIP) + return GrpcCompressionAlgorithm.GZIP; + return GrpcCompressionAlgorithm.NONE; +} + + +/** + * These values are defined by grpc client + */ +export enum GrpcCompressionAlgorithm { + NONE = 0, + GZIP = 2 +} + +export function configureCompression(compression: CompressionAlgorithm | undefined): GrpcCompressionAlgorithm { if (compression) { - return compression; + return toGrpcCompression(compression); } else { const definedCompression = getEnv().OTEL_EXPORTER_OTLP_TRACES_COMPRESSION || getEnv().OTEL_EXPORTER_OTLP_COMPRESSION; - return definedCompression === 'gzip' ? CompressionAlgorithm.GZIP: CompressionAlgorithm.NONE; + return definedCompression === 'gzip' ? GrpcCompressionAlgorithm.GZIP: GrpcCompressionAlgorithm.NONE; } } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/submodule.md b/experimental/packages/otlp-grpc-exporter-base/submodule.md similarity index 93% rename from experimental/packages/opentelemetry-exporter-metrics-otlp-proto/submodule.md rename to experimental/packages/otlp-grpc-exporter-base/submodule.md index bbbca131ad2..68f912dcd98 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/submodule.md +++ b/experimental/packages/otlp-grpc-exporter-base/submodule.md @@ -15,6 +15,7 @@ Knowing this if you want to change the submodule to point to a different version ``` 3. Find the SHA which you want to update to and copy it (the long one) +the latest sha when this guide was written is `59c488bfb8fb6d0458ad6425758b70259ff4a2bd` 4. Enter a submodule directory from this directory diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/OTLPExporterNodeBase.test.ts b/experimental/packages/otlp-grpc-exporter-base/test/OTLPGRPCExporterNodeBase.test.ts similarity index 89% rename from experimental/packages/exporter-trace-otlp-grpc/test/OTLPExporterNodeBase.test.ts rename to experimental/packages/otlp-grpc-exporter-base/test/OTLPGRPCExporterNodeBase.test.ts index dbe6c6b4063..aca3540763b 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/OTLPExporterNodeBase.test.ts +++ b/experimental/packages/otlp-grpc-exporter-base/test/OTLPGRPCExporterNodeBase.test.ts @@ -14,15 +14,14 @@ * limitations under the License. */ -import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; - import * as assert from 'assert'; -import { OTLPExporterNodeBase } from '../src/OTLPExporterNodeBase'; -import { OTLPExporterConfigNode, ServiceClientType } from '../src/types'; +import { OTLPGRPCExporterNodeBase } from '../src/OTLPGRPCExporterNodeBase'; +import { OTLPGRPCExporterConfigNode, ServiceClientType } from '../src/types'; import { mockedReadableSpan } from './traceHelper'; +import { OTLPExporterError } from '@opentelemetry/otlp-exporter-base'; -class MockCollectorExporter extends OTLPExporterNodeBase< +class MockCollectorExporter extends OTLPGRPCExporterNodeBase< ReadableSpan, ReadableSpan[] > { @@ -31,14 +30,14 @@ class MockCollectorExporter extends OTLPExporterNodeBase< */ sendCallbacks: { onSuccess: () => void; - onError: (error: otlpTypes.OTLPExporterError) => void; + onError: (error: OTLPExporterError) => void; }[] = []; - getDefaultUrl(config: OTLPExporterConfigNode): string { + getDefaultUrl(config: OTLPGRPCExporterConfigNode): string { return ''; } - getDefaultServiceName(config: OTLPExporterConfigNode): string { + getDefaultServiceName(config: OTLPGRPCExporterConfigNode): string { return ''; } @@ -60,12 +59,12 @@ MockCollectorExporter.prototype['_send'] = function _sendMock( self: MockCollectorExporter, objects: ReadableSpan[], onSuccess: () => void, - onError: (error: otlpTypes.OTLPExporterError) => void + onError: (error: OTLPExporterError) => void ): void { self.sendCallbacks.push({ onSuccess, onError }); }; -describe('OTLPExporterNodeBase', () => { +describe('OTLPGRPCExporterNodeBase', () => { let exporter: MockCollectorExporter; const concurrencyLimit = 5; diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/ca.crt b/experimental/packages/otlp-grpc-exporter-base/test/certs/ca.crt new file mode 100644 index 00000000000..b6db7d0dd2c --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/ca.crt @@ -0,0 +1,33 @@ +-----BEGIN CERTIFICATE----- +MIIFozCCA4ugAwIBAgIUCdllngMpqYtsqRCpqdXxPZiSbGEwDQYJKoZIhvcNAQEL +BQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQHDBFPcGVuVGVs +ZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9vdDENMAsGA1UECwwEVGVzdDELMAkGA1UE +AwwCY2EwHhcNMjEwNjA3MjAyNzMyWhcNMjIwNjA3MjAyNzMyWjBhMQswCQYDVQQG +EwJDTDELMAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0w +CwYDVQQKDARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTCCAiIwDQYJ +KoZIhvcNAQEBBQADggIPADCCAgoCggIBAKS4d8790qpxSOMAMNSxlvFxZvxZKih5 +BjKDefa3sPL8iSOZ12mSZyWqPifjU+fnb3PDLWJPEFYQiwpyMctlXoXo5qiDm1D5 +mLZPTc7/qbiyu33YZHW+iE23GiOQBfvgK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94zgj +xVtAv2Fp4lvpJWMjk/iKc8IR56VkvK6bui7BYEFc+DmtJLw0ryFZDD1wEzbQ5Gzl +W7JBC3vR8zQPo7kVl99BKAsNLhC+tCGdbLLOJROyFWHai/bkcRPHOLOMY1/lM/Wf +rlIcc46pSIOzlsxnlrDzoQihjtg3SrNBkPaRaJE12WFHYELHBX+65HRGlkaXnxaY +HOqPN6NiHVB0i5C4+l0M7JdOx2kEYVQiprm4kBiM3BNMdRpThn4Vt12TnEyq/Cyz +khz4FAMw/ytbEWMxFvEQJdOK1vjmPHAMDSFXiixeklVUD5Th/9so4kRTu97j8fq/ +T0JDHso8+A== +-----END CERTIFICATE----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/ca.key b/experimental/packages/otlp-grpc-exporter-base/test/certs/ca.key new file mode 100644 index 00000000000..3a12f603d4e --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/ca.key @@ -0,0 +1,54 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CBC,723F7ADBF5E86DF0 + +laGpuVd6ib17eYFGAvuWCFodT4OxvWQVpvjXVEqfqoJw3x//SbS/J9GQXULJHanh +FZGagPYhv3cQjW5n8hSxFADCq09he3sN+IV6FOzQ5JzJZEQtb5jqfc23n0o2y1Sx +Xw2TOBuzzLB9NFnkTgZt0hUJW9wrqYhDLXXmwwdJb78OsFmgzlBCVrcXtZKiLK7F +4gKvMKSD/pS4INKmwHlAdNqssMyk0Snon7odLD9yTrTYVqIabytj7ZQi8Mxg/EZC +mkffRhMS591DYU86CE38of6UbSc7AXdfvpYZ+G3phIUwE+BxaDOL1RX/h04LcDjE +43R8ccI1akW3EGO0FvTr1jn4EsDv/kuYLVmC7fhuYroSBGLIdt89aEuRxBkLsn/Y +WJv/VviXlmO13wAi/kPrwPQk8GpBO73Yw367+iaHNsWihZ8qBYBjiqQyR59Tymwy +yLtTA8yhFCDwMwWLbB5NGVFuMmLG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IGhcF/DCWtHnSCkJokj7 +S9ckrTYvNK7ROz3BTA8D48UF/XX/C/gBkdhFZcqgOI+VlCtexi6pUqakKicy96hw +QbBwh06/zl95YyCEqd2cUY18zrfwkc7L/1oLaeW6n50IVvt0MffI0k0r42zgBK0T +g0EAswdX6/0PrZ7bfJiRHf+HeqT30EPvXch7wLv7Vx68wMFaYKcPzFqQ4nBH3rOF +5Nhj0EpV+C0W/XMewfJEADbwE5XiTYY+2eYMU8kBa49+vjwXM7fkYLZOFfAZmVRQ +84JRgL8HG4gXmVo2YcbviRdNuw4y2LCyfhJ9NwuWW6Ly0uKiGRaVKP1JAEmIJmcX +SnG3rM0bJsRnDtBBURioN0whl64LS3BwsPWL3OOsjesBIBNkoDA10OukTzjnLc6A +RYAfgPrG1eSsjitMFYdSBX8wvrQDCpxyItIamMf8IlsgBMt/WlFeGOJ9wxxa26lb +PxLNlhSpj3PU6rA4NDKvxkr2IEJ0MEcDnFnQkyBPlWY6a6jSQ+WSQkzBLU9soZ/2 +-----END RSA PRIVATE KEY----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/client.crt b/experimental/packages/otlp-grpc-exporter-base/test/certs/client.crt new file mode 100644 index 00000000000..cbd324625f4 --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/client.crt @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV +BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAyNzMzWhcN +MjIwNjA3MjAyNzMzWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZD +bG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3RMi2iV9ZxW+F0j6d9ryo +j8pJJfpiW4qh6Eqi6HyvrzgdndKhkVYiIwbX5S60mqL+KcaPghX2goWexMW94QlQ +Re3/IvOAzGpu5fLn//y2tAaO9hDUsyoIJtXcFJKLbfM+mK/Bac2niEyBpr9Rzqur +N43Ga2pOsM4P/4YcAO6tvs5htvh2ala6UDXeEZV9Z1Bc5bOHAWNp13BfWE01iLNC +5rIu0XuVo1aa0FeVdJL6IpVeEwnkzDDt/9LKgp2K8w71VAtUSOg23AEYJu+GFr4D +y+0bahUiNETrFaiCsXQYa9HHFrqhA/PGOGpyq6GrBkJxWpzuL3rQQicpHzVIQEmb +3aCcIBdA2RQwQk7Z3YI2EuFMkHAElCXXZBulvxY6kl1n+2UwWRlocDMYZdkzI3+X +Tw8x +-----END CERTIFICATE----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/client.csr b/experimental/packages/otlp-grpc-exporter-base/test/certs/client.csr new file mode 100644 index 00000000000..e5de7b19123 --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/client.csr @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIErzCCApcCAQAwajELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQH +DBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEVGVzdDEPMA0GA1UECwwGQ2xp +ZW50MRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw +ggIKAoICAQDAXNRfTvDnArvMbKZzdTDcHHFGQsfpbIdRedE+Q9CDZsc9618Yp05D +PkIxbCdPYhfDJoKLiPssZk2sjJVu993VHP10PXFfRkcFlZRdUZ6GKe5l1cDJ86PN +LOwhlnPoHpYqni1IMxiKKuGxk6dXhHgdihif8PBNm0y7OWugdKR4ULlV2fj6tBNF +M5dsD3PlsI3mchkVOD21s1+mzfkdOT38avD14SeiZ7dI/KTaBf11OpjiGEMkG0xx +C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A5QC1GDXEi/bdjd7YeHRiL+ciVM +ZXXU9GT1O78O+84wbIDebahn8cifdGa7Kft7GftS3pCIyAjU9+eMXyT1JG3nssLr +4/ht +-----END CERTIFICATE REQUEST----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/client.key b/experimental/packages/otlp-grpc-exporter-base/test/certs/client.key new file mode 100644 index 00000000000..9219944ca47 --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/client.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKAIBAAKCAgEAwFzUX07w5wK7zGymc3Uw3BxxRkLH6WyHUXnRPkPQg2bHPetf +GKdOQz5CMWwnT2IXwyaCi4j7LGZNrIyVbvfd1Rz9dD1xX0ZHBZWUXVGehinuZdXA +yfOjzSzsIZZz6B6WKp4tSDMYiirhsZOnV4R4HYoYn/DwTZtMuzlroHSkeFC5Vdn4 ++rQTRTOXbA9z5bCN5nIZFTg9tbNfps35HTk9/Grw9eEnome3SPyk2gX9dTqY4hhD +JBtMcQpHyoHZJejn4PUk6VGKh9a0rjCxEf/A2buPu2rvlR7OE56qnphTozAad5rW +Whrrkr4MMb+sXK/FKUNL/neCPIoZKpih3yl6+/K0qO1SbDrFfmLmcWd/7CsqYwfo +QN4ebrctF4G/8KoISti3iRXc2R0i4ea/tkh1F+EM90rxD+TMCVFNfbnAr/FafkKq +lIooJTC6QTNxxXbropTiwbrf/hvK/rMTrbPzjvY/q744ZJmUPHOcvQEGD2KIcViK +inCyEF8VyzM8JI6zVI7xdkf7onnKkoHME/toCzIl+U8dYZNQEAJj1kJT/uLAgXtg +U9tr+16ZUwuSDvmhgZWjDQOWnnmNC+vMyvshpIELEVQkQp/m7oZI2i0laZB0di1r +lIcqP+uvIVBXmqn2YF+JrkNaeMeKMVlOj5z8ouuCSbN+BtPipWme7EpqFc0CAwEA +AQKCAgBSCERY0KVTHotPxhXFrvhDJa34tInkNXAPgs+Eqg7FupLFCRbowJBThL1d +ri2lYM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wxa37qCsg+MDf0iyHmnWp2y6IShhAwMC6konSqUkcez1ssqsChKt6 +dCxLeZEHuiFT6305E/xHZm/tWu9wbhhZecUElP+CyJ62GYtePzHKO+ZsdXywaiD4 +mZkq8ko6GIWkI7clasfdhjFqZ5GYA9Cv0OVQ6+MbFJnRPhCvz+iuAhAqXVE+nPhb +fSQOenyBtwtA3vRYYQR/2Z3xpydKzUiw1JcWf/etRwdtwpRfjEBTlzcQaHs= +-----END RSA PRIVATE KEY----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/regenerate.sh b/experimental/packages/otlp-grpc-exporter-base/test/certs/regenerate.sh new file mode 100755 index 00000000000..e1f1af5b54d --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/regenerate.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env sh +# +# Usage: regenerate.sh +# +# regenerate.sh regenerates certificates that are used to test gRPC with TLS +# Make sure you run it in test/certs directory. +# It also serves as a documentation on how existing certificates were generated. + +rm ca.crt ca.key client.crt client.csr client.key server.crt server.csr server.key + +openssl genrsa -nodes -des3 -out ca.key 4096 +openssl req -nodes -new -x509 -days 365 -key ca.key -out ca.crt -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Root/OU=Test/CN=ca" + +openssl genrsa -nodes -des3 -out server.key 4096 +openssl req -nodes -new -key server.key -out server.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Server/CN=localhost" +openssl x509 -req -nodes -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt +openssl rsa -nodes -in server.key -out server.key + +openssl genrsa -nodes -des3 -out client.key 4096 +openssl req -nodes -new -key client.key -out client.csr -subj "/C=CL/ST=RM/L=OpenTelemetryTest/O=Test/OU=Client/CN=localhost" +openssl x509 -nodes -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt +openssl rsa -nodes -in client.key -out client.key diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/server.crt b/experimental/packages/otlp-grpc-exporter-base/test/certs/server.crt new file mode 100644 index 00000000000..09094e4526f --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/server.crt @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFPzCCAycCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNV +BAgMAlJNMRowGAYDVQQHDBFPcGVuVGVsZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9v +dDENMAsGA1UECwwEVGVzdDELMAkGA1UEAwwCY2EwHhcNMjEwNjA3MjAyNzMyWhcN +MjIwNjA3MjAyNzMyWjBqMQswCQYDVQQGEwJDTDELMAkGA1UECAwCUk0xGjAYBgNV +BAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0wCwYDVQQKDARUZXN0MQ8wDQYDVQQLDAZT +ZXJ2ZXIxEjAQBgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIP +ADCCAgoCggIBANaRv7jpdEedG0CQ/LoJEXuE32eZXzar45u05wq5CzqnUlYdHyx8 +cgCJJ44KThFXiOzgELFiiwjxmPo1CDLqGp8vEDHntvhxLhw/mFy/aa7YrCv1/1eX +0+cEvNUyoikjHKXECI7sV1ZVMrimGKXQNqRfub1JbJ+IzL+kp6MRtdA6GzxsU0Dg +Wwf7IQxtCQ4Tw3onJ3P3NZAkgz6zCVhOVkR7DuqGulzTQDa//mWwKQJie5wscURj +vLsJ0prS16Tc/5yXijwRjwx8ZEoDrJ5KszoMQwKIoLN7wHBo2r8/8RQsOGTVMJ1I +9kOkH3s9clswxCrnpzdNNmyIwTWaQ6CqpQpp0unGimF3VokanHhOhcpkWfzDArmU +jL4PIFBQBJvHIEKbuhZ4pUYL/6RtgEg2f3xVPe8s0hn/DzwJTgXqEX+TY7WvIKmH +0sMGZ9TZzWe9W64LM2/427+6pfgQOAJDHNLSYpmaa14R+630IMocdY6sj2hoZ9TK +8Ridqn+q+5kIpG/pP7bbzbzsotdzjNb6h7GBlsuyycoOfiP+C6Zs/yUZAAZEsSm0 +e4dXFCccurkXRL7cZJHC/agQhkkvcEP1TpmaygjbucME+h6H0G0St8yzBQwEJdkn +wNmfEhIdjmiX6u/fvPO6VJ5HBxgA5gONJlk+4EbiZTfl2rYauBFhloHzAgMBAAEw +DQYJKoZIhvcNAQELBQADggIBACIJLqVoH8oh8W0/0IF3sxH8LFsGByi0CUPo1JEB +1t3+FqyC7eFC9rDW12LfOKgiZl273OBpCHT8bx3OkoGZ4KwZsbsznyJv/X5OVYFH +5y5Lo8QNGWWMzXoK2JLlYJXZHMaJr5tTFOGqoIvC9C8ibLSAbL0MhtB9L5SvSxAm +mUOKZ/en7ZBepRex/s/rfCWYYTw2Ah02HZc8+H/J/aF3tvChI7Gx0anaSQxS48Ru +3eCaiaBEfoSGQvN9Jc+k1QJgJ4vZ8yi7ndl8pwW97YXo8Sg305ritqpnon+vemsV +rYoqHN+WV2/D0nqNu1AX8PldDvUYTfBtLfS7T5goN7abEIJCaTNmzU2ji0SqI9vJ +j4t9E9KcCKMshbciDrD7RPEPk3vogEDD3uygFwcPwUQfpCUFbRJOnTSH1oB/aUC4 +x9DnYSHBdDvaBmu0pBpoddJ+0pbw02P7YL9kPz5OnOAN06JP4McIYz5ytKoSt/m8 +Z7cUnvn7TRVNLuiapwpB0gtRmb9JY1q3pd63+X0SCaBEtUH+PWcRcS7eDsgMwEym +0CyANhCQYJjcKugIWLYtN/0/p2bIKcRmcH3iJiN2zZtP1AF6G7a4mp+21OynvFOc +3+ojTDGJxxD3uPtKEhJXRgYMOmfAEn3rgtoln1kkNYcd7f2EIulckwB2yeM1IMud +0le7 +-----END CERTIFICATE----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/server.csr b/experimental/packages/otlp-grpc-exporter-base/test/certs/server.csr new file mode 100644 index 00000000000..bb61322340d --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/server.csr @@ -0,0 +1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ElARM1CX4dQUDnV++RLLRIKKGfcnwU+vSEWN4QfXs9qjI2UK80CBr6kPEt+bMfR +wUIax5HT1XLECoLph1rNza0h3WNk5ndEJMAt51U0JNAi6PwDF04ZfnX5E2RtiEjV ++3DPW1HYlX2hepkXVJPB568bbpmWLrmJsHjVZy4vmDoQi2bzS/QPsepgQ3aXxNel +vTxh0Or5SdIRRfNnP/Ov/aYjBxzkcKY83ADh7h1aqMOlUyFenHoMfTWnMYkeNY+1 +dOoLUS/ZNA6IH54UO7uY0uOcwCfRPYZzDxZI0IkjogX0aizixSs5duQx0ux3sUOo +a4zxMNPd89ppbCMZDS7biC7cOAsdDYXKcE5ijpc5CQXVo4/dA2xyfisRT7WUq9ay +vmQoYfMCAkGv47BVYhzASyPIXuFP2/HDbtnBvZ2aeSuMAwhHzj3vX9js2HGy7t2V +kj36LymQv+YBp9mV9/crSqy0DNFAYOWOuig0mQX/SPedGa4jf9v4OhANi+kzgxtQ +hBTcA0OtJyrVxesVGGK0YwaQIIZ8jwhsK3ljlZpOfVUflHl2/etME1DXtU37U9xA +fuw0 +-----END CERTIFICATE REQUEST----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/certs/server.key b/experimental/packages/otlp-grpc-exporter-base/test/certs/server.key new file mode 100644 index 00000000000..ddac188c23b --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/test/certs/server.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKAIBAAKCAgEA1pG/uOl0R50bQJD8ugkRe4TfZ5lfNqvjm7TnCrkLOqdSVh0f +LHxyAIknjgpOEVeI7OAQsWKLCPGY+jUIMuoany8QMee2+HEuHD+YXL9prtisK/X/ +V5fT5wS81TKiKSMcpcQIjuxXVlUyuKYYpdA2pF+5vUlsn4jMv6SnoxG10DobPGxT +QOBbB/shDG0JDhPDeicnc/c1kCSDPrMJWE5WRHsO6oa6XNNANr/+ZbApAmJ7nCxx +RGO8uwnSmtLXpNz/nJeKPBGPDHxkS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ZSh+vwRWrKl3g0XdRzzQ4hU0y +4emxAoIBAH2IhBJE09JeNTEmwxA3F/JNBWgCKzoqErYqIZsu34mF0DJyK6CqPLMf +Uh20PZrnS87vzJVFneFJ0aFxUaaHSJW5za9vdthFIjZQFcods7xbv85a0h2EBhEX +f7Z7dhrTsh1i3BLTjm+NyfNAJr5VwgXf9Bk5X1K0hTVl1mHsVUKNFP3cfKehsuVr +HY/eM1823wwHJsw7apbpQtrOC7F1iA+6yQboLAhUFt+FIzdZg7cvbgyTntaXFJvJ +CbefZouYQrK/pMGoH15IgNkCcXXhE6Vhay6DqVN/r9RT0emrSEq2wy2adsSg0M4+ +lj/RbbRObwyBXLVyRyqEt3fJOBhZsaMCggEBAIxcTLc4JPH/TxlFKTusALlR4CRG +XHDlTdMR4kWfsmWxWxocwcyGIshNpylox+MLzHw1JI4o5AyVrP8GD9Lzea2l649Y +vBLZjSan+ucJGkWnZPUG8sqo/Wg1mm2ZotQGfXmTaoOg9nN37YZvyDr3qgpQghZ2 +LhFNCaccJcoUZfW+snM9Q3Isiz6DmKfc92eq3goHfhmTInYq+b30Z9nO7nDV9oll +eeurRN0aCnfvRTAMoy17gt5/h9jg7w9kcbP6wyxixlBvTKQqxkBA1wfa2kBQ6TOK +JSldpu7eAHZ8IHEraQ70Drd/Qr77Witm59F5TX0Vxut7/A1dEjWuP9SY4do= +-----END RSA PRIVATE KEY----- diff --git a/experimental/packages/otlp-grpc-exporter-base/test/traceHelper.ts b/experimental/packages/otlp-grpc-exporter-base/test/traceHelper.ts new file mode 100644 index 00000000000..83578d3c128 --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/test/traceHelper.ts @@ -0,0 +1,331 @@ +/* + * 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. + */ + +import { SpanStatusCode, TraceFlags } from '@opentelemetry/api'; +import { otlpTypes } from '@opentelemetry/exporter-trace-otlp-http'; +import { Resource } from '@opentelemetry/resources'; +import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; +import * as assert from 'assert'; +import * as grpc from '@grpc/grpc-js'; +import { VERSION } from '@opentelemetry/core'; + +const traceIdArr = [ + 31, + 16, + 8, + 220, + 142, + 39, + 14, + 133, + 196, + 10, + 13, + 124, + 57, + 57, + 178, + 120, +]; +const spanIdArr = [94, 16, 114, 97, 246, 79, 165, 62]; +const parentIdArr = [120, 168, 145, 80, 152, 134, 67, 136]; + +export const mockedReadableSpan: ReadableSpan = { + name: 'documentFetch', + kind: 0, + spanContext: () => { + return { + traceId: '1f1008dc8e270e85c40a0d7c3939b278', + spanId: '5e107261f64fa53e', + traceFlags: TraceFlags.SAMPLED, + }; + }, + parentSpanId: '78a8915098864388', + startTime: [1574120165, 429803070], + endTime: [1574120165, 438688070], + ended: true, + status: { code: SpanStatusCode.OK }, + attributes: { component: 'document-load' }, + links: [ + { + context: { + traceId: '1f1008dc8e270e85c40a0d7c3939b278', + spanId: '78a8915098864388', + traceFlags: TraceFlags.SAMPLED, + }, + attributes: { component: 'document-load' }, + }, + ], + events: [ + { name: 'fetchStart', time: [1574120165, 429803070] }, + { + name: 'domainLookupStart', + time: [1574120165, 429803070], + }, + { name: 'domainLookupEnd', time: [1574120165, 429803070] }, + { + name: 'connectStart', + time: [1574120165, 429803070], + }, + { name: 'connectEnd', time: [1574120165, 429803070] }, + { + name: 'requestStart', + time: [1574120165, 435513070], + }, + { name: 'responseStart', time: [1574120165, 436923070] }, + { + name: 'responseEnd', + time: [1574120165, 438688070], + }, + ], + duration: [0, 8885000], + resource: Resource.default().merge(new Resource({ + service: 'ui', + version: 1, + cost: 112.12, + })), + instrumentationLibrary: { name: 'default', version: '0.0.1' }, +}; + +export function ensureExportedEventsAreCorrect( + events: otlpTypes.opentelemetryProto.trace.v1.Span.Event[] +) { + assert.deepStrictEqual( + events, + [ + { + attributes: [], + timeUnixNano: '1574120165429803008', + name: 'fetchStart', + droppedAttributesCount: 0, + }, + { + attributes: [], + timeUnixNano: '1574120165429803008', + name: 'domainLookupStart', + droppedAttributesCount: 0, + }, + { + attributes: [], + timeUnixNano: '1574120165429803008', + name: 'domainLookupEnd', + droppedAttributesCount: 0, + }, + { + attributes: [], + timeUnixNano: '1574120165429803008', + name: 'connectStart', + droppedAttributesCount: 0, + }, + { + attributes: [], + timeUnixNano: '1574120165429803008', + name: 'connectEnd', + droppedAttributesCount: 0, + }, + { + attributes: [], + timeUnixNano: '1574120165435513088', + name: 'requestStart', + droppedAttributesCount: 0, + }, + { + attributes: [], + timeUnixNano: '1574120165436923136', + name: 'responseStart', + droppedAttributesCount: 0, + }, + { + attributes: [], + timeUnixNano: '1574120165438688000', + name: 'responseEnd', + droppedAttributesCount: 0, + }, + ], + 'exported events are incorrect' + ); +} + +export function ensureExportedAttributesAreCorrect( + attributes: otlpTypes.opentelemetryProto.common.v1.KeyValue[] +) { + assert.deepStrictEqual( + attributes, + [ + { + key: 'component', + value: { + stringValue: 'document-load', + value: 'stringValue', + }, + }, + ], + 'exported attributes are incorrect' + ); +} + +export function ensureExportedLinksAreCorrect( + attributes: otlpTypes.opentelemetryProto.trace.v1.Span.Link[] +) { + assert.deepStrictEqual( + attributes, + [ + { + attributes: [ + { + key: 'component', + value: { + stringValue: 'document-load', + value: 'stringValue', + }, + }, + ], + traceId: Buffer.from(traceIdArr), + spanId: Buffer.from(parentIdArr), + traceState: '', + droppedAttributesCount: 0, + }, + ], + 'exported links are incorrect' + ); +} + +export function ensureExportedSpanIsCorrect( + span: otlpTypes.opentelemetryProto.trace.v1.Span +) { + if (span.attributes) { + ensureExportedAttributesAreCorrect(span.attributes); + } + if (span.events) { + ensureExportedEventsAreCorrect(span.events); + } + if (span.links) { + ensureExportedLinksAreCorrect(span.links); + } + assert.deepStrictEqual( + span.traceId, + Buffer.from(traceIdArr), + 'traceId is wrong' + ); + assert.deepStrictEqual( + span.spanId, + Buffer.from(spanIdArr), + 'spanId is wrong' + ); + assert.strictEqual(span.traceState, '', 'traceState is wrong'); + assert.deepStrictEqual( + span.parentSpanId, + Buffer.from(parentIdArr), + 'parentIdArr is wrong' + ); + assert.strictEqual(span.name, 'documentFetch', 'name is wrong'); + assert.strictEqual(span.kind, 'SPAN_KIND_INTERNAL', 'kind is wrong'); + assert.strictEqual( + span.startTimeUnixNano, + '1574120165429803008', + 'startTimeUnixNano is wrong' + ); + assert.strictEqual( + span.endTimeUnixNano, + '1574120165438688000', + 'endTimeUnixNano is wrong' + ); + assert.strictEqual( + span.droppedAttributesCount, + 0, + 'droppedAttributesCount is wrong' + ); + assert.strictEqual(span.droppedEventsCount, 0, 'droppedEventsCount is wrong'); + assert.strictEqual(span.droppedLinksCount, 0, 'droppedLinksCount is wrong'); + assert.deepStrictEqual( + span.status, + { + code: 'STATUS_CODE_OK', + deprecatedCode: 'DEPRECATED_STATUS_CODE_OK', + message: '', + }, + 'status is wrong' + ); +} + +export function ensureResourceIsCorrect( + resource: otlpTypes.opentelemetryProto.resource.v1.Resource +) { + assert.deepStrictEqual(resource, { + attributes: [ + { + 'key': 'service.name', + 'value': { + 'stringValue': `unknown_service:${process.argv0}`, + 'value': 'stringValue' + } + }, + { + 'key': 'telemetry.sdk.language', + 'value': { + 'stringValue': 'nodejs', + 'value': 'stringValue' + } + }, + { + 'key': 'telemetry.sdk.name', + 'value': { + 'stringValue': 'opentelemetry', + 'value': 'stringValue' + } + }, + { + 'key': 'telemetry.sdk.version', + 'value': { + 'stringValue': VERSION, + 'value': 'stringValue' + } + }, + { + key: 'service', + value: { + stringValue: 'ui', + value: 'stringValue', + }, + }, + { + key: 'version', + value: { + intValue: '1', + value: 'intValue', + }, + }, + { + key: 'cost', + value: { + doubleValue: 112.12, + value: 'doubleValue', + }, + }, + ], + droppedAttributesCount: 0, + }); +} + +export function ensureMetadataIsCorrect( + actual: grpc.Metadata, + expected: grpc.Metadata +) { + //ignore user agent + expected.remove('user-agent'); + actual.remove('user-agent'); + assert.deepStrictEqual(actual.getMap(), expected.getMap()); +} diff --git a/experimental/packages/exporter-trace-otlp-grpc/test/util.test.ts b/experimental/packages/otlp-grpc-exporter-base/test/util.test.ts similarity index 86% rename from experimental/packages/exporter-trace-otlp-grpc/test/util.test.ts rename to experimental/packages/otlp-grpc-exporter-base/test/util.test.ts index 42452850ce7..cae1de6ce30 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/test/util.test.ts +++ b/experimental/packages/otlp-grpc-exporter-base/test/util.test.ts @@ -18,8 +18,8 @@ import * as sinon from 'sinon'; import * as assert from 'assert'; import { diag } from '@opentelemetry/api'; -import { validateAndNormalizeUrl, configureCompression } from '../src/util'; -import { CompressionAlgorithm} from '../src/types'; +import { validateAndNormalizeUrl, configureCompression, GrpcCompressionAlgorithm } from '../src/util'; +import { CompressionAlgorithm } from '@opentelemetry/otlp-exporter-base'; // Tests added to detect breakage released in #2130 describe('validateAndNormalizeUrl()', () => { @@ -85,19 +85,19 @@ describe('configureCompression', () => { const envSource = process.env; it('should return none for compression', () => { const compression = CompressionAlgorithm.NONE; - assert.strictEqual(configureCompression(compression), CompressionAlgorithm.NONE); + assert.strictEqual(configureCompression(compression), GrpcCompressionAlgorithm.NONE); }); it('should return gzip compression defined via env', () => { envSource.OTEL_EXPORTER_OTLP_TRACES_COMPRESSION = 'gzip'; - assert.strictEqual(configureCompression(undefined),CompressionAlgorithm.GZIP); + assert.strictEqual(configureCompression(undefined),GrpcCompressionAlgorithm.GZIP); delete envSource.OTEL_EXPORTER_OTLP_TRACES_COMPRESSION; }); it('should return none for compression defined via env', () => { envSource.OTEL_EXPORTER_OTLP_TRACES_COMPRESSION = 'none'; - assert.strictEqual(configureCompression(undefined),CompressionAlgorithm.NONE); + assert.strictEqual(configureCompression(undefined),GrpcCompressionAlgorithm.NONE); delete envSource.OTEL_EXPORTER_OTLP_TRACES_COMPRESSION; }); it('should return none for compression when no compression is set', () => { - assert.strictEqual(configureCompression(undefined),CompressionAlgorithm.NONE); + assert.strictEqual(configureCompression(undefined),GrpcCompressionAlgorithm.NONE); }); }); diff --git a/experimental/packages/otlp-grpc-exporter-base/tsconfig.json b/experimental/packages/otlp-grpc-exporter-base/tsconfig.json new file mode 100644 index 00000000000..c8e54e36903 --- /dev/null +++ b/experimental/packages/otlp-grpc-exporter-base/tsconfig.json @@ -0,0 +1,28 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build" + }, + "include": [ + "src/**/*.ts", + "test/**/*.ts" + ], + "references": [ + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-resources" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, + { + "path": "../exporter-trace-otlp-http" + }, + { + "path": "../otlp-exporter-base" + } + ] +} diff --git a/experimental/packages/otlp-proto-exporter-base/.eslintignore b/experimental/packages/otlp-proto-exporter-base/.eslintignore new file mode 100644 index 00000000000..378eac25d31 --- /dev/null +++ b/experimental/packages/otlp-proto-exporter-base/.eslintignore @@ -0,0 +1 @@ +build diff --git a/experimental/packages/otlp-proto-exporter-base/.eslintrc.js b/experimental/packages/otlp-proto-exporter-base/.eslintrc.js new file mode 100644 index 00000000000..3ed0fbeba38 --- /dev/null +++ b/experimental/packages/otlp-proto-exporter-base/.eslintrc.js @@ -0,0 +1,8 @@ +module.exports = { + "env": { + "mocha": true, + "commonjs": true, + "node": true, + }, + ...require('../../../eslint.config.js') +} diff --git a/experimental/packages/otlp-proto-exporter-base/.npmignore b/experimental/packages/otlp-proto-exporter-base/.npmignore new file mode 100644 index 00000000000..9505ba9450f --- /dev/null +++ b/experimental/packages/otlp-proto-exporter-base/.npmignore @@ -0,0 +1,4 @@ +/bin +/coverage +/doc +/test diff --git a/experimental/packages/otlp-proto-exporter-base/LICENSE b/experimental/packages/otlp-proto-exporter-base/LICENSE new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/experimental/packages/otlp-proto-exporter-base/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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 + + http://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. diff --git a/experimental/packages/otlp-proto-exporter-base/README.md b/experimental/packages/otlp-proto-exporter-base/README.md new file mode 100644 index 00000000000..adeffe39f42 --- /dev/null +++ b/experimental/packages/otlp-proto-exporter-base/README.md @@ -0,0 +1,31 @@ +# OpenTelemetry Collector Exporter for node with protobuf + +[![NPM Published Version][npm-img]][npm-url] +[![Apache License][license-image]][license-image] + +This module provides a OTLP-http/protobuf exporter base for Node.js (browsers not supported) to be used with [opentelemetry-collector][opentelemetry-collector-url]. + +## Installation + +```bash +npm install --save @opentelemetry/otlp-proto-exporter-base +``` + +## Useful links + +- For more information on OpenTelemetry, visit: +- For more about OpenTelemetry JavaScript: +- For help or feedback on this project, join us in [GitHub Discussions][discussions-url] + +## License + +Apache 2.0 - See [LICENSE][license-url] for more information. + +[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions +[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE +[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat +[npm-url]: https://www.npmjs.com/package/@opentelemetry/otlp-proto-exporter-base +[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fotlp-proto-exporter-base.svg +[opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector +[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service +[metrics-exporter-url]: https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-metrics-otlp-proto diff --git a/experimental/packages/otlp-proto-exporter-base/package.json b/experimental/packages/otlp-proto-exporter-base/package.json new file mode 100644 index 00000000000..07824c20294 --- /dev/null +++ b/experimental/packages/otlp-proto-exporter-base/package.json @@ -0,0 +1,76 @@ +{ + "name": "@opentelemetry/otlp-proto-exporter-base", + "version": "0.27.0", + "description": "OpenTelemetry OTLP-HTTP-protobuf Exporter base (for internal use only)", + "main": "build/src/index.js", + "types": "build/src/index.d.ts", + "repository": "open-telemetry/opentelemetry-js", + "scripts": { + "prepublishOnly": "npm run compile", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../", + "compile": "tsc --build", + "clean": "tsc --build --clean", + "lint": "eslint . --ext .ts", + "lint:fix": "eslint . --ext .ts --fix", + "postcompile": "npm run submodule && npm run protos:copy", + "protos:copy": "cpx protos/opentelemetry/**/*.* build/protos/opentelemetry", + "submodule": "git submodule sync --recursive && git submodule update --init --recursive", + "tdd": "npm run test -- --watch-extensions ts --watch", + "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", + "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" + }, + "keywords": [ + "opentelemetry", + "nodejs", + "protobuf", + "tracing", + "profiling", + "metrics", + "stats" + ], + "author": "OpenTelemetry Authors", + "license": "Apache-2.0", + "engines": { + "node": ">=8.12.0" + }, + "files": [ + "build/src/**/*.js", + "build/src/**/*.js.map", + "build/src/**/*.d.ts", + "build/protos/**/*.proto", + "doc", + "LICENSE", + "README.md" + ], + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "@babel/core": "7.16.0", + "@opentelemetry/api": "^1.0.0", + "@types/mocha": "8.2.3", + "@types/node": "14.17.33", + "@types/sinon": "10.0.6", + "codecov": "3.8.3", + "cpx": "1.5.0", + "mocha": "7.2.0", + "nyc": "15.1.0", + "rimraf": "3.0.2", + "sinon": "12.0.1", + "ts-loader": "8.3.0", + "ts-mocha": "8.0.0", + "typescript": "4.4.4" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0" + }, + "dependencies": { + "@opentelemetry/core": "1.1.1", + "@grpc/proto-loader": "^0.6.9", + "@opentelemetry/otlp-exporter-base": "0.27.0", + "protobufjs": "^6.9.0" + } +} diff --git a/experimental/packages/exporter-trace-otlp-proto/protos b/experimental/packages/otlp-proto-exporter-base/protos similarity index 100% rename from experimental/packages/exporter-trace-otlp-proto/protos rename to experimental/packages/otlp-proto-exporter-base/protos diff --git a/experimental/packages/exporter-trace-otlp-proto/src/OTLPExporterNodeBase.ts b/experimental/packages/otlp-proto-exporter-base/src/OTLPProtoExporterNodeBase.ts similarity index 84% rename from experimental/packages/exporter-trace-otlp-proto/src/OTLPExporterNodeBase.ts rename to experimental/packages/otlp-proto-exporter-base/src/OTLPProtoExporterNodeBase.ts index eb9d6b766c0..6ff136ed941 100644 --- a/experimental/packages/exporter-trace-otlp-proto/src/OTLPExporterNodeBase.ts +++ b/experimental/packages/otlp-proto-exporter-base/src/OTLPProtoExporterNodeBase.ts @@ -15,24 +15,24 @@ */ import { diag } from '@opentelemetry/api'; +import { ServiceClientType } from './types'; import { OTLPExporterNodeBase as OTLPExporterBaseMain, - otlpTypes, - OTLPExporterNodeConfigBase, CompressionAlgorithm, -} from '@opentelemetry/exporter-trace-otlp-http'; -import { ServiceClientType } from './types'; + OTLPExporterError, + OTLPExporterNodeConfigBase +} from '@opentelemetry/otlp-exporter-base'; -type SendFn = (collector: OTLPExporterNodeBase, +type SendFn = (collector: OTLPProtoExporterNodeBase, objects: ExportItem[], compression: CompressionAlgorithm, onSuccess: () => void, - onError: (error: otlpTypes.OTLPExporterError) => void) => void; + onError: (error: OTLPExporterError) => void) => void; /** - * Collector Metric Exporter abstract base class + * Collector Exporter abstract base class */ -export abstract class OTLPExporterNodeBase< +export abstract class OTLPProtoExporterNodeBase< ExportItem, ServiceRequest > extends OTLPExporterBaseMain { @@ -45,7 +45,7 @@ export abstract class OTLPExporterNodeBase< private _sendPromise( objects: ExportItem[], onSuccess: () => void, - onError: (error: otlpTypes.OTLPExporterError) => void + onError: (error: OTLPExporterError) => void ): void { const promise = new Promise((resolve, reject) => { this._send(this, objects, this.compression, resolve, reject); @@ -73,7 +73,7 @@ export abstract class OTLPExporterNodeBase< override send( objects: ExportItem[], onSuccess: () => void, - onError: (error: otlpTypes.OTLPExporterError) => void + onError: (error: OTLPExporterError) => void ): void { if (this._shutdownOnce.isCalled) { diag.debug('Shutdown already started. Cannot send objects'); diff --git a/experimental/packages/otlp-proto-exporter-base/src/index.ts b/experimental/packages/otlp-proto-exporter-base/src/index.ts new file mode 100644 index 00000000000..e2cc1ee65c7 --- /dev/null +++ b/experimental/packages/otlp-proto-exporter-base/src/index.ts @@ -0,0 +1,19 @@ +/* + * 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. + */ + +export { OTLPProtoExporterNodeBase } from './OTLPProtoExporterNodeBase'; +export * from './types'; +export * from './util'; diff --git a/experimental/packages/exporter-trace-otlp-proto/src/types.ts b/experimental/packages/otlp-proto-exporter-base/src/types.ts similarity index 100% rename from experimental/packages/exporter-trace-otlp-proto/src/types.ts rename to experimental/packages/otlp-proto-exporter-base/src/types.ts diff --git a/experimental/packages/exporter-trace-otlp-proto/src/util.ts b/experimental/packages/otlp-proto-exporter-base/src/util.ts similarity index 86% rename from experimental/packages/exporter-trace-otlp-proto/src/util.ts rename to experimental/packages/otlp-proto-exporter-base/src/util.ts index ea38e815d60..0ab12f2e3e2 100644 --- a/experimental/packages/exporter-trace-otlp-proto/src/util.ts +++ b/experimental/packages/otlp-proto-exporter-base/src/util.ts @@ -14,18 +14,18 @@ * limitations under the License. */ -import { - otlpTypes, - sendWithHttp, - OTLPExporterNodeConfigBase, - CompressionAlgorithm, -} from '@opentelemetry/exporter-trace-otlp-http'; import * as path from 'path'; import { ServiceClientType } from './types'; -import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; +import { OTLPProtoExporterNodeBase } from './OTLPProtoExporterNodeBase'; import type { Type } from 'protobufjs'; import * as protobufjs from 'protobufjs'; +import { + CompressionAlgorithm, + OTLPExporterError, + OTLPExporterNodeConfigBase, + sendWithHttp +} from '@opentelemetry/otlp-exporter-base'; let ExportRequestProto: Type | undefined; @@ -34,7 +34,7 @@ export function getExportRequestProto(): Type | undefined { } export function onInit( - collector: OTLPExporterNodeBase, + collector: OTLPProtoExporterNodeBase, _config: OTLPExporterNodeConfigBase ): void { const dir = path.resolve(__dirname, '..', 'protos'); @@ -62,11 +62,11 @@ export function onInit( } export function send( - collector: OTLPExporterNodeBase, + collector: OTLPProtoExporterNodeBase, objects: ExportItem[], compression: CompressionAlgorithm, onSuccess: () => void, - onError: (error: otlpTypes.OTLPExporterError) => void + onError: (error: OTLPExporterError) => void ): void { const serviceRequest = collector.convert(objects); @@ -83,6 +83,6 @@ export function send( ); } } else { - onError(new otlpTypes.OTLPExporterError('No proto')); + onError(new OTLPExporterError('No proto')); } } diff --git a/experimental/packages/exporter-trace-otlp-proto/submodule.md b/experimental/packages/otlp-proto-exporter-base/submodule.md similarity index 93% rename from experimental/packages/exporter-trace-otlp-proto/submodule.md rename to experimental/packages/otlp-proto-exporter-base/submodule.md index c091e096929..c2838b1ba56 100644 --- a/experimental/packages/exporter-trace-otlp-proto/submodule.md +++ b/experimental/packages/otlp-proto-exporter-base/submodule.md @@ -15,7 +15,7 @@ Knowing this if you want to change the submodule to point to a different version ``` 3. Find the SHA which you want to update to and copy it (the long one) -the latest sha when this guide was written is `b54688569186e0b862bf7462a983ccf2c50c0547` + the latest sha when this guide was written is `59c488bfb8fb6d0458ad6425758b70259ff4a2bd` 4. Enter a submodule directory from this directory diff --git a/experimental/packages/otlp-proto-exporter-base/tsconfig.json b/experimental/packages/otlp-proto-exporter-base/tsconfig.json new file mode 100644 index 00000000000..0282e8dc835 --- /dev/null +++ b/experimental/packages/otlp-proto-exporter-base/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build" + }, + "include": [ + "src/**/*.ts", + "test/**/*.ts" + ], + "references": [ + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../otlp-exporter-base" + } + ] +} diff --git a/tsconfig.json b/tsconfig.json index e8b0b5cba6e..7b24699251c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -133,6 +133,15 @@ { "path": "experimental/packages/opentelemetry-sdk-node" }, + { + "path": "experimental/packages/otlp-exporter-base" + }, + { + "path": "experimental/packages/otlp-grpc-exporter-base" + }, + { + "path": "experimental/packages/otlp-proto-exporter-base" + }, { "path": "experimental/packages/otlp-transformer" }, From a0a670a03fd35b0799bee8cc466f79e93b5b6dd2 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 22 Apr 2022 10:32:28 -0400 Subject: [PATCH 5/6] Release proposal 1.2.0 / 0.28 (#2914) --- CHANGELOG.md | 12 ++++++++++ experimental/CHANGELOG.md | 12 ++++++++++ .../node10/package.json | 6 ++--- .../node12/package.json | 6 ++--- .../node8/package.json | 6 ++--- .../exporter-trace-otlp-grpc/package.json | 14 ++++++------ .../exporter-trace-otlp-http/package.json | 10 ++++----- .../exporter-trace-otlp-proto/package.json | 12 +++++----- .../opentelemetry-api-metrics/package.json | 2 +- .../package.json | 16 +++++++------- .../package.json | 14 ++++++------ .../package.json | 18 +++++++-------- .../package.json | 8 +++---- .../package.json | 16 +++++++------- .../package.json | 16 +++++++------- .../package.json | 14 ++++++------ .../package.json | 16 +++++++------- .../package.json | 4 ++-- .../package.json | 8 +++---- .../opentelemetry-sdk-node/package.json | 18 +++++++-------- .../packages/otlp-exporter-base/package.json | 4 ++-- .../otlp-grpc-exporter-base/package.json | 12 +++++----- .../otlp-proto-exporter-base/package.json | 6 ++--- .../packages/otlp-transformer/package.json | 12 +++++----- .../package.json | 8 +++---- .../package.json | 2 +- .../package.json | 2 +- .../opentelemetry-context-zone/package.json | 4 ++-- packages/opentelemetry-core/package.json | 4 ++-- .../package.json | 10 ++++----- .../package.json | 10 ++++----- .../opentelemetry-propagator-b3/package.json | 4 ++-- .../package.json | 4 ++-- packages/opentelemetry-resources/package.json | 6 ++--- .../opentelemetry-sdk-trace-base/package.json | 8 +++---- .../opentelemetry-sdk-trace-node/package.json | 16 +++++++------- .../opentelemetry-sdk-trace-web/package.json | 14 ++++++------ .../package.json | 2 +- .../package.json | 12 +++++----- packages/template/package.json | 2 +- selenium-tests/package.json | 22 +++++++++---------- 41 files changed, 208 insertions(+), 184 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58c9a285f2e..5e306c715b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,18 @@ All notable changes to this project will be documented in this file. ### :bug: (Bug Fix) +### :books: (Refine Doc) + +### :house: (Internal) + +## 1.2.0 + +### :boom: Breaking Change + +### :rocket: (Enhancement) + +### :bug: (Bug Fix) + * 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 diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 343e435b2d3..4eed8e22176 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -6,6 +6,18 @@ All notable changes to experimental packages in this project will be documented ### :boom: Breaking Change +### :rocket: (Enhancement) + +### :bug: (Bug Fix) + +### :books: (Refine Doc) + +### :house: (Internal) + +## 0.28.0 + +### :boom: Breaking Change + * feat(sdk-metrics-base): update metric exporter interfaces #2707 @srikanthccv * feat(api-metrics): remove observable types #2687 @legendecas * fix(otlp-http-exporter): remove content length header #2879 @svetlanabrennan diff --git a/experimental/backwards-compatability/node10/package.json b/experimental/backwards-compatability/node10/package.json index a64ec171c57..e4e1e06cad2 100644 --- a/experimental/backwards-compatability/node10/package.json +++ b/experimental/backwards-compatability/node10/package.json @@ -1,6 +1,6 @@ { "name": "backcompat-node10", - "version": "0.27.0", + "version": "0.28.0", "private": true, "description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK", "main": "index.js", @@ -9,8 +9,8 @@ "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "dependencies": { - "@opentelemetry/sdk-node": "0.27.0", - "@opentelemetry/sdk-trace-base": "1.1.1" + "@opentelemetry/sdk-node": "0.28.0", + "@opentelemetry/sdk-trace-base": "1.2.0" }, "devDependencies": { "@types/node": "10.17.60", diff --git a/experimental/backwards-compatability/node12/package.json b/experimental/backwards-compatability/node12/package.json index 6841f34928e..2c0adce3768 100644 --- a/experimental/backwards-compatability/node12/package.json +++ b/experimental/backwards-compatability/node12/package.json @@ -1,6 +1,6 @@ { "name": "backcompat-node12", - "version": "0.27.0", + "version": "0.28.0", "private": true, "description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK", "main": "index.js", @@ -9,8 +9,8 @@ "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "dependencies": { - "@opentelemetry/sdk-node": "0.27.0", - "@opentelemetry/sdk-trace-base": "1.1.1" + "@opentelemetry/sdk-node": "0.28.0", + "@opentelemetry/sdk-trace-base": "1.2.0" }, "devDependencies": { "@types/node": "12.20.37", diff --git a/experimental/backwards-compatability/node8/package.json b/experimental/backwards-compatability/node8/package.json index 517964a5472..e8e2b6eed68 100644 --- a/experimental/backwards-compatability/node8/package.json +++ b/experimental/backwards-compatability/node8/package.json @@ -1,6 +1,6 @@ { "name": "backcompat-node8", - "version": "0.27.0", + "version": "0.28.0", "private": true, "description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK", "main": "index.js", @@ -9,8 +9,8 @@ "peer-api-check": "node ../../../scripts/peer-api-check.js" }, "dependencies": { - "@opentelemetry/sdk-node": "0.27.0", - "@opentelemetry/sdk-trace-base": "1.1.1" + "@opentelemetry/sdk-node": "0.28.0", + "@opentelemetry/sdk-trace-base": "1.2.0" }, "devDependencies": { "@types/node": "8.10.66", diff --git a/experimental/packages/exporter-trace-otlp-grpc/package.json b/experimental/packages/exporter-trace-otlp-grpc/package.json index c8349a70388..74ddcb2f5ef 100644 --- a/experimental/packages/exporter-trace-otlp-grpc/package.json +++ b/experimental/packages/exporter-trace-otlp-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-trace-otlp-grpc", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -49,7 +49,7 @@ "devDependencies": { "@babel/core": "7.16.0", "@opentelemetry/api": "^1.0.0", - "@opentelemetry/otlp-exporter-base": "0.27.0", + "@opentelemetry/otlp-exporter-base": "0.28.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", @@ -67,12 +67,12 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.1.1", + "@opentelemetry/core": "1.2.0", "@grpc/grpc-js": "^1.5.9", "@grpc/proto-loader": "^0.6.9", - "@opentelemetry/exporter-trace-otlp-http": "0.27.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.27.0", - "@opentelemetry/resources": "1.1.1", - "@opentelemetry/sdk-trace-base": "1.1.1" + "@opentelemetry/exporter-trace-otlp-http": "0.28.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.28.0", + "@opentelemetry/resources": "1.2.0", + "@opentelemetry/sdk-trace-base": "1.2.0" } } diff --git a/experimental/packages/exporter-trace-otlp-http/package.json b/experimental/packages/exporter-trace-otlp-http/package.json index 8f301a65054..c4e631b0b82 100644 --- a/experimental/packages/exporter-trace-otlp-http/package.json +++ b/experimental/packages/exporter-trace-otlp-http/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-trace-otlp-http", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry Collector Trace Exporter allows user to send collected traces to the OpenTelemetry Collector", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -94,9 +94,9 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.1.1", - "@opentelemetry/resources": "1.1.1", - "@opentelemetry/sdk-trace-base": "1.1.1", - "@opentelemetry/otlp-exporter-base": "0.27.0" + "@opentelemetry/core": "1.2.0", + "@opentelemetry/resources": "1.2.0", + "@opentelemetry/sdk-trace-base": "1.2.0", + "@opentelemetry/otlp-exporter-base": "0.28.0" } } diff --git a/experimental/packages/exporter-trace-otlp-proto/package.json b/experimental/packages/exporter-trace-otlp-proto/package.json index 6aae7831384..f1c7071e65a 100644 --- a/experimental/packages/exporter-trace-otlp-proto/package.json +++ b/experimental/packages/exporter-trace-otlp-proto/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-trace-otlp-proto", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector using protobuf over HTTP", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -68,11 +68,11 @@ "dependencies": { "@opentelemetry/core": "1.1.1", "@grpc/proto-loader": "^0.6.9", - "@opentelemetry/exporter-trace-otlp-http": "0.27.0", - "@opentelemetry/resources": "1.1.1", - "@opentelemetry/sdk-trace-base": "1.1.1", - "@opentelemetry/otlp-exporter-base": "0.27.0", - "@opentelemetry/otlp-proto-exporter-base": "0.27.0", + "@opentelemetry/exporter-trace-otlp-http": "0.28.0", + "@opentelemetry/resources": "1.2.0", + "@opentelemetry/sdk-trace-base": "1.2.0", + "@opentelemetry/otlp-exporter-base": "0.28.0", + "@opentelemetry/otlp-proto-exporter-base": "0.28.0", "protobufjs": "^6.9.0" } } diff --git a/experimental/packages/opentelemetry-api-metrics/package.json b/experimental/packages/opentelemetry-api-metrics/package.json index bd5fc5b2f9f..036d5e7f9fd 100644 --- a/experimental/packages/opentelemetry-api-metrics/package.json +++ b/experimental/packages/opentelemetry-api-metrics/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/api-metrics", - "version": "0.27.0", + "version": "0.28.0", "private": true, "description": "Public metrics API for OpenTelemetry", "main": "build/src/index.js", diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json index 72b18aa960c..7c21499b26f 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-metrics-otlp-grpc", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -49,7 +49,7 @@ "devDependencies": { "@babel/core": "7.16.0", "@opentelemetry/api": "^1.0.0", - "@opentelemetry/api-metrics": "0.27.0", + "@opentelemetry/api-metrics": "0.28.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", @@ -69,11 +69,11 @@ "dependencies": { "@grpc/grpc-js": "^1.5.9", "@grpc/proto-loader": "^0.6.9", - "@opentelemetry/core": "1.1.1", - "@opentelemetry/exporter-metrics-otlp-http": "0.27.0", - "@opentelemetry/otlp-grpc-exporter-base": "0.27.0", - "@opentelemetry/exporter-trace-otlp-http": "0.27.0", - "@opentelemetry/resources": "1.1.1", - "@opentelemetry/sdk-metrics-base": "0.27.0" + "@opentelemetry/core": "1.2.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.28.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.28.0", + "@opentelemetry/exporter-trace-otlp-http": "0.28.0", + "@opentelemetry/resources": "1.2.0", + "@opentelemetry/sdk-metrics-base": "0.28.0" } } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json index c9d71652a84..f9a080ad0b8 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-metrics-otlp-http", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -94,11 +94,11 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/api-metrics": "0.27.0", - "@opentelemetry/core": "1.1.1", - "@opentelemetry/exporter-trace-otlp-http": "0.27.0", - "@opentelemetry/otlp-exporter-base": "0.27.0", - "@opentelemetry/resources": "1.1.1", - "@opentelemetry/sdk-metrics-base": "0.27.0" + "@opentelemetry/api-metrics": "0.28.0", + "@opentelemetry/core": "1.2.0", + "@opentelemetry/exporter-trace-otlp-http": "0.28.0", + "@opentelemetry/otlp-exporter-base": "0.28.0", + "@opentelemetry/resources": "1.2.0", + "@opentelemetry/sdk-metrics-base": "0.28.0" } } diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json index c0a77777a41..9f374d91a2e 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-metrics-otlp-proto", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector using protobuf over HTTP", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -49,7 +49,7 @@ "devDependencies": { "@babel/core": "7.16.0", "@opentelemetry/api": "^1.0.0", - "@opentelemetry/api-metrics": "0.27.0", + "@opentelemetry/api-metrics": "0.28.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", @@ -68,13 +68,13 @@ }, "dependencies": { "@grpc/proto-loader": "0.6.9", - "@opentelemetry/core": "1.1.1", - "@opentelemetry/exporter-metrics-otlp-http": "0.27.0", - "@opentelemetry/otlp-proto-exporter-base": "0.27.0", - "@opentelemetry/otlp-exporter-base": "0.27.0", - "@opentelemetry/exporter-trace-otlp-http": "0.27.0", - "@opentelemetry/resources": "1.1.1", - "@opentelemetry/sdk-metrics-base": "0.27.0", + "@opentelemetry/core": "1.2.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.28.0", + "@opentelemetry/otlp-proto-exporter-base": "0.28.0", + "@opentelemetry/otlp-exporter-base": "0.28.0", + "@opentelemetry/exporter-trace-otlp-http": "0.28.0", + "@opentelemetry/resources": "1.2.0", + "@opentelemetry/sdk-metrics-base": "0.28.0", "protobufjs": "^6.9.0" } } diff --git a/experimental/packages/opentelemetry-exporter-prometheus/package.json b/experimental/packages/opentelemetry-exporter-prometheus/package.json index 781d6b23a20..bb478bf88e2 100644 --- a/experimental/packages/opentelemetry-exporter-prometheus/package.json +++ b/experimental/packages/opentelemetry-exporter-prometheus/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-prometheus", - "version": "0.27.0", + "version": "0.28.0", "private": true, "description": "OpenTelemetry Exporter Prometheus provides a metrics endpoint for Prometheus", "main": "build/src/index.js", @@ -60,8 +60,8 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/api-metrics": "0.27.0", - "@opentelemetry/core": "1.1.1", - "@opentelemetry/sdk-metrics-base": "0.27.0" + "@opentelemetry/api-metrics": "0.28.0", + "@opentelemetry/core": "1.2.0", + "@opentelemetry/sdk-metrics-base": "0.28.0" } } diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/package.json b/experimental/packages/opentelemetry-instrumentation-fetch/package.json index 046c7087624..b62a61c594a 100644 --- a/experimental/packages/opentelemetry-instrumentation-fetch/package.json +++ b/experimental/packages/opentelemetry-instrumentation-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-fetch", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry fetch automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -56,9 +56,9 @@ "devDependencies": { "@babel/core": "7.16.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", + "@opentelemetry/context-zone": "1.2.0", + "@opentelemetry/propagator-b3": "1.2.0", + "@opentelemetry/sdk-trace-base": "1.2.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", @@ -87,9 +87,9 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.1.1", - "@opentelemetry/instrumentation": "0.27.0", - "@opentelemetry/sdk-trace-web": "1.1.1", - "@opentelemetry/semantic-conventions": "1.1.1" + "@opentelemetry/core": "1.2.0", + "@opentelemetry/instrumentation": "0.28.0", + "@opentelemetry/sdk-trace-web": "1.2.0", + "@opentelemetry/semantic-conventions": "1.2.0" } } diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/package.json b/experimental/packages/opentelemetry-instrumentation-grpc/package.json index e69148d97a8..6eb84d4ca7b 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/package.json +++ b/experimental/packages/opentelemetry-instrumentation-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-grpc", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry grpc automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -48,10 +48,10 @@ "@grpc/grpc-js": "1.5.9", "@grpc/proto-loader": "0.6.9", "@opentelemetry/api": "^1.0.0", - "@opentelemetry/context-async-hooks": "1.1.1", - "@opentelemetry/core": "1.1.1", - "@opentelemetry/sdk-trace-base": "1.1.1", - "@opentelemetry/sdk-trace-node": "1.1.1", + "@opentelemetry/context-async-hooks": "1.2.0", + "@opentelemetry/core": "1.2.0", + "@opentelemetry/sdk-trace-base": "1.2.0", + "@opentelemetry/sdk-trace-node": "1.2.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/semver": "7.3.9", @@ -71,8 +71,8 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/api-metrics": "0.27.0", - "@opentelemetry/instrumentation": "0.27.0", - "@opentelemetry/semantic-conventions": "1.1.1" + "@opentelemetry/api-metrics": "0.28.0", + "@opentelemetry/instrumentation": "0.28.0", + "@opentelemetry/semantic-conventions": "1.2.0" } } diff --git a/experimental/packages/opentelemetry-instrumentation-http/package.json b/experimental/packages/opentelemetry-instrumentation-http/package.json index 1106536b75b..e75414c1932 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/package.json +++ b/experimental/packages/opentelemetry-instrumentation-http/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-http", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry http/https automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -46,9 +46,9 @@ }, "devDependencies": { "@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", + "@opentelemetry/context-async-hooks": "1.2.0", + "@opentelemetry/sdk-trace-base": "1.2.0", + "@opentelemetry/sdk-trace-node": "1.2.0", "@types/got": "9.6.12", "@types/mocha": "8.2.3", "@types/node": "14.17.33", @@ -74,9 +74,9 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.1.1", - "@opentelemetry/instrumentation": "0.27.0", - "@opentelemetry/semantic-conventions": "1.1.1", + "@opentelemetry/core": "1.2.0", + "@opentelemetry/instrumentation": "0.28.0", + "@opentelemetry/semantic-conventions": "1.2.0", "semver": "^7.3.5" } } diff --git a/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json b/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json index e2b83b74050..7b89a2073f5 100644 --- a/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json +++ b/experimental/packages/opentelemetry-instrumentation-xml-http-request/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-xml-http-request", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry XMLHttpRequest automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -56,9 +56,9 @@ "devDependencies": { "@babel/core": "7.16.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", + "@opentelemetry/context-zone": "1.2.0", + "@opentelemetry/propagator-b3": "1.2.0", + "@opentelemetry/sdk-trace-base": "1.2.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", @@ -87,9 +87,9 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.1.1", - "@opentelemetry/instrumentation": "0.27.0", - "@opentelemetry/sdk-trace-web": "1.1.1", - "@opentelemetry/semantic-conventions": "1.1.1" + "@opentelemetry/core": "1.2.0", + "@opentelemetry/instrumentation": "0.28.0", + "@opentelemetry/sdk-trace-web": "1.2.0", + "@opentelemetry/semantic-conventions": "1.2.0" } } diff --git a/experimental/packages/opentelemetry-instrumentation/package.json b/experimental/packages/opentelemetry-instrumentation/package.json index cd2871378bf..2f83e703fd5 100644 --- a/experimental/packages/opentelemetry-instrumentation/package.json +++ b/experimental/packages/opentelemetry-instrumentation/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation", - "version": "0.27.0", + "version": "0.28.0", "description": "Base class for node which OpenTelemetry instrumentation modules extend", "author": "OpenTelemetry Authors", "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", @@ -68,7 +68,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/api-metrics": "0.27.0", + "@opentelemetry/api-metrics": "0.28.0", "require-in-the-middle": "^5.0.3", "semver": "^7.3.2", "shimmer": "^1.2.1" diff --git a/experimental/packages/opentelemetry-sdk-metrics-base/package.json b/experimental/packages/opentelemetry-sdk-metrics-base/package.json index d380ffe9b2a..1d73fd526d7 100644 --- a/experimental/packages/opentelemetry-sdk-metrics-base/package.json +++ b/experimental/packages/opentelemetry-sdk-metrics-base/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-metrics-base", - "version": "0.27.0", + "version": "0.28.0", "private": true, "description": "Work in progress OpenTelemetry metrics SDK", "main": "build/src/index.js", @@ -78,9 +78,9 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/api-metrics": "0.27.0", - "@opentelemetry/core": "1.1.1", - "@opentelemetry/resources": "1.1.1", + "@opentelemetry/api-metrics": "0.28.0", + "@opentelemetry/core": "1.2.0", + "@opentelemetry/resources": "1.2.0", "lodash.merge": "4.6.2" } } diff --git a/experimental/packages/opentelemetry-sdk-node/package.json b/experimental/packages/opentelemetry-sdk-node/package.json index 6cca89666fe..84ff5b699ab 100644 --- a/experimental/packages/opentelemetry-sdk-node/package.json +++ b/experimental/packages/opentelemetry-sdk-node/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-node", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry SDK for Node.js", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -44,22 +44,22 @@ "access": "public" }, "dependencies": { - "@opentelemetry/api-metrics": "0.27.0", - "@opentelemetry/core": "1.1.1", - "@opentelemetry/instrumentation": "0.27.0", + "@opentelemetry/api-metrics": "0.28.0", + "@opentelemetry/core": "1.2.0", + "@opentelemetry/instrumentation": "0.28.0", "@opentelemetry/resource-detector-aws": "~1.0.0", "@opentelemetry/resource-detector-gcp": "~0.26.0", - "@opentelemetry/resources": "1.1.1", - "@opentelemetry/sdk-metrics-base": "0.27.0", - "@opentelemetry/sdk-trace-base": "1.1.1", - "@opentelemetry/sdk-trace-node": "1.1.1" + "@opentelemetry/resources": "1.2.0", + "@opentelemetry/sdk-metrics-base": "0.28.0", + "@opentelemetry/sdk-trace-base": "1.2.0", + "@opentelemetry/sdk-trace-node": "1.2.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "devDependencies": { "@opentelemetry/api": ">=1.0.0 <1.2.0", - "@opentelemetry/context-async-hooks": "1.1.1", + "@opentelemetry/context-async-hooks": "1.2.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/semver": "7.3.9", diff --git a/experimental/packages/otlp-exporter-base/package.json b/experimental/packages/otlp-exporter-base/package.json index f389ac9650e..d82df98eaf2 100644 --- a/experimental/packages/otlp-exporter-base/package.json +++ b/experimental/packages/otlp-exporter-base/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/otlp-exporter-base", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry OTLP Exporter base (for internal use only)", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -55,7 +55,7 @@ "access": "public" }, "dependencies": { - "@opentelemetry/core": "1.1.1" + "@opentelemetry/core": "1.2.0" }, "devDependencies": { "@opentelemetry/api": "^1.0.0", diff --git a/experimental/packages/otlp-grpc-exporter-base/package.json b/experimental/packages/otlp-grpc-exporter-base/package.json index e73931b5143..d8066b89b76 100644 --- a/experimental/packages/otlp-grpc-exporter-base/package.json +++ b/experimental/packages/otlp-grpc-exporter-base/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/otlp-grpc-exporter-base", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry OTLP-gRPC Exporter base (for internal use only)", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -63,17 +63,17 @@ "ts-loader": "8.3.0", "ts-mocha": "8.0.0", "typescript": "4.4.4", - "@opentelemetry/sdk-trace-base": "1.1.1", - "@opentelemetry/resources": "1.1.1", - "@opentelemetry/exporter-trace-otlp-http": "0.27.0" + "@opentelemetry/sdk-trace-base": "1.2.0", + "@opentelemetry/resources": "1.2.0", + "@opentelemetry/exporter-trace-otlp-http": "0.28.0" }, "peerDependencies": { "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.1.1", + "@opentelemetry/core": "1.2.0", "@grpc/grpc-js": "^1.5.9", "@grpc/proto-loader": "^0.6.9", - "@opentelemetry/otlp-exporter-base": "0.27.0" + "@opentelemetry/otlp-exporter-base": "0.28.0" } } diff --git a/experimental/packages/otlp-proto-exporter-base/package.json b/experimental/packages/otlp-proto-exporter-base/package.json index 07824c20294..bf95c9936c6 100644 --- a/experimental/packages/otlp-proto-exporter-base/package.json +++ b/experimental/packages/otlp-proto-exporter-base/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/otlp-proto-exporter-base", - "version": "0.27.0", + "version": "0.28.0", "description": "OpenTelemetry OTLP-HTTP-protobuf Exporter base (for internal use only)", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -68,9 +68,9 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.1.1", + "@opentelemetry/core": "1.2.0", "@grpc/proto-loader": "^0.6.9", - "@opentelemetry/otlp-exporter-base": "0.27.0", + "@opentelemetry/otlp-exporter-base": "0.28.0", "protobufjs": "^6.9.0" } } diff --git a/experimental/packages/otlp-transformer/package.json b/experimental/packages/otlp-transformer/package.json index dd848efbd8b..15de49efefd 100644 --- a/experimental/packages/otlp-transformer/package.json +++ b/experimental/packages/otlp-transformer/package.json @@ -4,7 +4,7 @@ "publishConfig": { "access": "restricted" }, - "version": "0.27.0", + "version": "0.28.0", "description": "Transform OpenTelemetry SDK data into OTLP", "module": "build/esm/index.js", "esnext": "build/esnext/index.js", @@ -69,10 +69,10 @@ "webpack": "4.46.0" }, "dependencies": { - "@opentelemetry/api-metrics": "0.27.0", - "@opentelemetry/core": "1.1.1", - "@opentelemetry/resources": "1.1.1", - "@opentelemetry/sdk-metrics-base": "0.27.0", - "@opentelemetry/sdk-trace-base": "1.1.1" + "@opentelemetry/api-metrics": "0.28.0", + "@opentelemetry/core": "1.2.0", + "@opentelemetry/resources": "1.2.0", + "@opentelemetry/sdk-metrics-base": "0.28.0", + "@opentelemetry/sdk-trace-base": "1.2.0" } } diff --git a/integration-tests/propagation-validation-server/package.json b/integration-tests/propagation-validation-server/package.json index b7b1ffd6e69..11c372c65a4 100644 --- a/integration-tests/propagation-validation-server/package.json +++ b/integration-tests/propagation-validation-server/package.json @@ -1,6 +1,6 @@ { "name": "propagation-validation-server", - "version": "1.1.1", + "version": "1.2.0", "description": "server for w3c tests", "main": "validation_server.js", "private": true, @@ -12,9 +12,9 @@ }, "dependencies": { "@opentelemetry/api": "^1.0.0", - "@opentelemetry/context-async-hooks": "1.1.1", - "@opentelemetry/core": "1.1.1", - "@opentelemetry/sdk-trace-base": "1.1.1", + "@opentelemetry/context-async-hooks": "1.2.0", + "@opentelemetry/core": "1.2.0", + "@opentelemetry/sdk-trace-base": "1.2.0", "axios": "0.24.0", "body-parser": "1.19.0", "express": "4.17.1" diff --git a/packages/opentelemetry-context-async-hooks/package.json b/packages/opentelemetry-context-async-hooks/package.json index f54f6defff2..436ebeb04bd 100644 --- a/packages/opentelemetry-context-async-hooks/package.json +++ b/packages/opentelemetry-context-async-hooks/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-async-hooks", - "version": "1.1.1", + "version": "1.2.0", "description": "OpenTelemetry AsyncHooks-based Context Manager", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json index 510d75e1448..0c953684338 100644 --- a/packages/opentelemetry-context-zone-peer-dep/package.json +++ b/packages/opentelemetry-context-zone-peer-dep/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-zone-peer-dep", - "version": "1.1.1", + "version": "1.2.0", "description": "OpenTelemetry Context Zone with peer dependency for zone.js", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/packages/opentelemetry-context-zone/package.json b/packages/opentelemetry-context-zone/package.json index 573cbac0097..30a1e944b3c 100644 --- a/packages/opentelemetry-context-zone/package.json +++ b/packages/opentelemetry-context-zone/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-zone", - "version": "1.1.1", + "version": "1.2.0", "description": "OpenTelemetry Context Zone", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -74,7 +74,7 @@ "webpack-merge": "5.8.0" }, "dependencies": { - "@opentelemetry/context-zone-peer-dep": "1.1.1", + "@opentelemetry/context-zone-peer-dep": "1.2.0", "zone.js": "^0.11.0" }, "sideEffects": true diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json index c16c8a0b80e..9a801c8b742 100644 --- a/packages/opentelemetry-core/package.json +++ b/packages/opentelemetry-core/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/core", - "version": "1.1.1", + "version": "1.2.0", "description": "OpenTelemetry Core provides constants and utilities shared by all OpenTelemetry SDK packages.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -91,6 +91,6 @@ "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "dependencies": { - "@opentelemetry/semantic-conventions": "1.1.1" + "@opentelemetry/semantic-conventions": "1.2.0" } } diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json index b2aec917a43..35338937d3c 100644 --- a/packages/opentelemetry-exporter-jaeger/package.json +++ b/packages/opentelemetry-exporter-jaeger/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-jaeger", - "version": "1.1.1", + "version": "1.2.0", "description": "OpenTelemetry Exporter Jaeger allows user to send collected traces to Jaeger", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -45,7 +45,7 @@ }, "devDependencies": { "@opentelemetry/api": "^1.0.0", - "@opentelemetry/resources": "1.1.1", + "@opentelemetry/resources": "1.2.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/sinon": "10.0.6", @@ -62,9 +62,9 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.1.1", - "@opentelemetry/sdk-trace-base": "1.1.1", - "@opentelemetry/semantic-conventions": "1.1.1", + "@opentelemetry/core": "1.2.0", + "@opentelemetry/sdk-trace-base": "1.2.0", + "@opentelemetry/semantic-conventions": "1.2.0", "jaeger-client": "^3.15.0" } } diff --git a/packages/opentelemetry-exporter-zipkin/package.json b/packages/opentelemetry-exporter-zipkin/package.json index 6f40163de48..a0c5da88802 100644 --- a/packages/opentelemetry-exporter-zipkin/package.json +++ b/packages/opentelemetry-exporter-zipkin/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-zipkin", - "version": "1.1.1", + "version": "1.2.0", "description": "OpenTelemetry Zipkin Exporter allows the user to send collected traces to Zipkin.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -91,9 +91,9 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/core": "1.1.1", - "@opentelemetry/resources": "1.1.1", - "@opentelemetry/sdk-trace-base": "1.1.1", - "@opentelemetry/semantic-conventions": "1.1.1" + "@opentelemetry/core": "1.2.0", + "@opentelemetry/resources": "1.2.0", + "@opentelemetry/sdk-trace-base": "1.2.0", + "@opentelemetry/semantic-conventions": "1.2.0" } } diff --git a/packages/opentelemetry-propagator-b3/package.json b/packages/opentelemetry-propagator-b3/package.json index e88c349da5b..e65cecd0f77 100644 --- a/packages/opentelemetry-propagator-b3/package.json +++ b/packages/opentelemetry-propagator-b3/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/propagator-b3", - "version": "1.1.1", + "version": "1.2.0", "description": "OpenTelemetry B3 propagator provides context propagation for systems that are using the B3 header format", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -51,7 +51,7 @@ "access": "public" }, "dependencies": { - "@opentelemetry/core": "1.1.1" + "@opentelemetry/core": "1.2.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.2.0" diff --git a/packages/opentelemetry-propagator-jaeger/package.json b/packages/opentelemetry-propagator-jaeger/package.json index ba952774d8b..73b2fe84c5a 100644 --- a/packages/opentelemetry-propagator-jaeger/package.json +++ b/packages/opentelemetry-propagator-jaeger/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/propagator-jaeger", - "version": "1.1.1", + "version": "1.2.0", "description": "OpenTelemetry Jaeger propagator provides HTTP header propagation for systems that are using Jaeger HTTP header format.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -80,6 +80,6 @@ "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "dependencies": { - "@opentelemetry/core": "1.1.1" + "@opentelemetry/core": "1.2.0" } } diff --git a/packages/opentelemetry-resources/package.json b/packages/opentelemetry-resources/package.json index be6e466534c..7528fa097fc 100644 --- a/packages/opentelemetry-resources/package.json +++ b/packages/opentelemetry-resources/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resources", - "version": "1.1.1", + "version": "1.2.0", "description": "OpenTelemetry SDK resources", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -87,7 +87,7 @@ "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "dependencies": { - "@opentelemetry/core": "1.1.1", - "@opentelemetry/semantic-conventions": "1.1.1" + "@opentelemetry/core": "1.2.0", + "@opentelemetry/semantic-conventions": "1.2.0" } } diff --git a/packages/opentelemetry-sdk-trace-base/package.json b/packages/opentelemetry-sdk-trace-base/package.json index 1335fec0694..d7c760e83ec 100644 --- a/packages/opentelemetry-sdk-trace-base/package.json +++ b/packages/opentelemetry-sdk-trace-base/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-trace-base", - "version": "1.1.1", + "version": "1.2.0", "description": "OpenTelemetry Tracing", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -88,8 +88,8 @@ "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "dependencies": { - "@opentelemetry/core": "1.1.1", - "@opentelemetry/resources": "1.1.1", - "@opentelemetry/semantic-conventions": "1.1.1" + "@opentelemetry/core": "1.2.0", + "@opentelemetry/resources": "1.2.0", + "@opentelemetry/semantic-conventions": "1.2.0" } } diff --git a/packages/opentelemetry-sdk-trace-node/package.json b/packages/opentelemetry-sdk-trace-node/package.json index c315ce00ab0..c6a053d7f96 100644 --- a/packages/opentelemetry-sdk-trace-node/package.json +++ b/packages/opentelemetry-sdk-trace-node/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-trace-node", - "version": "1.1.1", + "version": "1.2.0", "description": "OpenTelemetry Node SDK provides automatic telemetry (tracing, metrics, etc) for Node.js applications", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -46,8 +46,8 @@ }, "devDependencies": { "@opentelemetry/api": ">=1.0.0 <1.2.0", - "@opentelemetry/resources": "1.1.1", - "@opentelemetry/semantic-conventions": "1.1.1", + "@opentelemetry/resources": "1.2.0", + "@opentelemetry/semantic-conventions": "1.2.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "@types/semver": "7.3.9", @@ -64,11 +64,11 @@ "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "dependencies": { - "@opentelemetry/context-async-hooks": "1.1.1", - "@opentelemetry/core": "1.1.1", - "@opentelemetry/propagator-b3": "1.1.1", - "@opentelemetry/propagator-jaeger": "1.1.1", - "@opentelemetry/sdk-trace-base": "1.1.1", + "@opentelemetry/context-async-hooks": "1.2.0", + "@opentelemetry/core": "1.2.0", + "@opentelemetry/propagator-b3": "1.2.0", + "@opentelemetry/propagator-jaeger": "1.2.0", + "@opentelemetry/sdk-trace-base": "1.2.0", "semver": "^7.3.5" } } diff --git a/packages/opentelemetry-sdk-trace-web/package.json b/packages/opentelemetry-sdk-trace-web/package.json index 01f8be227f1..467c0f7ccd8 100644 --- a/packages/opentelemetry-sdk-trace-web/package.json +++ b/packages/opentelemetry-sdk-trace-web/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-trace-web", - "version": "1.1.1", + "version": "1.2.0", "description": "OpenTelemetry Web Tracer", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -57,9 +57,9 @@ "devDependencies": { "@babel/core": "7.16.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", + "@opentelemetry/context-zone": "1.2.0", + "@opentelemetry/propagator-b3": "1.2.0", + "@opentelemetry/resources": "1.2.0", "@types/jquery": "3.5.8", "@types/mocha": "8.2.3", "@types/node": "14.17.33", @@ -91,8 +91,8 @@ "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "dependencies": { - "@opentelemetry/core": "1.1.1", - "@opentelemetry/sdk-trace-base": "1.1.1", - "@opentelemetry/semantic-conventions": "1.1.1" + "@opentelemetry/core": "1.2.0", + "@opentelemetry/sdk-trace-base": "1.2.0", + "@opentelemetry/semantic-conventions": "1.2.0" } } diff --git a/packages/opentelemetry-semantic-conventions/package.json b/packages/opentelemetry-semantic-conventions/package.json index c7cccffee8e..315c67d3431 100644 --- a/packages/opentelemetry-semantic-conventions/package.json +++ b/packages/opentelemetry-semantic-conventions/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/semantic-conventions", - "version": "1.1.1", + "version": "1.2.0", "description": "OpenTelemetry semantic conventions", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/packages/opentelemetry-shim-opentracing/package.json b/packages/opentelemetry-shim-opentracing/package.json index 80e0f391e3a..91964a4edaa 100644 --- a/packages/opentelemetry-shim-opentracing/package.json +++ b/packages/opentelemetry-shim-opentracing/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/shim-opentracing", - "version": "1.1.1", + "version": "1.2.0", "description": "OpenTracing to OpenTelemetry shim", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -43,9 +43,9 @@ }, "devDependencies": { "@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", + "@opentelemetry/propagator-b3": "1.2.0", + "@opentelemetry/propagator-jaeger": "1.2.0", + "@opentelemetry/sdk-trace-base": "1.2.0", "@types/mocha": "8.2.3", "@types/node": "14.17.33", "codecov": "3.8.3", @@ -59,8 +59,8 @@ "@opentelemetry/api": ">=1.0.0 <1.2.0" }, "dependencies": { - "@opentelemetry/core": "1.1.1", - "@opentelemetry/semantic-conventions": "1.1.1", + "@opentelemetry/core": "1.2.0", + "@opentelemetry/semantic-conventions": "1.2.0", "opentracing": "^0.14.4" } } diff --git a/packages/template/package.json b/packages/template/package.json index a98ea590b20..233f971f5a5 100644 --- a/packages/template/package.json +++ b/packages/template/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/template", - "version": "1.1.1", + "version": "1.2.0", "private": true, "publishConfig": { "access": "restricted" diff --git a/selenium-tests/package.json b/selenium-tests/package.json index c25948a02f7..ee0c7d1ae8e 100644 --- a/selenium-tests/package.json +++ b/selenium-tests/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/selenium-tests", - "version": "1.1.1", + "version": "1.2.0", "private": true, "description": "OpenTelemetry Selenium Tests", "main": "index.js", @@ -56,16 +56,16 @@ "@opentelemetry/api": "^1.0.0" }, "dependencies": { - "@opentelemetry/context-zone-peer-dep": "1.1.1", - "@opentelemetry/core": "1.1.1", - "@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", - "@opentelemetry/instrumentation-xml-http-request": "0.27.0", - "@opentelemetry/sdk-metrics-base": "0.27.0", - "@opentelemetry/sdk-trace-base": "1.1.1", - "@opentelemetry/sdk-trace-web": "1.1.1", + "@opentelemetry/context-zone-peer-dep": "1.2.0", + "@opentelemetry/core": "1.2.0", + "@opentelemetry/exporter-trace-otlp-http": "0.28.0", + "@opentelemetry/exporter-zipkin": "1.2.0", + "@opentelemetry/instrumentation": "0.28.0", + "@opentelemetry/instrumentation-fetch": "0.28.0", + "@opentelemetry/instrumentation-xml-http-request": "0.28.0", + "@opentelemetry/sdk-metrics-base": "0.28.0", + "@opentelemetry/sdk-trace-base": "1.2.0", + "@opentelemetry/sdk-trace-web": "1.2.0", "zone.js": "0.11.4" } } From 4584c36026ac491e6bc07f9151473e3a7b3e3608 Mon Sep 17 00:00:00 2001 From: shmilyoo Date: Sun, 24 Apr 2022 17:55:06 +0800 Subject: [PATCH 6/6] fix(propagator-jaeger):extract 1 digit traceFlag(0) return 1 (#2906) * fix(propagator-jaeger):extract 1 digit traceFlag(0) return 1 * update CHANGELOG * fix quota * Parse jaeger flags with radix 16 Co-authored-by: legendecas Co-authored-by: Daniel Dyla Co-authored-by: legendecas --- CHANGELOG.md | 3 +++ .../src/JaegerPropagator.ts | 2 +- .../test/JaegerPropagator.test.ts | 17 ++++++++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e306c715b0..b0e23d98076 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file. * 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 +* fix: support extract one digit '0' in jaeger traceFlag [#2905](https://github.com/open-telemetry/opentelemetry-js/issues/2905) @shmilyoo ### :books: (Refine Doc) @@ -34,6 +35,8 @@ 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 +* `opentelemetry-propagator-jaeger` + * [#2906](https://github.com/open-telemetry/opentelemetry-js/pull/2906) fix: support extract one digit '0' in jaeger traceFlag ([@shmilyoo](https://github.com/shmilyoo)) ## 1.1.1 diff --git a/packages/opentelemetry-propagator-jaeger/src/JaegerPropagator.ts b/packages/opentelemetry-propagator-jaeger/src/JaegerPropagator.ts index f41f6adf131..93f08e489c6 100644 --- a/packages/opentelemetry-propagator-jaeger/src/JaegerPropagator.ts +++ b/packages/opentelemetry-propagator-jaeger/src/JaegerPropagator.ts @@ -145,7 +145,7 @@ function deserializeSpanContext(serializedString: string): SpanContext | null { const traceId = _traceId.padStart(32, '0'); const spanId = _spanId.padStart(16, '0'); - const traceFlags = flags.match(/^[0-9a-f]{2}$/i) ? parseInt(flags) & 1 : 1; + const traceFlags = flags.match(/^[0-9a-f]{1,2}$/i) ? parseInt(flags, 16) & 1 : 1; return { traceId, spanId, isRemote: true, traceFlags }; } diff --git a/packages/opentelemetry-propagator-jaeger/test/JaegerPropagator.test.ts b/packages/opentelemetry-propagator-jaeger/test/JaegerPropagator.test.ts index f0683898bff..1e21e6a218b 100644 --- a/packages/opentelemetry-propagator-jaeger/test/JaegerPropagator.test.ts +++ b/packages/opentelemetry-propagator-jaeger/test/JaegerPropagator.test.ts @@ -159,7 +159,7 @@ describe('JaegerPropagator', () => { }); }); - it('should extract context of a sampled span from carrier with 1 bit flag', () => { + it('should extract context of a sampled span from carrier with 1 bit flag(1)', () => { carrier[UBER_TRACE_ID_HEADER] = '9c41e35aeb6d1272:45fd2a9709dadcf1:a13699e3fb724f40:1'; const extractedSpanContext = trace.getSpanContext( @@ -174,6 +174,21 @@ describe('JaegerPropagator', () => { }); }); + it('should extract context of a sampled span from carrier with 1 bit flag(0)', () => { + carrier[UBER_TRACE_ID_HEADER] = + '9c41e35aeb6d1272:45fd2a9709dadcf1:a13699e3fb724f40:0'; + const extractedSpanContext = trace.getSpanContext( + jaegerPropagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter) + ); + + assert.deepStrictEqual(extractedSpanContext, { + spanId: '45fd2a9709dadcf1', + traceId: '00000000000000009c41e35aeb6d1272', + isRemote: true, + traceFlags: TraceFlags.NONE, + }); + }); + it('should extract context of a sampled span from UTF-8 encoded carrier', () => { carrier[UBER_TRACE_ID_HEADER] = 'ac1f3dc3c2c0b06e%3A5ac292c4a11a163e%3Ac086aaa825821068%3A1';