@google-cloud/profiler
Advanced tools
Comparing version 2.0.2 to 3.0.0
@@ -7,2 +7,34 @@ # Changelog | ||
## v3.0.0 | ||
09-17-2019 10:42 PDT | ||
### New Features | ||
- feat(breaking!): support API endpoint override ([#509](https://github.com/googleapis/cloud-profiler-nodejs/pull/509)) | ||
- chore: message to log agent version should be consistent with other agents ([#531](https://github.com/googleapis/cloud-profiler-nodejs/pull/531)) | ||
- chore: log the agent's version on start-up ([#530](https://github.com/googleapis/cloud-profiler-nodejs/pull/530)) | ||
- chore: log the agent's version on start-up ([#530](https://github.com/googleapis/cloud-profiler-nodejs/pull/530)) | ||
### Dependencies | ||
- fix(deps): update dependency gcp-metadata to v3 ([#541](https://github.com/googleapis/cloud-profiler-nodejs/pull/541)) | ||
- chore(deps): pin pprof module ([#539](https://github.com/googleapis/cloud-profiler-nodejs/pull/539)) | ||
- chore(deps): update dependency nock to v11 ([#538](https://github.com/googleapis/cloud-profiler-nodejs/pull/538)) | ||
- chore(deps): update dependency source-map to ^0.7.0 ([#537](https://github.com/googleapis/cloud-profiler-nodejs/pull/537)) | ||
- Revert "chore(deps): update dependency nock to v11 ([#534](https://github.com/googleapis/cloud-profiler-nodejs/pull/534))" ([#535](https://github.com/googleapis/cloud-profiler-nodejs/pull/535)) | ||
- chore(deps): update dependency nock to v11 ([#534](https://github.com/googleapis/cloud-profiler-nodejs/pull/534)) | ||
- chore(deps): update dependency typescript to ~3.6.0 ([#532](https://github.com/googleapis/cloud-profiler-nodejs/pull/532)) | ||
- fix(dep): update to be compatible with @google-cloud/common 2.1.X ([#529](https://github.com/googleapis/cloud-profiler-nodejs/pull/529)) | ||
- fix(deps): use the latest extend ([#523](https://github.com/googleapis/cloud-profiler-nodejs/pull/523)) | ||
### Documentation | ||
- docs: use the jsdoc-fresh theme ([#519](https://github.com/googleapis/cloud-profiler-nodejs/pull/519)) | ||
- docs: note support for Node 12 in documentation ([#540](https://github.com/googleapis/cloud-profiler-nodejs/pull/540)) | ||
### Internal / Testing Changes | ||
- build: add Node 12 remove Node 11 ([#520](https://github.com/googleapis/cloud-profiler-nodejs/pull/520)) | ||
- update .nycrc ignore rules ([#536](https://github.com/googleapis/cloud-profiler-nodejs/pull/536)) | ||
- chore: confirm zone is set in e2e test ([#518](https://github.com/googleapis/cloud-profiler-nodejs/pull/518)) | ||
- build: use config file for linkinator ([#517](https://github.com/googleapis/cloud-profiler-nodejs/pull/517)) | ||
## v2.0.2 | ||
@@ -9,0 +41,0 @@ |
@@ -18,2 +18,7 @@ /** | ||
export interface Config extends GoogleAuthOptions { | ||
/** | ||
* The API endpoint of the service used to make requests. | ||
* Defaults to `cloudprofiler.googleapis.com`. | ||
*/ | ||
apiEndpoint?: string; | ||
projectId?: string; | ||
@@ -37,3 +42,2 @@ logLevel?: number; | ||
serverBackoffCapMillis?: number; | ||
baseApiUrl?: string; | ||
localProfilingPeriodMillis?: number; | ||
@@ -46,2 +50,3 @@ localLogPeriodMillis?: number; | ||
export interface ProfilerConfig extends GoogleAuthOptions { | ||
apiEndpoint: string; | ||
projectId?: string; | ||
@@ -65,3 +70,2 @@ logLevel: number; | ||
serverBackoffCapMillis: number; | ||
baseApiUrl: string; | ||
localProfilingPeriodMillis: number; | ||
@@ -85,3 +89,3 @@ localLogPeriodMillis: number; | ||
backoffMultiplier: number; | ||
baseApiUrl: string; | ||
apiEndpoint: string; | ||
serverBackoffCapMillis: number; | ||
@@ -88,0 +92,0 @@ localProfilingPeriodMillis: number; |
@@ -32,3 +32,3 @@ "use strict"; | ||
backoffMultiplier: 1.3, | ||
baseApiUrl: 'https://cloudprofiler.googleapis.com/v2', | ||
apiEndpoint: 'cloudprofiler.googleapis.com', | ||
// This is the largest duration for setTimeout which does not cause it to | ||
@@ -35,0 +35,0 @@ // run immediately. |
@@ -31,3 +31,3 @@ /** | ||
*/ | ||
export declare function createProfiler(config: Config): Promise<Profiler>; | ||
export declare function createProfiler(config?: Config): Promise<Profiler>; | ||
/** | ||
@@ -34,0 +34,0 @@ * Starts the profiling agent and returns a promise. |
@@ -18,6 +18,7 @@ "use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -144,3 +145,3 @@ }); | ||
*/ | ||
function createProfiler(config) { | ||
function createProfiler(config = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -150,3 +151,3 @@ if (!nodeVersionOkay(process.version)) { | ||
` does not satisfies "${pjson.engines.node}"` + | ||
'\nSee https://github.com/GoogleCloudPlatform/cloud-profiler-nodejs#prerequisites' + | ||
'\nSee https://github.com/googleapis/cloud-profiler-nodejs#prerequisites' + | ||
' for details.'); | ||
@@ -153,0 +154,0 @@ } |
@@ -86,2 +86,3 @@ /** | ||
private sourceMapper; | ||
private baseApiUrl; | ||
config: ProfilerConfig; | ||
@@ -88,0 +89,0 @@ constructor(config: ProfilerConfig); |
@@ -18,6 +18,7 @@ "use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -54,3 +55,5 @@ }); | ||
*/ | ||
function getResponseErrorMessage(response, err) { | ||
function getResponseErrorMessage( | ||
// tslint:disable-next-line: no-any | ||
response, err) { | ||
if (err && err.message) { | ||
@@ -194,3 +197,5 @@ return err.message; | ||
*/ | ||
function responseToProfileOrError(err, body, response) { | ||
function responseToProfileOrError(err, body, | ||
// tslint:disable-next-line: no-any | ||
response) { | ||
// response.statusCode is guaranteed to exist on client requests. | ||
@@ -225,4 +230,6 @@ if (response && isErrorResponseStatusCode(response.statusCode)) { | ||
config = config || {}; | ||
const baseApiUrl = `https://${config.apiEndpoint}/v2`; | ||
const serviceConfig = { | ||
baseUrl: config.baseApiUrl, | ||
apiEndpoint: config.apiEndpoint, | ||
baseUrl: baseApiUrl, | ||
scopes: [SCOPE], | ||
@@ -236,2 +243,3 @@ packageJson: pjson, | ||
this.config = config; | ||
this.baseApiUrl = baseApiUrl; | ||
this.logger = logger_1.createLogger(this.config.logLevel); | ||
@@ -286,2 +294,3 @@ const labels = { | ||
} | ||
this.logger.debug(`Stackdriver Profiler Node.js agent version: ${pjson.version}`); | ||
this.runLoop(); | ||
@@ -363,3 +372,5 @@ }); | ||
return new Promise((resolve, reject) => { | ||
this.request(options, (err, body, response) => { | ||
this.request(options, (err, body, | ||
// tslint:disable-next-line: no-any | ||
response) => { | ||
try { | ||
@@ -397,3 +408,3 @@ const prof = responseToProfileOrError(err, body, response); | ||
method: 'PATCH', | ||
uri: this.config.baseApiUrl + '/' + prof.name, | ||
uri: this.baseApiUrl + '/' + prof.name, | ||
body: prof, | ||
@@ -400,0 +411,0 @@ json: true, |
{ | ||
"name": "@google-cloud/profiler", | ||
"version": "2.0.2", | ||
"version": "3.0.0", | ||
"description": "Adds support for Stackdriver Profiler to Node.js applications", | ||
@@ -25,3 +25,3 @@ "repository": "googleapis/cloud-profiler-nodejs", | ||
"license-check": "jsgl --local .", | ||
"docs-test": "linkinator docs -r --skip 'circleci.com/gh/googleapis/cloud-profiler-nodejs'", | ||
"docs-test": "linkinator docs", | ||
"predocs-test": "npm run docs" | ||
@@ -34,3 +34,3 @@ }, | ||
"dependencies": { | ||
"@google-cloud/common": "^1.0.0", | ||
"@google-cloud/common": "^2.1.2", | ||
"@types/console-log-level": "^1.4.0", | ||
@@ -40,10 +40,10 @@ "@types/semver": "^6.0.0", | ||
"delay": "^4.0.1", | ||
"extend": "^3.0.1", | ||
"gcp-metadata": "^2.0.0", | ||
"extend": "^3.0.2", | ||
"gcp-metadata": "^3.0.0", | ||
"parse-duration": "^0.1.1", | ||
"pprof": "^1.0.0", | ||
"pprof": "1.1.0", | ||
"pretty-ms": "^5.0.0", | ||
"protobufjs": "~6.8.6", | ||
"semver": "^6.0.0", | ||
"source-map": "^0.6.1" | ||
"source-map": "^0.7.0" | ||
}, | ||
@@ -64,11 +64,12 @@ "devDependencies": { | ||
"jsdoc": "^3.6.2", | ||
"jsdoc-baseline": "^0.1.1", | ||
"linkinator": "^1.1.2", | ||
"jsdoc-fresh": "^1.0.1", | ||
"linkinator": "^1.5.0", | ||
"mocha": "^6.1.4", | ||
"nock": "^10.0.0", | ||
"nock": "^11.0.0", | ||
"nyc": "^14.1.0", | ||
"sinon": "^7.3.2", | ||
"source-map-support": "^0.5.6", | ||
"teeny-request": "^5.2.0", | ||
"tmp": "0.1.0", | ||
"typescript": "~3.5.0" | ||
"typescript": "~3.6.0" | ||
}, | ||
@@ -75,0 +76,0 @@ "files": [ |
@@ -27,2 +27,3 @@ # Google Cloud Profiler | ||
profiling is enabled. | ||
* Node.js 12. | ||
@@ -29,0 +30,0 @@ 1. `@google-cloud/profiler` depends on the |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
280
1198760
23
22998
+ Added@google-cloud/common@2.4.0(transitive)
+ Added@tootallnate/once@1.1.2(transitive)
+ Addedgcp-metadata@3.5.0(transitive)
+ Addedgoogle-auth-library@5.10.1(transitive)
+ Addedgtoken@4.1.4(transitive)
+ Addedhttp-proxy-agent@4.0.1(transitive)
+ Addedjwa@2.0.0(transitive)
+ Addedjws@4.0.0(transitive)
+ Addednode-pre-gyp@0.13.0(transitive)
+ Addedpprof@1.1.0(transitive)
+ Addedstream-events@1.0.5(transitive)
+ Addedstubs@3.0.0(transitive)
+ Addedteeny-request@6.0.3(transitive)
+ Addeduuid@7.0.3(transitive)
- Removed@google-cloud/common@1.0.0(transitive)
- Removed@types/caseless@0.12.5(transitive)
- Removed@types/node@22.5.5(transitive)
- Removed@types/request@2.48.12(transitive)
- Removed@types/tough-cookie@4.0.5(transitive)
- Removedagent-base@4.3.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedes6-promise@4.2.8(transitive)
- Removedes6-promisify@5.0.0(transitive)
- Removedform-data@2.5.1(transitive)
- Removedgcp-metadata@2.0.4(transitive)
- Removedgoogle-auth-library@4.2.6(transitive)
- Removedgtoken@3.0.2(transitive)
- Removedhttps-proxy-agent@2.2.4(transitive)
- Removedjwa@1.4.1(transitive)
- Removedjws@3.2.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removednode-pre-gyp@0.14.0(transitive)
- Removedpprof@1.3.0(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedteeny-request@3.11.3(transitive)
- Removedundici-types@6.19.8(transitive)
- Removeduuid@3.4.0(transitive)
Updated@google-cloud/common@^2.1.2
Updatedextend@^3.0.2
Updatedgcp-metadata@^3.0.0
Updatedpprof@1.1.0
Updatedsource-map@^0.7.0