diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 8fc5e17ba2..734bd6b29d 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -55,8 +55,6 @@ jobs: run: npm run codecov if: ${{ matrix.node_version == '14' }} node-windows-tests: - strategy: - fail-fast: false runs-on: windows-latest env: NPM_CONFIG_UNSAFE_PERM: true @@ -96,15 +94,15 @@ jobs: run: npm run test browser-tests: runs-on: ubuntu-latest - container: - image: circleci/node:16-browsers env: NPM_CONFIG_UNSAFE_PERM: true steps: - - name: Permission Setup - run: sudo chmod -R 777 /github /__w - name: Checkout - uses: actions/checkout@v3.0.2 + uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 16 - name: restore lerna id: cache @@ -126,8 +124,6 @@ jobs: - name: Build 🔧 run: | - npm run compile - # run additional compilation variants npx lerna run compile - name: Unit tests @@ -136,15 +132,14 @@ jobs: run: npm run codecov:browser webworker-tests: runs-on: ubuntu-latest - container: - image: circleci/node:16-browsers env: NPM_CONFIG_UNSAFE_PERM: true steps: - - name: Permission Setup - run: sudo chmod -R 777 /github /__w - name: Checkout uses: actions/checkout@v3.0.2 + - uses: actions/setup-node@v3 + with: + node-version: 16 - name: restore lerna id: cache @@ -166,11 +161,37 @@ jobs: - name: Build 🔧 run: | - npm run compile - # run additional compilation variants npx lerna run compile - name: Unit tests run: npm run test:webworker - name: Report Coverage run: npm run codecov:webworker + api-eol-node-test: + strategy: + fail-fast: false + matrix: + node_version: + - "8" + - "10" + - "12" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node_version }} + + - name: Build + working-directory: ./api + run: | + npm install --ignore-scripts + npm install @types/mocha@^7 mocha@^7 ts-loader@^8 ts-mocha@^8 + node ../scripts/version-update.js + tsc --build tsconfig.json tsconfig.esm.json + + - name: Test + working-directory: ./api + run: npm test diff --git a/CHANGELOG.md b/CHANGELOG.md index dc96d88150..b17fd36d5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,10 +12,15 @@ All notable changes to this project will be documented in this file. ### :bug: (Bug Fix) +* fix(resources): fix EnvDetector throwing errors when attribute values contain spaces + [#3295](https://github.com/open-telemetry/opentelemetry-js/issues/3295) + ### :books: (Refine Doc) ### :house: (Internal) +* ci: run browser tests without circle [#3328](https://github.com/open-telemetry/opentelemetry-js/pull/3328) @dyladan + ## 1.7.0 ### :bug: (Bug Fix) diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 3c785831fd..595add19a3 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -15,6 +15,7 @@ All notable changes to experimental packages in this project will be documented * fix(node-sdk): move `@opentelemetry/semantic-conventions` to `dependencies` [#3283](https://github.com/open-telemetry/opentelemetry-js/pull/3283) @mhassan1 * fix(exporters): do not append trailing '/' when URL contains path [#3274](https://github.com/open-telemetry/opentelemetry-js/pull/3274) @pichlermarc +* fix(instrumentation): debug log on no modules defined for instrumentation [#3308](https://github.com/open-telemetry/opentelemetry-js/pull/3308) @legendecas ### :books: (Refine Doc) diff --git a/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts b/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts index 70dac85332..5bc0921778 100644 --- a/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts +++ b/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts @@ -48,9 +48,10 @@ export abstract class InstrumentationBase this._modules = (modules as InstrumentationModuleDefinition[]) || []; if (this._modules.length === 0) { - diag.warn( - 'No modules instrumentation has been defined,' + - ' nothing will be patched' + diag.debug( + 'No modules instrumentation has been defined for ' + + `'${this.instrumentationName}@${this.instrumentationVersion}'` + + ', nothing will be patched' ); } diff --git a/packages/opentelemetry-resources/src/detectors/EnvDetector.ts b/packages/opentelemetry-resources/src/detectors/EnvDetector.ts index 782f664a1a..44f15dcdfe 100644 --- a/packages/opentelemetry-resources/src/detectors/EnvDetector.ts +++ b/packages/opentelemetry-resources/src/detectors/EnvDetector.ts @@ -110,7 +110,7 @@ class EnvDetector implements Detector { let [key, value] = keyValuePair; // Leading and trailing whitespaces are trimmed. key = key.trim(); - value = value.trim().split('^"|"$').join(''); + value = value.trim().split(/^"|"$/).join(''); if (!this._isValidAndNotEmpty(key)) { throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`); } @@ -136,7 +136,7 @@ class EnvDetector implements Detector { private _isPrintableString(str: string): boolean { for (let i = 0; i < str.length; i++) { const ch: string = str.charAt(i); - if (ch <= ' ' || ch >= '~') { + if (ch < ' ' || ch >= '~') { return false; } } diff --git a/packages/opentelemetry-resources/test/detectors/node/EnvDetector.test.ts b/packages/opentelemetry-resources/test/detectors/node/EnvDetector.test.ts index 2a2746e14b..486de2b4bb 100644 --- a/packages/opentelemetry-resources/test/detectors/node/EnvDetector.test.ts +++ b/packages/opentelemetry-resources/test/detectors/node/EnvDetector.test.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'; import { envDetector, Resource } from '../../../src'; import { assertK8sResource, @@ -26,7 +25,7 @@ describeNode('envDetector() on Node.js', () => { describe('with valid env', () => { before(() => { process.env.OTEL_RESOURCE_ATTRIBUTES = - 'k8s.pod.name="pod-xyz-123",k8s.cluster.name="c1",k8s.namespace.name="default"'; + 'k8s.pod.name="pod-xyz-123",k8s.cluster.name="c1",k8s.namespace.name="default",k8s.deployment.name="deployment name"'; }); after(() => { @@ -36,9 +35,10 @@ describeNode('envDetector() on Node.js', () => { it('should return resource information from environment variable', async () => { const resource: Resource = await envDetector.detect(); assertK8sResource(resource, { - [SemanticResourceAttributes.K8S_POD_NAME]: 'pod-xyz-123', - [SemanticResourceAttributes.K8S_CLUSTER_NAME]: 'c1', - [SemanticResourceAttributes.K8S_NAMESPACE_NAME]: 'default', + podName: 'pod-xyz-123', + clusterName: 'c1', + namespaceName: 'default', + deploymentName: 'deployment name' }); }); });