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
4
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 3.1.1 to 3.2.0

build/src/logger.d.ts

2

build/src/cls.d.ts

@@ -17,6 +17,6 @@ /**

/// <reference types="node" />
import { Logger } from '@google-cloud/common';
import { EventEmitter } from 'events';
import { CLS, Func } from './cls/base';
import { SpanType } from './constants';
import { Logger } from './logger';
import { RootSpan } from './plugin-types';

@@ -23,0 +23,0 @@ import { Trace, TraceSpan } from './trace';

@@ -20,2 +20,24 @@ /**

/**
* Log levels: 0=disabled, 1=error, 2=warn, 3=info, 4=debug
* The value of GCLOUD_TRACE_LOGLEVEL takes precedence over this value.
*/
logLevel?: number;
/**
* Whether to enable to Trace Agent or not.
* Once enabled, the Trace Agent may not be disabled.
*/
enabled?: boolean;
/**
* If true, additional information about query parameters and results will be
* attached (as labels) to spans representing database operations.
*/
enhancedDatabaseReporting?: boolean;
/**
* A value that can be used to override names of root spans. If specified as
* a string, the string will be used to replace all such span names; if
* specified as a function, the function will be invoked with the request path
* as an argument, and its return value will be used as the span name.
*/
rootSpanNameOverride?: string | ((name: string) => string);
/**
* The trace context propagation mechanism to use. The following options are

@@ -40,24 +62,17 @@ * available:

/**
* Log levels: 0=disabled, 1=error, 2=warn, 3=info, 4=debug
* The value of GCLOUD_TRACE_LOGLEVEL takes precedence over this value.
* The number of local spans per trace to allow before emitting an error log.
* An unexpectedly large number of spans per trace may suggest a memory leak.
* This value should be 1-2x the estimated maximum number of RPCs made on
* behalf of a single incoming request.
*/
logLevel?: number;
spansPerTraceSoftLimit?: number;
/**
* Whether to enable to Trace Agent or not.
* Once enabled, the Trace Agent may not be disabled.
* The maximum number of local spans per trace to allow in total. Creating
* more spans in a single trace will cause the agent to log an error, and such
* spans will be dropped. (This limit does not apply when using a RootSpan
* instance to create child spans.)
* This value should be greater than spansPerTraceSoftLimit.
*/
enabled?: boolean;
spansPerTraceHardLimit?: number;
/**
* If true, additional information about query parameters and results will be
* attached (as labels) to spans representing database operations.
*/
enhancedDatabaseReporting?: boolean;
/**
* A value that can be used to override names of root spans. If specified as
* a string, the string will be used to replace all such span names; if
* specified as a function, the function will be invoked with the request path
* as an argument, and its return value will be used as the span name.
*/
rootSpanNameOverride?: string | ((name: string) => string);
/**
* The maximum number of characters reported on a label value. This value

@@ -185,3 +200,2 @@ * cannot exceed 16383, the maximum value accepted by the service.

export declare const defaultConfig: {
clsMechanism: CLSMechanism;
logLevel: number;

@@ -191,2 +205,5 @@ enabled: boolean;

rootSpanNameOverride: (name: string) => string;
clsMechanism: CLSMechanism;
spansPerTraceSoftLimit: number;
spansPerTraceHardLimit: number;
maximumLabelValueSize: number;

@@ -193,0 +210,0 @@ plugins: {

@@ -27,3 +27,2 @@ "use strict";

exports.defaultConfig = {
clsMechanism: 'auto',
logLevel: 1,

@@ -33,2 +32,5 @@ enabled: true,

rootSpanNameOverride: (name) => name,
clsMechanism: 'auto',
spansPerTraceSoftLimit: 200,
spansPerTraceHardLimit: 1000,
maximumLabelValueSize: 512,

@@ -35,0 +37,0 @@ plugins: {

@@ -17,2 +17,3 @@ /**

/// <reference types="node" />
import { EventEmitter } from 'events';
import { Constants, SpanType } from './constants';

@@ -194,3 +195,3 @@ import { StackdriverTracerConfig } from './trace-api';

*/
wrapEmitter(emitter: NodeJS.EventEmitter): void;
wrapEmitter(emitter: EventEmitter): void;
/** Well-known constant values used by the Trace Agent. */

@@ -197,0 +198,0 @@ readonly constants: typeof Constants;

@@ -183,3 +183,10 @@ "use strict";

