Skip to content

Commit a1cbeb4

Browse files
committed
feat(event-paths): add path based event reporting with CollectorTransactionRaw 1.1.0 support
1 parent ef06893 commit a1cbeb4

File tree

124 files changed

+1998
-1511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+1998
-1511
lines changed

.eslintrc.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1+
parserOptions:
2+
ecmaVersion: 5
3+
sourceType: script
14
env:
25
node: true
36
mocha: true
47
extends: standard
58
rules:
6-
no-unused-expressions: off
7-
node/no-deprecated-api: off
8-
standard/no-callback-literal: off
9+
no-unused-expressions:
10+
- off
11+
node/no-deprecated-api:
12+
- off
13+
standard/no-callback-literal:
14+
- off
15+
strict:
16+
- error
17+
- safe
18+
consistent-this:
19+
- error
20+
- self
21+
no-multiple-empty-lines:
22+
- error
23+
- max: 1
24+
maxEOF: 0
25+
maxBOF: 0

example/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// index.js
1+
'use strict'
22
var trace = require('@risingstack/trace')
33

44
var app = require('express')()

example/config/trace.config.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
/**
22
* Your Trace configuration file
33
*/
4+
'use strict'
45

5-
module.exports = {
6-
serviceName: 'your-awesome-app',
7-
apiKey: 'KEEP.ME.SECRET',
8-
ignoreHeaders: {
9-
'user-agent': ['007']
10-
},
11-
ignorePaths: [
12-
'/healtcheck'
13-
],
14-
ignoreStatusCodes: [
15-
401,
16-
403
17-
]
18-
}
6+
module.exports = {
7+
serviceName: 'your-awesome-app',
8+
apiKey: 'KEEP.ME.SECRET',
9+
ignoreHeaders: {
10+
'user-agent': ['007']
11+
},
12+
ignorePaths: [
13+
'/healtcheck'
14+
],
15+
ignoreStatusCodes: [
16+
401,
17+
403
18+
]
19+
}

lib/agent/agent.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict'
12
var Timer = require('./timer')
23

34
function Agent (name, interval, task) {
@@ -27,6 +28,6 @@ Agent.prototype.stop = function (callback) {
2728

2829
Agent.prototype.initialize = function () { }
2930

30-
Agent.prototype.destruct = function () { this.stop() }
31+
Agent.prototype.destruct = function (callback) { this.stop(callback) }
3132

3233
module.exports = Agent
File renamed without changes.

lib/agent/api/bufferStream.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict'
12
var stream = require('stream')
23
var util = require('util')
34

lib/agent/api/index.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict'
12
var https = require('https')
23
var url = require('url')
34
var util = require('util')
@@ -246,27 +247,27 @@ CollectorApi.prototype.sendDependencies = function (dependencies) {
246247

247248
CollectorApi.prototype.getService = function (cb) {
248249
var opts = url.parse(this.COLLECTOR_API_SERVICE)
249-
var _this = this
250+
var self = this
250251
cb = cb || function () {}
251252

252253
var payload = JSON.stringify({
253-
name: _this.serviceName,
254+
name: self.serviceName,
254255
version: '2',
255256
collector: {
256-
language: _this.collectorLanguage,
257+
language: self.collectorLanguage,
257258
version: libPackage.version
258259
},
259260
runtime: {
260-
name: _this.system.processName,
261-
version: _this.system.processVersion,
262-
pid: _this.system.processId
261+
name: self.system.processName,
262+
version: self.system.processVersion,
263+
pid: self.system.processId
263264
},
264265
machine: {
265-
arch: _this.system.osArch,
266-
platform: _this.system.osPlatform,
267-
release: _this.system.osRelease,
268-
hostname: _this.system.hostname,
269-
cpus: _this.system.cpus
266+
arch: self.system.osArch,
267+
platform: self.system.osPlatform,
268+
release: self.system.osRelease,
269+
hostname: self.system.hostname,
270+
cpus: self.system.cpus
270271
}
271272
})
272273
var req = https.request({
@@ -287,13 +288,13 @@ CollectorApi.prototype.getService = function (cb) {
287288
res.pipe(bl(function (err, resBuffer) {
288289
var response
289290

290-
var retryInterval = _this.baseRetryInterval
291+
var retryInterval = self.baseRetryInterval
291292

292293
if (err) {
293294
debug.error('getService', err)
294295
return setTimeout(function () {
295296
debug.warn('getService', format('Retrying with %d ms', retryInterval))
296-
_this.getService()
297+
self.getService()
297298
}, retryInterval)
298299
}
299300

@@ -307,7 +308,7 @@ CollectorApi.prototype.getService = function (cb) {
307308
debug.error('getService', 'Service responded with ' + res.statusCode)
308309
return setTimeout(function () {
309310
debug.warn('getService', format('Retrying with %d ms', retryInterval))
310-
_this.getService(cb)
311+
self.getService(cb)
311312
}, retryInterval)
312313
}
313314

@@ -317,7 +318,7 @@ CollectorApi.prototype.getService = function (cb) {
317318
return
318319
}
319320

320-
_this.serviceKey = response.key
321+
self.serviceKey = response.key
321322
cb(null, response.key)
322323
}))
323324
})

lib/agent/api/index.spec.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
'use strict'
12
var util = require('util')
23
var url = require('url')
34
var https = require('https')
4-
var FakeReadable = require('../util').FakeStream.FakeReadable
5-
var FakeWritable = require('../util').FakeStream.FakeWritable
5+
var FakeReadable = require('./FakeStream.mock').FakeReadable
6+
var FakeWritable = require('./FakeStream.mock').FakeWritable
67
var CollectorApi = require('./')
78

89
var expect = require('chai').expect

lib/agent/control/control.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict'
12
var debug = require('../../utils/debug')('agent:control')
23

34
var inherits = require('util').inherits
@@ -19,19 +20,19 @@ function Control (options) {
1920
inherits(Control, Agent)
2021

2122
Control.prototype.getUpdates = function () {
22-
var _this = this
23+
var self = this
2324
this.collectorApi.getUpdates({
24-
latestCommandId: _this.latestCommandId
25+
latestCommandId: self.latestCommandId
2526
}, function (err, result) {
2627
if (err) {
2728
return debug.error('getUpdates', err)
2829
}
2930

30-
_this.latestCommandId = result.latestCommandId
31+
self.latestCommandId = result.latestCommandId
3132

3233
result.commands = result.commands || []
3334
result.commands.forEach(function (command) {
34-
_this.controlBus.emit(command.command, command)
35+
self.controlBus.emit(command.command, command)
3536
})
3637
})
3738
}

lib/agent/control/control.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict'
12
var expect = require('chai').expect
23

34
var Control = require('./')

0 commit comments

Comments
 (0)