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 1.0.8 to 2.0.0

lib/hooks/mysql2.js

23

app.js

@@ -5,9 +5,16 @@ 'use strict';

module.exports = app => {
app.beforeStart(async () => {
app.als.enable();
hooks(app);
});
// put before other core middlewares
app.config.coreMiddlewares.unshift('jaeger');
};
class AppBootHook {
constructor(app) {
this.app = app;
}
configWillLoad() {
const { middlewareIndex } = this.app.config.jaeger;
this.app.config.middleware.splice(middlewareIndex, 0, 'jaeger');
}
async didReady() {
this.app.als.enable();
hooks(this.app);
}
}
module.exports = AppBootHook;
'use strict';
const { Tags } = require('opentracing');
const finishSpan = (span, ctx, err) => {

@@ -8,3 +10,3 @@ span.setTag('http.status_code', ctx.response.status);

span.log({
event: 'error',
event: Tags.ERROR,
'error.object': err,

@@ -21,5 +23,5 @@ message: err.message,

app.als.scope();
const span = app.startSpan(ctx.path, {
'http.method': ctx.method,
'http.url': ctx.url,
const span = app.startSpan(ctx.url, {
[Tags.HTTP_METHOD]: ctx.method,
[Tags.HTTP_URL]: ctx.href,
});

@@ -26,0 +28,0 @@ try {

@@ -5,2 +5,9 @@ # Changelog

## [2.0.0](https://github.com/sqlwwx/egg-jaeger/compare/v1.0.8...v2.0.0) (2019-10-08)
### Features
* support mysql2 ([e449ea6](https://github.com/sqlwwx/egg-jaeger/commit/e449ea6))
### [1.0.8](https://github.com/sqlwwx/egg-jaeger/compare/v1.0.7...v1.0.8) (2019-07-05)

@@ -7,0 +14,0 @@

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

exports.jaeger = {
sequelize: true,
redis: true,
serviceName: 'your-service-name',
sampler: {
type: 'const',
param: 1,
},
reporter: {
// Provide the traces endpoint; this forces the client to connect directly to the Collector and send
// spans over HTTP
// collectorEndpoint: 'http://jaeger-collector:14268/api/traces',
// Provide username and password if authentication is enabled in the Collector
// username: '',
// password: '',
},
hooks: {
sequelize: false,
mysql2: false,
redis: false,
},
middlewareIndex: 1,
};
'use strict';
const hookSequelize = require('./sequelize');
const hookRedis = require('./redis');
const supportedHooks = {
sequelize: require('./sequelize'),
redis: require('./redis'),
mysql2: require('./mysql2'),
};
module.exports = app => {
const { Sequelize, redis, config: { jaeger } } = app;
if (jaeger.sequelize && Sequelize) {
app.coreLogger.info('[egg-jaeger] setup Sequelize hooks');
hookSequelize(app);
}
if (jaeger.redis && redis) {
app.coreLogger.info('[egg-jaeger] setup ioredis hooks');
hookRedis(app);
}
const { jaeger: { hooks } } = app.config;
Object.entries(hooks).forEach(([ key, enable ]) => {
if (!enable) {
return
}
if (supportedHooks[key]) {
supportedHooks[key](app);
} else {
console.warn(`NOT SUPPORTED HOOK [${key}]`)
}
});
};
{
"name": "egg-jaeger",
"version": "1.0.8",
"version": "2.0.0",
"description": "jaeger egg plugin",

@@ -15,19 +15,19 @@ "eggPlugin": {

"async-local-storage": "^2.1.0",
"jaeger-client": "^3.13.0"
"jaeger-client": "^3.17.0"
},
"devDependencies": {
"@commitlint/cli": "^8.0.0",
"@commitlint/config-conventional": "^8.0.0",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"autod": "^3.0.0",
"autod-egg": "^1.0.0",
"egg": "^2.0.0",
"egg-bin": "^4.3.0",
"egg-ci": "^1.8.0",
"egg-mock": "^3.13.0",
"egg": "^2.23.0",
"egg-bin": "^4.13.2",
"egg-ci": "^1.13.0",
"egg-mock": "^3.24.1",
"egg-redis": "^2.2.0",
"eslint": "^6.0.1",
"eslint-config-egg": "^7.4.1",
"husky": "^3.0.0",
"lint-staged": "^9.0.2",
"standard-version": "^6.0.1",
"eslint": "^6.5.1",
"eslint-config-egg": "^7.5.1",
"husky": "^3.0.8",
"lint-staged": "^9.4.1",
"standard-version": "^7.0.0",
"webstorm-disable-index": "^1.2.0"

@@ -34,0 +34,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