不要怂,就是干,撸起袖子干!

Commit 236b0e76 by Mick Hansen Committed by Jan Aagaard Meier

metrics

1 parent d238a052
...@@ -176,7 +176,6 @@ module.exports = (function() { ...@@ -176,7 +176,6 @@ module.exports = (function() {
var start = tk.time(); var start = tk.time();
var instance = new DAO(values, Utils._.extend(this.options, this.attributes, { hasPrimaryKeys: this.hasPrimaryKeys })) var instance = new DAO(values, Utils._.extend(this.options, this.attributes, { hasPrimaryKeys: this.hasPrimaryKeys }))
, self = this , self = this
this.daoFactoryManager.sequelize._metric('Model.build -> new DAO', tk.time() - start);
options = options || {} options = options || {}
instance.__factory = this instance.__factory = this
...@@ -213,6 +212,7 @@ module.exports = (function() { ...@@ -213,6 +212,7 @@ module.exports = (function() {
instance.isNewRecord = options.hasOwnProperty('isNewRecord') ? options.isNewRecord : true instance.isNewRecord = options.hasOwnProperty('isNewRecord') ? options.isNewRecord : true
instance.selectedValues = values instance.selectedValues = values
this.daoFactoryManager.sequelize._metric('Model.build', tk.time() - start);
return instance return instance
} }
......
...@@ -16,8 +16,9 @@ module.exports = (function() { ...@@ -16,8 +16,9 @@ module.exports = (function() {
} }
Utils.inherit(Query, AbstractQuery) Utils.inherit(Query, AbstractQuery)
var tk = require('timekit');
Query.prototype.run = function(sql) { Query.prototype.run = function(sql) {
var start = tk.time();
this.sql = sql this.sql = sql
if(this.options.logging !== false) { if(this.options.logging !== false) {
...@@ -26,7 +27,7 @@ module.exports = (function() { ...@@ -26,7 +27,7 @@ module.exports = (function() {
this.client.query(this.sql, function(err, results, fields) { this.client.query(this.sql, function(err, results, fields) {
this.emit('sql', this.sql) this.emit('sql', this.sql)
this.sequelize._metric('SQL', tk.time() - start);
if (err) { if (err) {
this.emit('error', err, this.callee) this.emit('error', err, this.callee)
} else { } else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!