From 859c0ef5a0746afe9d4b3ef72505d20fab4448e0 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Wed, 9 Oct 2024 10:04:17 +0200 Subject: [PATCH 1/5] ci: use codecov token when uploading reports (#5053) --- .github/workflows/unit-test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 11bf4a9c7a..55db405284 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -48,6 +48,8 @@ jobs: run: npm run test - name: Report Coverage uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: verbose: true node-windows-tests: @@ -102,6 +104,8 @@ jobs: run: npm run test:browser - name: Report Coverage uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: verbose: true webworker-tests: @@ -128,6 +132,8 @@ jobs: run: npm run test:webworker - name: Report Coverage uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: verbose: true api-eol-node-test: From 039db0b3fc0dd56b72a13195db9865186aed3288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Th=C3=A9riault?= <113933910+raphael-theriault-swi@users.noreply.github.com> Date: Thu, 10 Oct 2024 01:01:10 -0700 Subject: [PATCH 2/5] fix(exporter-logs-otlp-proto): Use correct config type in constructor (#5058) --- experimental/CHANGELOG.md | 1 + .../src/platform/node/OTLPLogExporter.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 37252e92cc..d7b1415697 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -47,6 +47,7 @@ All notable changes to experimental packages in this project will be documented * `configureExporterTimeout` * `invalidTimeout` * fix(sdk-node): use warn instead of error on unknown OTEL_NODE_RESOURCE_DETECTORS values [#5034](https://github.com/open-telemetry/opentelemetry-js/pull/5034) +* fix(exporter-logs-otlp-proto): Use correct config type in Node constructor ### :books: (Refine Doc) diff --git a/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts b/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts index 828a11cbc6..d897208389 100644 --- a/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts +++ b/experimental/packages/exporter-logs-otlp-proto/src/platform/node/OTLPLogExporter.ts @@ -15,8 +15,8 @@ */ import { - OTLPExporterConfigBase, OTLPExporterNodeBase, + OTLPExporterNodeConfigBase, } from '@opentelemetry/otlp-exporter-base'; import { IExportLogsServiceResponse, @@ -37,7 +37,7 @@ export class OTLPLogExporter extends OTLPExporterNodeBase implements LogRecordExporter { - constructor(config: OTLPExporterConfigBase = {}) { + constructor(config: OTLPExporterNodeConfigBase = {}) { super( config, ProtobufLogsSerializer, From 6be903a90225431def0f554d1fbac315e329de9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Zi=C3=B3=C5=82kowski?= Date: Fri, 11 Oct 2024 22:59:41 +0200 Subject: [PATCH 3/5] fix(resources): wait for async attributes for detecting resources (#4687) Co-authored-by: David Luna --- CHANGELOG.md | 1 + packages/opentelemetry-resources/src/detect-resources.ts | 1 + .../opentelemetry-resources/test/detect-resources.test.ts | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ad9ff304d..7194d8ba17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -110,6 +110,7 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se * fix(resources): prevent circular import (resource -> detector -> resource -> ...) [#4653](https://github.com/open-telemetry/opentelemetry-js/pull/4653) @pichlermarc * fixes a circular import warning which would appear in rollup when bundling `@opentelemetry/resources` * fix(exporter-metrics-otlp-grpc): add explicit otlp-exporter-base dependency to exporter-metrics-otlp-grpc [#4678](https://github.com/open-telemetry/opentelemetry-js/pull/4678) @AkselAllas +* fix(resources) wait for async attributes for detecting resources [#4687](https://github.com/open-telemetry/opentelemetry-js/pull/4687) @ziolekjj ## 1.24.0 diff --git a/packages/opentelemetry-resources/src/detect-resources.ts b/packages/opentelemetry-resources/src/detect-resources.ts index 4fa477a4f8..0bfa13cac8 100644 --- a/packages/opentelemetry-resources/src/detect-resources.ts +++ b/packages/opentelemetry-resources/src/detect-resources.ts @@ -70,6 +70,7 @@ export const detectResourcesSync = ( if (isPromiseLike(resourceOrPromise)) { const createPromise = async () => { const resolvedResource = await resourceOrPromise; + await resolvedResource.waitForAsyncAttributes?.(); return resolvedResource.attributes; }; resource = new Resource({}, createPromise()); diff --git a/packages/opentelemetry-resources/test/detect-resources.test.ts b/packages/opentelemetry-resources/test/detect-resources.test.ts index 0db97057db..7c3b1a212c 100644 --- a/packages/opentelemetry-resources/test/detect-resources.test.ts +++ b/packages/opentelemetry-resources/test/detect-resources.test.ts @@ -28,7 +28,10 @@ describe('detectResourcesSync', () => { it('handles resource detectors which return Promise', async () => { const detector: Detector = { async detect() { - return new Resource({ sync: 'fromsync' }); + return new Resource( + { sync: 'fromsync' }, + Promise.resolve().then(() => ({ async: 'fromasync' })) + ); }, }; const resource = detectResourcesSync({ @@ -38,6 +41,7 @@ describe('detectResourcesSync', () => { await resource.waitForAsyncAttributes?.(); assert.deepStrictEqual(resource.attributes, { sync: 'fromsync', + async: 'fromasync', }); }); From 7293e69c1e55ca62e15d0724d22605e61bd58952 Mon Sep 17 00:00:00 2001 From: Annosha <111076986+Annosha@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:29:39 +0500 Subject: [PATCH 4/5] Added custom test instructions for browser-specific tests (#5056) Co-authored-by: Trent Mick Co-authored-by: Marc Pichler --- CONTRIBUTING.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 374f0470d0..3d78418a01 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -223,6 +223,16 @@ To run the unit tests continuously in watch mode while developing, use: npm run tdd ``` +Packages that are expected to run in the browser have browser specific tests: + +```sh +# Run browser-specific test +npm run test:browser + +# Run web worker test +npm run test:webworker +``` + ### Linting This project uses `eslint` to lint source code. Just like tests and compilation, linting can be done for all packages or only a single package. From a1442fec01fcbbf9a2e2d36e00a84eec5226cabf Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Mon, 14 Oct 2024 17:50:56 +0200 Subject: [PATCH 5/5] ci: add workflow to publish packages to npm (#5067) --- .github/workflows/publish-to-npm.yml | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/publish-to-npm.yml diff --git a/.github/workflows/publish-to-npm.yml b/.github/workflows/publish-to-npm.yml new file mode 100644 index 0000000000..b51678268a --- /dev/null +++ b/.github/workflows/publish-to-npm.yml @@ -0,0 +1,31 @@ +name: Publish packages to NPM + +on: + workflow_dispatch: + +jobs: + release-to-npm: + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 18 + registry-url: 'https://registry.npmjs.org' + + - run: npm ci + + - run: npm run compile + + - name: Publish to npm + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + NPM_CONFIG_PROVENANCE: true + run: npx lerna publish --concurrency 1 from-package --no-push --no-private --no-git-tag-version --no-verify-access --yes