Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@google-cloud/trace-agent

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/trace-agent - npm Package Compare versions

Comparing version 4.2.0 to 4.2.1

2

build/src/cls.js

@@ -124,6 +124,6 @@ "use strict";

}
exports.TraceCLS = TraceCLS;
TraceCLS.UNCORRELATED = span_data_1.UNCORRELATED_ROOT_SPAN;
TraceCLS.DISABLED = span_data_1.DISABLED_ROOT_SPAN;
exports.TraceCLS = TraceCLS;
exports.cls = new util_1.Singleton(TraceCLS);
//# sourceMappingURL=cls.js.map

@@ -63,5 +63,5 @@ "use strict";

}
exports.AsyncListenerCLS = AsyncListenerCLS;
AsyncListenerCLS.TRACE_NAMESPACE = 'com.google.cloud.trace';
AsyncListenerCLS.ROOT_CONTEXT_KEY = 'root';
exports.AsyncListenerCLS = AsyncListenerCLS;
//# sourceMappingURL=async-listener.js.map

@@ -17,14 +17,12 @@ "use strict";

*/
const is = require("is");
const semver = require("semver");
const shimmer = require("shimmer");
const url = require("url");
const url_1 = require("url");
const ERR_HTTP_HEADERS_SENT = 'ERR_HTTP_HEADERS_SENT';
const ERR_HTTP_HEADERS_SENT_MSG = "Can't set headers after they are sent.";
// URL is used for type checking, but doesn't exist in Node <7.
// This function works around that.
// tslint:disable:no-any
const isString = is.string;
// url.URL is used for type checking, but doesn't exist in Node <7.
// This function works around that.
const isURL = semver.satisfies(process.version, '>=7')
? (value) => value instanceof url.URL
? (value) => value instanceof url_1.URL
: (value) => false;

@@ -80,6 +78,20 @@ // tslint:enable:no-any

// Here `request` may also happen to be `get`.
return function requestTrace(options, callback) {
if (!options) {
return request(options, callback);
return function requestTrace(url, options, callback) {
// These are error conditions; defer to http.request and don't trace.
if (!url || (typeof url === 'object' && typeof options === 'object')) {
return request.apply(this, arguments);
}
let urlString;
if (typeof url === 'string') {
// save the value of uri so we don't have to reconstruct it later
urlString = url;
url = url_1.parse(url);
}
if (typeof options === 'function') {
callback = options;
options = url;
}
else {
options = Object.assign({}, url, options);
}
// Don't trace ourselves lest we get into infinite loops

@@ -90,20 +102,14 @@ // Note: this would not be a problem if we guarantee buffering

if (isTraceAgentRequest(options, api)) {
return request(options, callback);
return request.apply(this, arguments);
}
let uri;
if (isString(options)) {
// save the value of uri so we don't have to reconstruct it later
uri = options;
options = url.parse(options);
}
const span = api.createChildSpan({ name: getSpanName(options) });
if (!api.isRealSpan(span)) {
return request(options, callback);
return request.apply(this, arguments);
}
if (!uri) {
uri = extractUrl(options, protocol);
if (!urlString) {
urlString = extractUrl(options, protocol);
}
const method = options.method || 'GET';
span.addLabel(api.labels.HTTP_METHOD_LABEL_KEY, method);
span.addLabel(api.labels.HTTP_URL_LABEL_KEY, uri);
span.addLabel(api.labels.HTTP_URL_LABEL_KEY, urlString);
// If outgoing request headers contain the "Expect" header, the returned

@@ -209,4 +215,4 @@ // ClientRequest will throw an error if any new headers are added. For this

// https://nodejs.org/dist/latest/docs/api/http.html#http_http_get_options_callback
return function getTrace(options, callback) {
const req = http.request(options, callback);
return function getTrace() {
const req = http.request.apply(this, arguments);
req.end();

@@ -225,4 +231,4 @@ return req;

shimmer.wrap(https, 'get', function getWrap() {
return function getTrace(options, callback) {
const req = https.request(options, callback);
return function getTrace() {
const req = https.request.apply(this, arguments);
req.end();

@@ -229,0 +235,0 @@ return req;

@@ -73,2 +73,5 @@ "use strict";

if (propagateContext) {
// TS Iterator definition clashes with @types/node.
// For some reason, this causes the next line to not pass type check.
// tslint:disable-next-line:no-any
next.next = api.wrap(next.next);

@@ -75,0 +78,0 @@ }

@@ -128,6 +128,6 @@ "use strict";

}
exports.ModulePluginWrapper = ModulePluginWrapper;
// Sentinel value to indicate that a plugin has not been loaded into memory
// yet.
ModulePluginWrapper.NOT_LOADED = [];
exports.ModulePluginWrapper = ModulePluginWrapper;
/**

@@ -383,6 +383,6 @@ * A class that represents wrapper logic on top of plugins that patch core

}
exports.PluginLoader = PluginLoader;
// Key on which core modules are stored.
PluginLoader.CORE_MODULE = '[core]';
exports.PluginLoader = PluginLoader;
exports.pluginLoader = new util_1.Singleton(PluginLoader);
//# sourceMappingURL=trace-plugin-loader.js.map

@@ -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());

@@ -24,0 +25,0 @@ });

"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
"use strict";
/**

@@ -64,4 +63,4 @@ * Copyright 2015 Google Inc. All Rights Reserved.

}
exports.Singleton = Singleton;
_a = exports.kSingleton;
exports.Singleton = Singleton;
/**

@@ -68,0 +67,0 @@ * Returns the last parameter that is not null, undefined, or NaN.

# Changelog
### [4.2.1](https://www.github.com/googleapis/cloud-trace-nodejs/compare/v4.2.0...v4.2.1) (2019-10-02)
### Bug Fixes
* **deps:** update dependency gcp-metadata to v3 ([#1115](https://www.github.com/googleapis/cloud-trace-nodejs/issues/1115)) ([94c6dae](https://www.github.com/googleapis/cloud-trace-nodejs/commit/94c6dae))
* unpin @types/node and account for new http.request signatures ([#1120](https://www.github.com/googleapis/cloud-trace-nodejs/issues/1120)) ([bd9863b](https://www.github.com/googleapis/cloud-trace-nodejs/commit/bd9863b))
## [4.2.0](https://www.github.com/googleapis/cloud-trace-nodejs/compare/v4.1.1...v4.2.0) (2019-09-09)

@@ -4,0 +12,0 @@

{
"name": "@google-cloud/trace-agent",
"version": "4.2.0",
"version": "4.2.1",
"description": "Node.js Support for StackDriver Trace",

@@ -68,3 +68,3 @@ "main": "build/src/index.js",

"@types/nock": "^10.0.0",
"@types/node": "~10.7.2",
"@types/node": "^12.7.2",
"@types/node-fetch": "^2.5.0",

@@ -83,3 +83,3 @@ "@types/once": "^1.4.0",

"glob": "^7.0.3",
"grpc": "1.23.3",
"grpc": "1.24.0",
"gts": "^1.0.0",

@@ -100,3 +100,3 @@ "intelli-espower-loader": "^1.0.1",

"ts-node": "^8.0.0",
"typescript": "~3.5.1"
"typescript": "~3.6.0"
},

@@ -110,3 +110,3 @@ "dependencies": {

"extend": "^3.0.2",
"gcp-metadata": "^2.0.0",
"gcp-metadata": "^3.0.0",
"hex2dec": "^1.0.1",

@@ -113,0 +113,0 @@ "is": "^3.2.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc