volos-analytics-apigee
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -105,20 +105,38 @@ /**************************************************************************** | ||
ApigeeAnalyticsSpi.prototype.makeRecord = function(req, resp, cb) { | ||
var record = {}; | ||
var now = Date.now(); | ||
record['client_received_start_timestamp'] = now; | ||
record['client_sent_end_timestamp'] = now + 1; // hack to avoid error in server calculations | ||
record['recordType'] = 'APIAnalytics'; | ||
record['apiproxy'] = this.proxy; | ||
record['request_uri'] = (req.protocol || 'http') + '://' + req.headers.host + req.url; | ||
record['request_path'] = req.url.split('?')[0]; | ||
record['request_verb'] = req.method; | ||
record['client_ip'] = req.connection.remoteAddress; | ||
record['useragent'] = req.headers['user-agent']; | ||
record['apiproxy_revision'] = this.proxy_revision; | ||
var record = { | ||
client_received_start_timestamp: now, | ||
client_sent_end_timestamp: now + 1, // hack to avoid error in server calculations | ||
recordType: 'APIAnalytics', | ||
apiproxy: this.proxy, | ||
request_uri: (req.protocol || 'http') + '://' + req.headers.host + req.url, | ||
request_path: req.url.split('?')[0], | ||
request_verb: req.method, | ||
client_ip: req.connection.remoteAddress, | ||
useragent: req.headers['user-agent'], | ||
apiproxy_revision: this.proxy_revision | ||
}; | ||
var self = this; | ||
onFinished(resp, function(err) { | ||
record['response_status_code'] = resp.statusCode; | ||
record['client_sent_end_timestamp'] = Date.now(); | ||
onFinished(resp, function() { | ||
record.response_status_code = resp.statusCode; | ||
record.client_sent_end_timestamp = Date.now(); | ||
// oauth | ||
var token = req.token; | ||
if (token) { | ||
record.developer_email = token.developer_email; | ||
record.developer_app = token.application_name; | ||
record.access_token = token.access_token; | ||
record.client_id = token.client_id; | ||
var prodList = token.api_product_list; | ||
if (prodList && prodList.length) { | ||
if (typeof prodList === 'string') { prodList = prodList.slice(1, -1).split(','); } | ||
// hack: analytics server only accepts a single product | ||
record.api_product = prodList[0]; | ||
} | ||
} | ||
self.finalizeRecord(req, resp, record, cb); | ||
@@ -137,2 +155,5 @@ }); | ||
} | ||
if (this.compress) { | ||
req.set('Content-Encoding', 'gzip'); | ||
} | ||
@@ -139,0 +160,0 @@ req |
{ | ||
"name": "volos-analytics-apigee", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"main": "lib/apigeeanalytics.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
12831
4
260
1
59