Add more timing in the profile, add useProfiler config variable

Default to useProfiler:true in staging and development
This commit is contained in:
Sandro Santilli 2013-07-16 15:59:34 +02:00
parent 25c46962cb
commit ec97381820
9 changed files with 32 additions and 47 deletions

View File

@ -1,6 +1,7 @@
1.3.3
------
* Set Last-Modified header to allow for 304 responses
* Add profiling support (needs useProfiler in env config file)
1.3.2
------

View File

@ -63,6 +63,10 @@ var config = {
port: 6082,
ttl: 86400
}
// If useProfiler is true every response will be served with an
// X-Tiler-Profile header containing elapsed timing for various
// steps taken for producing the response.
,useProfiler:true
};
module.exports = config;

View File

@ -57,6 +57,10 @@ var config = {
port: 6082,
ttl: 86400
}
// If useProfiler is true every response will be served with an
// X-Tiler-Profile header containing elapsed timing for various
// steps taken for producing the response.
,useProfiler:false
};
module.exports = config;

View File

@ -57,6 +57,10 @@ var config = {
port: 6082,
ttl: 86400
}
// If useProfiler is true every response will be served with an
// X-Tiler-Profile header containing elapsed timing for various
// steps taken for producing the response.
,useProfiler:true
};
module.exports = config;

View File

@ -59,6 +59,10 @@ var config = {
port: null,
ttl: 86400
}
// If useProfiler is true every response will be served with an
// X-Tiler-Profile header containing elapsed timing for various
// steps taken for producing the response.
,useProfiler:false
};
module.exports = config;

View File

@ -37,7 +37,8 @@ module.exports = function(){
varnish_host: global.environment.varnish.host,
varnish_port: global.environment.varnish.port,
cache_enabled: global.environment.cache_enabled,
log_format: global.environment.log_format
log_format: global.environment.log_format,
useProfiler: global.environment.useProfiler
};
// Be nice and warn if configured mapnik version
@ -313,6 +314,7 @@ module.exports = function(){
LZMA.decompress(
lzma,
function(result) {
if (req.profiler) req.profiler.done('LZMA decompress');
try {
delete req.query.lzma
_.extend(req.query, JSON.parse(result))
@ -357,11 +359,14 @@ module.exports = function(){
var that = this;
if (req.profiler) req.profiler.done('req2params.setup');
Step(
function getPrivacy(){
cartoData.authorize(req, this);
},
function gatekeep(err, data){
if (req.profiler) req.profiler.done('cartoData.authorize');
if(err) throw err;
if(data === "0") throw new Error("Sorry, you are unauthorized (permission denied)");
return data;
@ -372,18 +377,21 @@ module.exports = function(){
cartoData.getDatabase(req, this);
},
function getGeometryType(err, data){
if (req.profiler) req.profiler.done('cartoData.getDatabase');
if (err) throw err;
_.extend(req.params, {dbname:data});
cartoData.getGeometryType(req, this);
},
function finishSetup(err, data){
if (req.profiler) req.profiler.done('cartoData.getGeometryType');
if ( err ) { callback(err, req); return; }
if (!_.isNull(data))
_.extend(req.params, {geom_type: data});
that.addCacheChannel(req, function(err) {
if (req.profiler) req.profiler.done('addCacheChannel');
callback(err, req);
});
}

48
npm-shrinkwrap.json generated
View File

@ -1,6 +1,6 @@
{
"name": "windshaft-cartodb",
"version": "1.3.1",
"version": "1.3.3",
"dependencies": {
"node-varnish": {
"version": "0.1.1"
@ -9,10 +9,10 @@
"version": "1.3.3"
},
"windshaft": {
"version": "0.12.9",
"version": "0.13.0",
"dependencies": {
"grainstore": {
"version": "0.13.5",
"version": "0.13.6",
"dependencies": {
"carto": {
"version": "0.9.3-cdb3",
@ -72,47 +72,7 @@
"version": "0.3.4"
},
"sqlite3": {
"version": "2.1.10",
"dependencies": {
"tar.gz": {
"version": "0.1.1",
"dependencies": {
"fstream": {
"version": "0.1.22",
"dependencies": {
"rimraf": {
"version": "2.2.0"
},
"graceful-fs": {
"version": "1.2.2"
},
"inherits": {
"version": "1.0.0"
}
}
},
"tar": {
"version": "0.1.17",
"dependencies": {
"inherits": {
"version": "1.0.0"
},
"block-stream": {
"version": "0.0.6"
}
}
},
"commander": {
"version": "1.1.1",
"dependencies": {
"keypress": {
"version": "0.1.0"
}
}
}
}
}
}
"version": "2.1.13"
},
"mime": {
"version": "1.2.9"

View File

@ -20,7 +20,7 @@
"dependencies": {
"node-varnish": "0.1.1",
"underscore" : "~1.3.3",
"windshaft" : "~0.12.9",
"windshaft" : "~0.13.0",
"step": "0.0.x",
"generic-pool": "~2.0.3",
"redis": "~0.8.3",