From 19c7b17627cb649f18e1dfaebe6cd6a055fd26d5 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Thu, 27 Aug 2020 13:32:27 -0400 Subject: [PATCH] chore: bump gcp-metadata bump minimum node ver for gcp detector Co-authored-by: Bradley Behnke --- .circleci/checksum.sh | 1 + .circleci/config.yml | 14 ++++++++------ .../opentelemetry-resource-detector-gcp/README.md | 2 ++ .../package.json | 11 +++++------ .../test/detectors/GcpDetector.test.ts | 5 +++-- packages/opentelemetry-sdk-node/package.json | 2 +- 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.circleci/checksum.sh b/.circleci/checksum.sh index af2e0f293e..fa7cab9ae9 100644 --- a/.circleci/checksum.sh +++ b/.circleci/checksum.sh @@ -22,5 +22,6 @@ fi openssl md5 package.json >> $FILE find packages/*/package.json | xargs -I{} openssl md5 {} >> $FILE +find metapackages/*/package.json | xargs -I{} openssl md5 {} >> $FILE sort -o $FILE $FILE diff --git a/.circleci/config.yml b/.circleci/config.yml index e19df84e8a..15b55c5a74 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ node_test_env: &node_test_env cache_1: &cache_1 - key: npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-F267A71D + key: npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-20B74F85 paths: - ./node_modules - ./package-lock.json @@ -25,13 +25,15 @@ cache_1: &cache_1 - packages/opentelemetry-web/node_modules cache_2: &cache_2 - key: npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-F267A71D + key: npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-20B74F85 paths: - packages/opentelemetry-plugin-grpc/node_modules - packages/opentelemetry-plugin-http/node_modules - packages/opentelemetry-plugin-https/node_modules - packages/opentelemetry-exporter-collector/node_modules - packages/opentelemetry-plugin-xml-http-request/node_modules + - packages/opentelemetry-resource-detector-aws/node_modules + - packages/opentelemetry-resource-detector-gcp/node_modules - packages/opentelemetry-resources/node_modules node_unit_tests: &node_unit_tests @@ -53,10 +55,10 @@ node_unit_tests: &node_unit_tests echo "CIRCLE_NODE_VERSION=${CIRCLE_NODE_VERSION}" - restore_cache: keys: - - npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-F267A71D + - npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-20B74F85 - restore_cache: keys: - - npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-F267A71D + - npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-20B74F85 - run: name: Install Root Dependencies command: npm install --ignore-scripts @@ -93,10 +95,10 @@ browsers_unit_tests: &browsers_unit_tests echo "CIRCLE_NODE_VERSION=${CIRCLE_NODE_VERSION}" - restore_cache: keys: - - npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-F267A71D + - npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-20B74F85 - restore_cache: keys: - - npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-F267A71D + - npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-20B74F85 - run: name: Install Root Dependencies command: npm install --ignore-scripts diff --git a/packages/opentelemetry-resource-detector-gcp/README.md b/packages/opentelemetry-resource-detector-gcp/README.md index ccb2af7b09..8f493387b0 100644 --- a/packages/opentelemetry-resource-detector-gcp/README.md +++ b/packages/opentelemetry-resource-detector-gcp/README.md @@ -12,6 +12,8 @@ The OpenTelemetry Resource is an immutable representation of the entity producin ## Installation +The GCP resource detector requires Node.JS 10+ due to a dependency on [`gcp-metadata`](https://www.npmjs.com/package/gcp-metadata) which uses features only available in Node.JS 10+. + ```bash npm install --save @opentelemetry/resource-detector-gcp ``` diff --git a/packages/opentelemetry-resource-detector-gcp/package.json b/packages/opentelemetry-resource-detector-gcp/package.json index c059e00f93..a6ee3702ac 100644 --- a/packages/opentelemetry-resource-detector-gcp/package.json +++ b/packages/opentelemetry-resource-detector-gcp/package.json @@ -27,7 +27,7 @@ "author": "OpenTelemetry Authors", "license": "Apache-2.0", "engines": { - "node": ">=8.0.0" + "node": ">=10.0.0" }, "files": [ "build/src/**/*.js", @@ -41,24 +41,23 @@ "access": "public" }, "devDependencies": { + "@opentelemetry/core": "^0.10.2", "@types/mocha": "8.0.1", "@types/node": "14.0.27", - "@types/sinon": "9.0.4", + "@types/semver": "7.3.3", "codecov": "3.7.2", "gts": "2.0.2", "mocha": "7.2.0", "nock": "12.0.3", "nyc": "15.1.0", "rimraf": "3.0.2", - "sinon": "9.0.2", + "semver": "7.3.2", "ts-mocha": "7.0.0", "ts-node": "8.10.2", "typescript": "3.9.7" }, "dependencies": { - "@opentelemetry/api": "^0.10.2", - "@opentelemetry/core": "^0.10.2", "@opentelemetry/resources": "^0.10.2", - "gcp-metadata": "^3.5.0" + "gcp-metadata": "^4.1.4" } } diff --git a/packages/opentelemetry-resource-detector-gcp/test/detectors/GcpDetector.test.ts b/packages/opentelemetry-resource-detector-gcp/test/detectors/GcpDetector.test.ts index f2ae581553..ce1292bf53 100644 --- a/packages/opentelemetry-resource-detector-gcp/test/detectors/GcpDetector.test.ts +++ b/packages/opentelemetry-resource-detector-gcp/test/detectors/GcpDetector.test.ts @@ -23,6 +23,7 @@ import { resetIsAvailableCache, } from 'gcp-metadata'; import * as nock from 'nock'; +import * as semver from 'semver'; import { gcpDetector } from '../../src'; import { assertCloudResource, @@ -43,8 +44,8 @@ const PROJECT_ID_PATH = BASE_PATH + '/project/project-id'; const ZONE_PATH = BASE_PATH + '/instance/zone'; const CLUSTER_NAME_PATH = BASE_PATH + '/instance/attributes/cluster-name'; -describe('gcpDetector', () => { - describe('.detect', () => { +(semver.satisfies(process.version, ">=10") ? describe : describe.skip)('gcpDetector', () => { + describe('.detect', function() { before(() => { nock.disableNetConnect(); }); diff --git a/packages/opentelemetry-sdk-node/package.json b/packages/opentelemetry-sdk-node/package.json index e87a38d71a..5ba7da799b 100644 --- a/packages/opentelemetry-sdk-node/package.json +++ b/packages/opentelemetry-sdk-node/package.json @@ -59,7 +59,7 @@ "@types/node": "14.0.27", "@types/sinon": "9.0.4", "codecov": "3.7.2", - "gcp-metadata": "^3.5.0", + "gcp-metadata": "^4.1.4", "gts": "2.0.2", "istanbul-instrumenter-loader": "3.0.1", "mocha": "7.2.0",