const Client = makeClientConstructor.apply(this, arguments);
shimmer.massWrap([Client.prototype], Object.keys(methods), makeClientMethod);
const methodsToWrap = [
...Object.keys(methods),
...Object.keys(methods)
.map(methodName => methods[methodName].originalName)
.filter(originalName => !!originalName &&
Client.prototype.hasOwnProperty(originalName))
];
shimmer.massWrap([Client.prototype], methodsToWrap, makeClientMethod);
return Client;

@@ -186,0 +193,0 @@ };

@@ -17,4 +17,5 @@ /**

/// <reference types="node" />
import { Logger } from '@google-cloud/common';
import { EventEmitter } from 'events';
import { SpanType } from './constants';
import { Logger } from './logger';
import { Func, RootSpan, RootSpanOptions, Span, SpanOptions, Tracer } from './plugin-types';

@@ -31,2 +32,4 @@ import * as TracingPolicy from './tracing-policy';

rootSpanNameOverride: (path: string) => string;
spansPerTraceSoftLimit: number;
spansPerTraceHardLimit: number;
}

@@ -114,3 +117,3 @@ /**

wrap<T>(fn: Func<T>): Func<T>;
wrapEmitter(emitter: NodeJS.EventEmitter): void;
wrapEmitter(emitter: EventEmitter): void;
}

@@ -191,5 +191,34 @@ "use strict";

// needs a custom outer span that encompasses the entirety of work.
this.logger.warn(`TraceApi#createChildSpan: [${this.pluginName}] Creating phantom child span [${options.name}] because root span [${rootSpan.span.name}] was already closed.`);
this.logger.error(`TraceApi#createChildSpan: [${this.pluginName}] Creating phantom child span [${options.name}] because root span [${rootSpan.span.name}] was already closed.`);
return span_data_1.UNCORRELATED_CHILD_SPAN;
}
if (rootSpan.trace.spans.length >= this.config.spansPerTraceHardLimit) {
// As in the previous case, a root span with a large number of child
// spans suggests a memory leak stemming from context confusion. This
// is likely due to userspace task queues or Promise implementations.
this.logger.error(`TraceApi#createChildSpan: [${this.pluginName}] Creating phantom child span [${options.name}] because the trace with root span [${rootSpan.span.name}] has reached a limit of ${this.config
.spansPerTraceHardLimit} spans. This is likely a memory leak.`);
this.logger.error([
'TraceApi#createChildSpan: Please see',
'https://github.com/googleapis/cloud-trace-nodejs/wiki',
'for details and suggested actions.'
].join(' '));
return span_data_1.UNCORRELATED_CHILD_SPAN;
}
if (rootSpan.trace.spans.length === this.config.spansPerTraceSoftLimit) {
// As in the previous case, a root span with a large number of child
// spans suggests a memory leak stemming from context confusion. This
// is likely due to userspace task queues or Promise implementations.
// Note that since child spans can be created by users directly on a
// RootSpanData instance, this block might be skipped because it only
// checks equality -- this is OK because no automatic tracing plugin
// uses the RootSpanData API directly.
this.logger.warn(`TraceApi#createChildSpan: [${this.pluginName}] Adding child span [${options.name}] will cause the trace with root span [${rootSpan.span.name}] to contain more than ${this.config
.spansPerTraceSoftLimit} spans. This is likely a memory leak.`);
this.logger.error([
'TraceApi#createChildSpan: Please see',
'https://github.com/googleapis/cloud-trace-nodejs/wiki',
'for details and suggested actions.'
].join(' '));
}
// Create a new child span and return it.

@@ -196,0 +225,0 @@ const childContext = rootSpan.createChildSpan({

@@ -16,3 +16,3 @@ /**

*/
import { Logger } from '@google-cloud/common';
import { Logger } from './logger';
import { Plugin } from './plugin-types';

@@ -19,0 +19,0 @@ import { StackdriverTracerConfig } from './trace-api';

@@ -17,2 +17,3 @@ /**

import * as common from '@google-cloud/common';
import { Logger } from './logger';
import { Trace } from './trace';

@@ -57,3 +58,3 @@ import { Singleton } from './util';

*/
constructor(config: TraceWriterConfig, logger: common.Logger);
constructor(config: TraceWriterConfig, logger: Logger);
stop(): void;

@@ -98,2 +99,2 @@ initialize(cb: (err?: Error) => void): void;

}
export declare const traceWriter: Singleton<TraceWriter, TraceWriterConfig, common.Logger>;
export declare const traceWriter: Singleton<TraceWriter, TraceWriterConfig, Logger>;

