New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

egg-jaeger

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-jaeger - npm Package Compare versions

Comparing version 2.0.9 to 3.0.0

lib/init.js

3

app.js
'use strict';
require('./lib/init');
const hooks = require('./lib/hooks');

@@ -14,3 +16,2 @@

async serverDidReady() {
this.app.als.enable({ ignoreNoneParent: true });
hooks(this.app);

@@ -17,0 +18,0 @@ }

@@ -7,3 +7,2 @@ 'use strict';

const { initTracer, opentracing } = require('jaeger-client');
const als = require('async-local-storage');

@@ -13,7 +12,5 @@ const WORKER_ID = cluster.worker ? cluster.worker.id : 0;

const IPV6 = address.ipv6();
const PROCESS_PID = process.pid;
module.exports = {
get als() {
return als;
},
get jaeger() {

@@ -28,14 +25,35 @@ if (!this[cacheJaeger]) {

},
initSpan(name, tags) {
global.als.enterWith(new Map([[ 'layerCount', 1 ]]));
this.startSpan(name, tags);
},
startSpan(name, tags = {}) {
this.coreLogger.debug('[egg-jaeger] startSpan %s', name);
tags['app.version'] = this.loader.pkg.version;
tags['worker.id'] = WORKER_ID;
tags['process.id'] = process.pid;
tags['local.ipv4'] = IPV4;
tags['local.ipv6'] = IPV6;
const childOf = this.als.getFromParent('span');
const parentState = global.als.getStore();
if (!parentState || !(parentState instanceof Map)) {
return null;
}
let layerCount = parentState.get('layerCount');
if (!layerCount) {
return null;
}
Object.assign(tags, {
'app.version': this.loader.pkg.version,
'worker.id': WORKER_ID,
'process.id': PROCESS_PID,
'local.ipv4': IPV4,
'local.ipv6': IPV6,
});
const childOf = parentState.get('span');
layerCount = childOf ? layerCount + 1 : layerCount;
const span = this.jaeger.startSpan(name, childOf ? { childOf, tags } : { tags });
this.als.set('span', span);
global.als.enterWith(
new Map(parentState)
.set('span', span)
.set('layerCount', layerCount)
);
if (layerCount > 100) { console.warn(`jaeger layerCount ${layerCount}`); }
if (layerCount > 300) { console.error(`jaeger layerCount ${layerCount}`); }
return span;
},
};

@@ -21,4 +21,3 @@ 'use strict';

module.exports = (options, app) => async function jaegerMiddleware(ctx, next) {
app.als.scope();
const span = app.startSpan(ctx.url, {
const span = app.initSpan(ctx.url, {
[Tags.HTTP_METHOD]: ctx.method,

@@ -29,7 +28,7 @@ [Tags.HTTP_URL]: ctx.href,

await next();
finishSpan(span, ctx);
if (span) { finishSpan(span, ctx); }
} catch (err) {
finishSpan(span, ctx, err);
if (span) { finishSpan(span, ctx, err); }
throw err;
}
};

@@ -13,3 +13,3 @@ 'use strict';

if (!enable) {
return
return;
}

@@ -19,5 +19,5 @@ if (supportedHooks[key]) {

} else {
console.warn(`NOT SUPPORTED HOOK [${key}]`)
console.warn(`NOT SUPPORTED HOOK [${key}]`);
}
});
};
{
"name": "egg-jaeger",
"version": "2.0.9",
"version": "3.0.0",
"description": "jaeger egg plugin",

@@ -14,27 +14,30 @@ "eggPlugin": {

"dependencies": {
"async-local-storage": "git+ssh://git@gitlab.weidiango.com:github-mirror/async-local-storage#v2",
"jaeger-client": "^3.18.0"
"address": "^1.1.2",
"core-js": "2.6.2",
"jaeger-client": "^3.18.1",
"opentracing": "^0.14.5"
},
"devDependencies": {
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"autod": "^3.0.0",
"autod-egg": "^1.0.0",
"egg": "^2.26.0",
"egg-bin": "^4.14.1",
"egg-ci": "^1.15.0",
"egg-mock": "^4.0.0",
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"autod": "^3.1.1",
"autod-egg": "^1.1.0",
"egg": "^2.29.4",
"egg-bin": "^4.16.2",
"egg-ci": "^1.18.0",
"egg-mock": "^4.1.0",
"egg-redis": "^2.2.0",
"eslint": "^6.8.0",
"eslint-config-egg": "^8.0.1",
"husky": "^4.2.5",
"lint-staged": "^10.1.7",
"standard-version": "^7.1.0",
"eslint": "^7.27.0",
"eslint-config-egg": "^9.0.0",
"husky": "^6.0.0",
"lint-staged": "^11.0.0",
"mysql2": "^2.2.5",
"standard-version": "^9.3.0",
"webstorm-disable-index": "^1.2.0"
},
"engines": {
"node": ">=8.0.0"
"node": ">=12.17.0"
},
"scripts": {
"release": "standard-version",
"release": "npx standard-version",
"test": "npm run lint -- --fix && egg-bin pkgfiles && npm run test-local",

@@ -41,0 +44,0 @@ "test-local": "egg-bin test",

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