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

@opentelemetry/instrumentation

Package Overview
Dependencies
Maintainers
2
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/instrumentation - npm Package Compare versions

Comparing version 0.34.0 to 0.35.0

4

build/esm/instrumentation.d.ts

@@ -25,2 +25,6 @@ import { DiagLogger, Meter, MeterProvider, Tracer, TracerProvider } from '@opentelemetry/api';

setMeterProvider(meterProvider: MeterProvider): void;
/**
* Sets the new metric instruments with the current Meter.
*/
protected _updateMetricInstruments(): void;
getConfig(): types.InstrumentationConfig;

@@ -27,0 +31,0 @@ /**

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

this._meter = metrics.getMeter(instrumentationName, instrumentationVersion);
this._updateMetricInstruments();
}

@@ -67,3 +68,10 @@ Object.defineProperty(InstrumentationAbstract.prototype, "meter", {

this._meter = meterProvider.getMeter(this.instrumentationName, this.instrumentationVersion);
this._updateMetricInstruments();
};
/**
* Sets the new metric instruments with the current Meter.
*/
InstrumentationAbstract.prototype._updateMetricInstruments = function () {
return;
};
/* Returns InstrumentationConfig */

@@ -70,0 +78,0 @@ InstrumentationAbstract.prototype.getConfig = function () {

17

build/esm/platform/node/instrumentation.js

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

import { InstrumentationAbstract } from '../../instrumentation';
import { RequireInTheMiddleSingleton } from './RequireInTheMiddleSingleton';
import { RequireInTheMiddleSingleton, } from './RequireInTheMiddleSingleton';
import { diag } from '@opentelemetry/api';
import * as RequireInTheMiddle from 'require-in-the-middle';
/**

@@ -131,3 +132,5 @@ * Base abstract class for instrumenting node plugins

.filter(function (f) { return f.name === name; })
.filter(function (f) { return isSupported(f.supportedVersions, version, module.includePrerelease); });
.filter(function (f) {
return isSupported(f.supportedVersions, version, module.includePrerelease);
});
return supportedFileInstrumentations.reduce(function (patchedExports, file) {

@@ -184,5 +187,11 @@ file.moduleExports = patchedExports;

var _loop_1 = function (module_2) {
this_1._hooks.push(this_1._requireInTheMiddleSingleton.register(module_2.name, function (exports, name, baseDir) {
var onRequire = function (exports, name, baseDir) {
return _this._onRequire(module_2, exports, name, baseDir);
}));
};
// `RequireInTheMiddleSingleton` does not support absolute paths.
// For an absolute paths, we must create a separate instance of `RequireInTheMiddle`.
var hook = path.isAbsolute(module_2.name)
? RequireInTheMiddle([module_2.name], { internals: true }, onRequire)
: this_1._requireInTheMiddleSingleton.register(module_2.name, onRequire);
this_1._hooks.push(hook);
};

@@ -189,0 +198,0 @@ var this_1 = this;

import type { Hooked } from './RequireInTheMiddleSingleton';
export declare const ModuleNameSeparator = "/";
declare type ModuleNameTrieSearchOptions = {
/**
* Whether to return the results in insertion order
*/
maintainInsertionOrder?: boolean;
/**
* Whether to return only full matches
*/
fullOnly?: boolean;
};
/**

@@ -20,8 +30,8 @@ * Trie containing nodes that represent a part of a module name (i.e. the parts separated by forward slash)

* @param {boolean} maintainInsertionOrder Whether to return the results in insertion order
* @param {boolean} fullOnly Whether to return only full matches
* @returns {Hooked[]} Matching hooks
*/
search(moduleName: string, { maintainInsertionOrder }?: {
maintainInsertionOrder?: boolean;
}): Hooked[];
search(moduleName: string, { maintainInsertionOrder, fullOnly }?: ModuleNameTrieSearchOptions): Hooked[];
}
export {};
//# sourceMappingURL=ModuleNameTrie.d.ts.map

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

* @param {boolean} maintainInsertionOrder Whether to return the results in insertion order
* @param {boolean} fullOnly Whether to return only full matches
* @returns {Hooked[]} Matching hooks

@@ -109,5 +110,6 @@ */

var e_2, _b;
var _c = _a === void 0 ? {} : _a, maintainInsertionOrder = _c.maintainInsertionOrder;
var _c = _a === void 0 ? {} : _a, maintainInsertionOrder = _c.maintainInsertionOrder, fullOnly = _c.fullOnly;
var trieNode = this._trie;
var results = [];
var foundFull = true;
try {

@@ -118,5 +120,8 @@ for (var _d = __values(moduleName.split(ModuleNameSeparator)), _e = _d.next(); !_e.done; _e = _d.next()) {

if (!nextNode) {
foundFull = false;
break;
}
results.push.apply(results, __spreadArray([], __read(nextNode.hooks), false));
if (!fullOnly) {
results.push.apply(results, __spreadArray([], __read(nextNode.hooks), false));
}
trieNode = nextNode;

@@ -132,2 +137,5 @@ }

}
if (fullOnly && foundFull) {
results.push.apply(results, __spreadArray([], __read(trieNode.hooks), false));
}
if (results.length === 0) {

@@ -134,0 +142,0 @@ return [];

@@ -36,3 +36,10 @@ /*

*/
var isMocha = ['afterEach', 'after', 'beforeEach', 'before', 'describe', 'it'].every(function (fn) {
var isMocha = [
'afterEach',
'after',
'beforeEach',
'before',
'describe',
'it',
].every(function (fn) {
// @ts-expect-error TS7053: Element implicitly has an 'any' type

@@ -63,3 +70,9 @@ return typeof global[fn] === 'function';

var normalizedModuleName = normalizePathSeparators(name);
var matches = _this._moduleNameTrie.search(normalizedModuleName, { maintainInsertionOrder: true });
var matches = _this._moduleNameTrie.search(normalizedModuleName, {
maintainInsertionOrder: true,
// For core modules (e.g. `fs`), do not match on sub-paths (e.g. `fs/promises').
// This matches the behavior of `require-in-the-middle`.
// `basedir` is always `undefined` for core modules.
fullOnly: basedir === undefined,
});
try {

@@ -104,3 +117,4 @@ for (var matches_1 = __values(matches), matches_1_1 = matches_1.next(); !matches_1_1.done; matches_1_1 = matches_1.next()) {

return new RequireInTheMiddleSingleton();
return this._instance = (_a = this._instance) !== null && _a !== void 0 ? _a : new RequireInTheMiddleSingleton();
return (this._instance =
(_a = this._instance) !== null && _a !== void 0 ? _a : new RequireInTheMiddleSingleton());
};

@@ -107,0 +121,0 @@ return RequireInTheMiddleSingleton;

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

export declare const VERSION = "0.34.0";
export declare const VERSION = "0.35.0";
//# sourceMappingURL=version.d.ts.map

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

// this is autogenerated file, see scripts/version-update.js
export var VERSION = '0.34.0';
export var VERSION = '0.35.0';
//# sourceMappingURL=version.js.map

@@ -25,2 +25,6 @@ import { DiagLogger, Meter, MeterProvider, Tracer, TracerProvider } from '@opentelemetry/api';

setMeterProvider(meterProvider: MeterProvider): void;
/**
* Sets the new metric instruments with the current Meter.
*/
protected _updateMetricInstruments(): void;
getConfig(): types.InstrumentationConfig;

@@ -27,0 +31,0 @@ /**

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

this._meter = metrics.getMeter(instrumentationName, instrumentationVersion);
this._updateMetricInstruments();
}

@@ -51,3 +52,10 @@ /* Returns meter */

this._meter = meterProvider.getMeter(this.instrumentationName, this.instrumentationVersion);
this._updateMetricInstruments();
}
/**
* Sets the new metric instruments with the current Meter.
*/
_updateMetricInstruments() {
return;
}
/* Returns InstrumentationConfig */

@@ -54,0 +62,0 @@ getConfig() {

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

import { InstrumentationAbstract } from '../../instrumentation';
import { RequireInTheMiddleSingleton } from './RequireInTheMiddleSingleton';
import { RequireInTheMiddleSingleton, } from './RequireInTheMiddleSingleton';
import { diag } from '@opentelemetry/api';
import * as RequireInTheMiddle from 'require-in-the-middle';
/**

@@ -130,5 +131,11 @@ * Base abstract class for instrumenting node plugins

for (const module of this._modules) {
this._hooks.push(this._requireInTheMiddleSingleton.register(module.name, (exports, name, baseDir) => {
const onRequire = (exports, name, baseDir) => {
return this._onRequire(module, exports, name, baseDir);
}));
};
// `RequireInTheMiddleSingleton` does not support absolute paths.
// For an absolute paths, we must create a separate instance of `RequireInTheMiddle`.
const hook = path.isAbsolute(module.name)
? RequireInTheMiddle([module.name], { internals: true }, onRequire)
: this._requireInTheMiddleSingleton.register(module.name, onRequire);
this._hooks.push(hook);
}

@@ -135,0 +142,0 @@ }

import type { Hooked } from './RequireInTheMiddleSingleton';
export declare const ModuleNameSeparator = "/";
declare type ModuleNameTrieSearchOptions = {
/**
* Whether to return the results in insertion order
*/
maintainInsertionOrder?: boolean;
/**
* Whether to return only full matches
*/
fullOnly?: boolean;
};
/**

@@ -20,8 +30,8 @@ * Trie containing nodes that represent a part of a module name (i.e. the parts separated by forward slash)

* @param {boolean} maintainInsertionOrder Whether to return the results in insertion order
* @param {boolean} fullOnly Whether to return only full matches
* @returns {Hooked[]} Matching hooks
*/
search(moduleName: string, { maintainInsertionOrder }?: {
maintainInsertionOrder?: boolean;
}): Hooked[];
search(moduleName: string, { maintainInsertionOrder, fullOnly }?: ModuleNameTrieSearchOptions): Hooked[];
}
export {};
//# sourceMappingURL=ModuleNameTrie.d.ts.map

@@ -56,15 +56,23 @@ /*

* @param {boolean} maintainInsertionOrder Whether to return the results in insertion order
* @param {boolean} fullOnly Whether to return only full matches
* @returns {Hooked[]} Matching hooks
*/
search(moduleName, { maintainInsertionOrder } = {}) {
search(moduleName, { maintainInsertionOrder, fullOnly } = {}) {
let trieNode = this._trie;
const results = [];
let foundFull = true;
for (const moduleNamePart of moduleName.split(ModuleNameSeparator)) {
const nextNode = trieNode.children.get(moduleNamePart);
if (!nextNode) {
foundFull = false;
break;
}
results.push(...nextNode.hooks);
if (!fullOnly) {
results.push(...nextNode.hooks);
}
trieNode = nextNode;
}
if (fullOnly && foundFull) {
results.push(...trieNode.hooks);
}
if (results.length === 0) {

@@ -71,0 +79,0 @@ return [];

@@ -25,3 +25,10 @@ /*

*/
const isMocha = ['afterEach', 'after', 'beforeEach', 'before', 'describe', 'it'].every(fn => {
const isMocha = [
'afterEach',
'after',
'beforeEach',
'before',
'describe',
'it',
].every(fn => {
// @ts-expect-error TS7053: Element implicitly has an 'any' type

@@ -50,3 +57,9 @@ return typeof global[fn] === 'function';

const normalizedModuleName = normalizePathSeparators(name);
const matches = this._moduleNameTrie.search(normalizedModuleName, { maintainInsertionOrder: true });
const matches = this._moduleNameTrie.search(normalizedModuleName, {
maintainInsertionOrder: true,
// For core modules (e.g. `fs`), do not match on sub-paths (e.g. `fs/promises').
// This matches the behavior of `require-in-the-middle`.
// `basedir` is always `undefined` for core modules.
fullOnly: basedir === undefined,
});
for (const { onRequire } of matches) {

@@ -81,3 +94,4 @@ exports = onRequire(exports, name, basedir);

return new RequireInTheMiddleSingleton();
return this._instance = (_a = this._instance) !== null && _a !== void 0 ? _a : new RequireInTheMiddleSingleton();
return (this._instance =
(_a = this._instance) !== null && _a !== void 0 ? _a : new RequireInTheMiddleSingleton());
}

@@ -84,0 +98,0 @@ }

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

export declare const VERSION = "0.34.0";
export declare const VERSION = "0.35.0";
//# sourceMappingURL=version.d.ts.map

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

// this is autogenerated file, see scripts/version-update.js
export const VERSION = '0.34.0';
export const VERSION = '0.35.0';
//# sourceMappingURL=version.js.map

@@ -25,2 +25,6 @@ import { DiagLogger, Meter, MeterProvider, Tracer, TracerProvider } from '@opentelemetry/api';

setMeterProvider(meterProvider: MeterProvider): void;
/**
* Sets the new metric instruments with the current Meter.
*/
protected _updateMetricInstruments(): void;
getConfig(): types.InstrumentationConfig;

@@ -27,0 +31,0 @@ /**

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

this._meter = api_1.metrics.getMeter(instrumentationName, instrumentationVersion);
this._updateMetricInstruments();
}

@@ -54,3 +55,10 @@ /* Returns meter */

this._meter = meterProvider.getMeter(this.instrumentationName, this.instrumentationVersion);
this._updateMetricInstruments();
}
/**
* Sets the new metric instruments with the current Meter.
*/
_updateMetricInstruments() {
return;
}
/* Returns InstrumentationConfig */

@@ -57,0 +65,0 @@ getConfig() {

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

const api_1 = require("@opentelemetry/api");
const RequireInTheMiddle = require("require-in-the-middle");
/**

@@ -133,5 +134,11 @@ * Base abstract class for instrumenting node plugins

for (const module of this._modules) {
this._hooks.push(this._requireInTheMiddleSingleton.register(module.name, (exports, name, baseDir) => {
const onRequire = (exports, name, baseDir) => {
return this._onRequire(module, exports, name, baseDir);
}));
};
// `RequireInTheMiddleSingleton` does not support absolute paths.
// For an absolute paths, we must create a separate instance of `RequireInTheMiddle`.
const hook = path.isAbsolute(module.name)
? RequireInTheMiddle([module.name], { internals: true }, onRequire)
: this._requireInTheMiddleSingleton.register(module.name, onRequire);
this._hooks.push(hook);
}

@@ -138,0 +145,0 @@ }

import type { Hooked } from './RequireInTheMiddleSingleton';
export declare const ModuleNameSeparator = "/";
declare type ModuleNameTrieSearchOptions = {
/**
* Whether to return the results in insertion order
*/
maintainInsertionOrder?: boolean;
/**
* Whether to return only full matches
*/
fullOnly?: boolean;
};
/**

@@ -20,8 +30,8 @@ * Trie containing nodes that represent a part of a module name (i.e. the parts separated by forward slash)

* @param {boolean} maintainInsertionOrder Whether to return the results in insertion order
* @param {boolean} fullOnly Whether to return only full matches
* @returns {Hooked[]} Matching hooks
*/
search(moduleName: string, { maintainInsertionOrder }?: {
maintainInsertionOrder?: boolean;
}): Hooked[];
search(moduleName: string, { maintainInsertionOrder, fullOnly }?: ModuleNameTrieSearchOptions): Hooked[];
}
export {};
//# sourceMappingURL=ModuleNameTrie.d.ts.map

@@ -59,15 +59,23 @@ "use strict";

* @param {boolean} maintainInsertionOrder Whether to return the results in insertion order
* @param {boolean} fullOnly Whether to return only full matches
* @returns {Hooked[]} Matching hooks
*/
search(moduleName, { maintainInsertionOrder } = {}) {
search(moduleName, { maintainInsertionOrder, fullOnly } = {}) {
let trieNode = this._trie;
const results = [];
let foundFull = true;
for (const moduleNamePart of moduleName.split(exports.ModuleNameSeparator)) {
const nextNode = trieNode.children.get(moduleNamePart);
if (!nextNode) {
foundFull = false;
break;
}
results.push(...nextNode.hooks);
if (!fullOnly) {
results.push(...nextNode.hooks);
}
trieNode = nextNode;
}
if (fullOnly && foundFull) {
results.push(...trieNode.hooks);
}
if (results.length === 0) {

@@ -74,0 +82,0 @@ return [];

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

*/
const isMocha = ['afterEach', 'after', 'beforeEach', 'before', 'describe', 'it'].every(fn => {
const isMocha = [
'afterEach',
'after',
'beforeEach',
'before',
'describe',
'it',
].every(fn => {
// @ts-expect-error TS7053: Element implicitly has an 'any' type

@@ -53,3 +60,9 @@ return typeof global[fn] === 'function';

const normalizedModuleName = normalizePathSeparators(name);
const matches = this._moduleNameTrie.search(normalizedModuleName, { maintainInsertionOrder: true });
const matches = this._moduleNameTrie.search(normalizedModuleName, {
maintainInsertionOrder: true,
// For core modules (e.g. `fs`), do not match on sub-paths (e.g. `fs/promises').
// This matches the behavior of `require-in-the-middle`.
// `basedir` is always `undefined` for core modules.
fullOnly: basedir === undefined,
});
for (const { onRequire } of matches) {

@@ -84,3 +97,4 @@ exports = onRequire(exports, name, basedir);

return new RequireInTheMiddleSingleton();
return this._instance = (_a = this._instance) !== null && _a !== void 0 ? _a : new RequireInTheMiddleSingleton();
return (this._instance =
(_a = this._instance) !== null && _a !== void 0 ? _a : new RequireInTheMiddleSingleton());
}

@@ -87,0 +101,0 @@ }

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

export declare const VERSION = "0.34.0";
export declare const VERSION = "0.35.0";
//# sourceMappingURL=version.d.ts.map

@@ -20,3 +20,3 @@ "use strict";

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.34.0';
exports.VERSION = '0.35.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/instrumentation",
"version": "0.34.0",
"version": "0.35.0",
"description": "Base class for node which OpenTelemetry instrumentation modules extend",

@@ -41,4 +41,4 @@ "author": "OpenTelemetry Authors",

"prepublishOnly": "npm run compile",
"compile": "tsc --build tsconfig.all.json",
"clean": "tsc --build --clean tsconfig.all.json",
"compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../",

@@ -54,3 +54,3 @@ "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../",

"version": "node ../../../scripts/version-update.js",
"watch": "tsc --build --watch tsconfig.all.json",
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
"precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies",

@@ -83,2 +83,3 @@ "prewatch": "node ../../../scripts/version-update.js",

"@opentelemetry/api": "^1.3.0",
"@opentelemetry/sdk-metrics": "1.9.0",
"@types/mocha": "10.0.0",

@@ -103,3 +104,3 @@ "@types/node": "18.6.5",

"rimraf": "3.0.2",
"sinon": "14.0.0",
"sinon": "15.0.0",
"ts-loader": "8.4.0",

@@ -116,3 +117,3 @@ "ts-mocha": "10.0.0",

"sideEffects": false,
"gitHead": "7972edf6659fb6e0d5928a5cf7a35f26683e168f"
"gitHead": "08f597f3a3d71a4852b0afbba120af15ca038121"
}

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 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 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 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 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 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 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 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 not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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