@@ -21,2 +21,3 @@ "use strict";

const os = require("os");
const teeny_request_1 = require("teeny-request");
const constants_1 = require("./constants");

@@ -47,2 +48,3 @@ const trace_1 = require("./trace");

super({
requestModule: teeny_request_1.teenyRequest,
packageJson: pjson,

@@ -49,0 +51,0 @@ projectIdRequired: false,

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

Object.defineProperty(exports, "__esModule", { value: true });
const common_1 = require("@google-cloud/common");
const path = require("path");
const cls_1 = require("./cls");
const logger_1 = require("./logger");
const trace_plugin_loader_1 = require("./trace-plugin-loader");

@@ -39,5 +39,3 @@ const trace_writer_1 = require("./trace-writer");

// Clamp the logger level.
// TODO(kjin): When @google-cloud/common@0.19.2 is released, use
// Logger.LEVELS instead.
const defaultLevels = common_1.logger.LEVELS;
const defaultLevels = logger_1.LEVELS;
if (logLevel < 0) {

@@ -49,3 +47,3 @@ logLevel = 0;

}
this.logger = new common_1.Logger({ level: defaultLevels[logLevel], tag: '@google-cloud/trace-agent' });
this.logger = new logger_1.Logger({ level: defaultLevels[logLevel], tag: '@google-cloud/trace-agent' });
}

@@ -52,0 +50,0 @@ /**

@@ -1,1 +0,1 @@

Please consult the [GitHub Releases section of this repository](https://github.com/GoogleCloudPlatform/cloud-trace-nodejs/releases) for a history of changes to the Trace Agent.
Please consult the [GitHub Releases section of this repository](https://github.com/googleapis/cloud-trace-nodejs/releases) for a history of changes to the Trace Agent.

@@ -55,2 +55,2 @@ # Plugin Developer Guide

[shimmer]: https://github.com/othiym23/shimmer
[builtin-plugins]: https://github.com/GoogleCloudPlatform/cloud-trace-nodejs/tree/master/src/plugins
[builtin-plugins]: https://github.com/googleapis/cloud-trace-nodejs/tree/master/src/plugins

@@ -114,5 +114,5 @@ # The `Tracer` Object

[config-js]: https://github.com/GoogleCloudPlatform/cloud-trace-nodejs/blob/master/config.js
[config-js]: https://github.com/googleapis/cloud-trace-nodejs/blob/master/config.js
[stackdriver-trace-faq]: https://cloud.google.com/trace/docs/faq
[stackdriver-trace-span]: https://cloud.google.com/trace/api/reference/rest/v1/projects.traces#TraceSpan
[dapper-paper]: https://research.google.com/pubs/pub36356.html
{
"name": "@google-cloud/trace-agent",
"version": "3.1.1",
"version": "3.2.0",
"description": "Node.js Support for StackDriver Trace",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "GoogleCloudPlatform/cloud-trace-nodejs",
"repository": "googleapis/cloud-trace-nodejs",
"scripts": {

@@ -52,2 +52,3 @@ "init-test-fixtures": "npm run script init-test-fixtures",

"@types/builtin-modules": "^2.0.0",
"@types/console-log-level": "^1.4.0",
"@types/continuation-local-storage": "^3.2.1",

@@ -58,6 +59,6 @@ "@types/extend": "^3.0.0",

"@types/methods": "^1.1.0",
"@types/mocha": "5.2.1",
"@types/mocha": "^5.2.5",
"@types/ncp": "^2.0.1",
"@types/nock": "^9.1.2",
"@types/node": "^10.5.2",
"@types/node": "~10.7.2",
"@types/once": "^1.4.0",

@@ -67,3 +68,3 @@ "@types/pify": "^3.0.0",

"@types/proxyquire": "^1.3.28",
"@types/request": "^2.0.8",
"@types/request": "^2.47.1",
"@types/semver": "^5.4.0",

@@ -78,3 +79,3 @@ "@types/shimmer": "^1.0.1",

"glob": "^7.0.3",
"grpc": "1.13.1",
"grpc": "1.14.2",
"gts": "^0.8.0",

@@ -87,6 +88,5 @@ "intelli-espower-loader": "^1.0.1",

"nock": "^9.1.3",
"nyc": "^12.0.2",
"nyc": "^13.0.0",
"once": "^1.4.0",
"pify": "^4.0.0",
"request": "^2.83.0",
"retry-axios": "^0.3.2",

@@ -102,4 +102,5 @@ "rimraf": "^2.6.2",

"dependencies": {
"@google-cloud/common": "^0.20.3",
"@google-cloud/common": "^0.25.3",
"builtin-modules": "^3.0.0",
"console-log-level": "^1.4.0",
"continuation-local-storage": "^3.2.1",

@@ -114,4 +115,5 @@ "extend": "^3.0.0",

"shimmer": "^1.2.0",
"teeny-request": "^3.9.0",
"uuid": "^3.0.1"
}
}

@@ -14,3 +14,3 @@ # Stackdriver Trace Agent for Node.js

<img src="https://raw.githubusercontent.com/GoogleCloudPlatform/cloud-trace-nodejs/master/doc/images/cloud-trace-overview-page.png" alt="Stackdriver Trace Overview" />
<img src="https://raw.githubusercontent.com/googleapis/cloud-trace-nodejs/master/doc/images/cloud-trace-overview-page.png" alt="Stackdriver Trace Overview" />

@@ -23,3 +23,3 @@ ## Usage

> **Note**: The Trace Agent does not currently work out-of-the-box with Google Cloud Functions (or Firebase Cloud Functions). See [#725](https://github.com/GoogleCloudPlatform/cloud-trace-nodejs/issues/725) for a tracking issue and details on how to work around this.
> **Note**: The Trace Agent does not currently work out-of-the-box with Google Cloud Functions (or Firebase Cloud Functions). See [#725](https://github.com/googleapis/cloud-trace-nodejs/issues/725) for a tracking issue and details on how to work around this.

@@ -78,3 +78,3 @@ Simply require and start the Trace Agent as the first module in your application:

To request automatic tracing support for a module not on this list, please [file an issue](https://github.com/GoogleCloudPlatform/cloud-trace-nodejs/issues). Alternatively, you can [write a plugin yourself](doc/plugin-guide.md).
To request automatic tracing support for a module not on this list, please [file an issue](https://github.com/googleapis/cloud-trace-nodejs/issues). Alternatively, you can [write a plugin yourself](doc/plugin-guide.md).

@@ -146,8 +146,8 @@ ### Tracing Additional Modules

[continuation-local-storage]: https://www.npmjs.com/package/continuation-local-storage
[codecov-image]: https://codecov.io/gh/GoogleCloudPlatform/cloud-trace-nodejs/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/GoogleCloudPlatform/cloud-trace-nodejs
[david-dev-image]: https://david-dm.org/GoogleCloudPlatform/cloud-trace-nodejs/dev-status.svg
[david-dev-url]: https://david-dm.org/GoogleCloudPlatform/cloud-trace-nodejs?type=dev
[david-image]: https://david-dm.org/GoogleCloudPlatform/cloud-trace-nodejs.svg
[david-url]: https://david-dm.org/GoogleCloudPlatform/cloud-trace-nodejs
[codecov-image]: https://codecov.io/gh/googleapis/cloud-trace-nodejs/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/googleapis/cloud-trace-nodejs
[david-dev-image]: https://david-dm.org/googleapis/cloud-trace-nodejs/dev-status.svg
[david-dev-url]: https://david-dm.org/googleapis/cloud-trace-nodejs?type=dev
[david-image]: https://david-dm.org/googleapis/cloud-trace-nodejs.svg
[david-url]: https://david-dm.org/googleapis/cloud-trace-nodejs
[npm-image]: https://badge.fury.io/js/%40google-cloud%2Ftrace-agent.svg

@@ -157,5 +157,5 @@ [npm-url]: https://npmjs.org/package/@google-cloud/trace-agent

[setting-up-stackdriver-trace]: https://cloud.google.com/trace/docs/setup/nodejs
[snyk-image]: https://snyk.io/test/github/GoogleCloudPlatform/cloud-trace-nodejs/badge.svg
[snyk-url]: https://snyk.io/test/github/GoogleCloudPlatform/cloud-trace-nodejs
[circle-image]: https://circleci.com/gh/GoogleCloudPlatform/cloud-trace-nodejs.svg?style=svg
[circle-url]: https://circleci.com/gh/GoogleCloudPlatform/cloud-trace-nodejs
[snyk-image]: https://snyk.io/test/github/googleapis/cloud-trace-nodejs/badge.svg
[snyk-url]: https://snyk.io/test/github/googleapis/cloud-trace-nodejs
[circle-image]: https://circleci.com/gh/googleapis/cloud-trace-nodejs.svg?style=svg
[circle-url]: https://circleci.com/gh/googleapis/cloud-trace-nodejs
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