Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
feat(telemetry): adds a simple ping on server init to telemetry.speck…
Browse files Browse the repository at this point in the history
…le.works
  • Loading branch information
didimitrie committed Sep 2, 2019
1 parent 64d2d8c commit ec91fb2
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 10 deletions.
26 changes: 18 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"chalk": "^1.1.3",
"connect-redis": "^3.4.2",
"cors": "^2.8.1",
"countly-sdk-nodejs": "^19.8.0",
"crypto-random-string": "^3.0.1",
"dotenv": "^6.2.0",
"express": "^4.17.1",
Expand All @@ -30,6 +31,7 @@
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.15",
"mongoose": "^5.6.11",
"node-machine-id": "^1.1.12",
"nodemailer": "^6.3.0",
"passport": "^0.4.0",
"passport-anonymous": "^1.0.1",
Expand Down
25 changes: 23 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ if ( cluster.isMaster ) {
█ The Open Source Data Platform for AEC.
` +
chalk.red( `
chalk.red( `
█ Server running at: ${process.env.CANONICAL_URL}
` )
)
)

logger.level = 'debug'

Expand Down Expand Up @@ -68,6 +68,27 @@ chalk.red( `
redisClient.flushdb( )
} )

require( './telemetry' )()

// Countly.init( {
// app_key: '6b79ee267ff23c4b99108591c5b33f0ba8ed5e4b',
// device_id: 'test',
// url: 'https://telemetry.speckle.works',
// debug: true
// } )

// Countly.begin_session( false )

// Countly.add_event( {
// "key": "server-start",
// "segmentation": {
// "serverName": process.env.SERVER_NAME,
// "machineId": 'bender rocks!'
// }
// } )

// Countly.end_session( )

/////////////////////////////////////////////////////////////////////////
/// CHILD processes /////.
/////////////////////////////////////////////////////////////////////////
Expand Down
25 changes: 25 additions & 0 deletions telemetry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const countly = require( 'countly-sdk-nodejs' )
const machineIdSync = require( 'node-machine-id' ).machineIdSync

module.exports = ( ) => {
let myMachineId = machineIdSync( )
countly.init( {
app_key: '6b79ee267ff23c4b99108591c5b33f0ba8ed5e4b',
url: 'https://telemetry.speckle.works',
device_id: myMachineId,
debug: false
} )

countly.begin_session( false )

countly.add_event( {
"key": "server-deployment",
"segmentation": {
"serverName": process.env.SERVER_NAME,
"canonicalUrl": process.env.CANONICAL_URL,
"machineId": myMachineId
}
} )

countly.end_session( )
}

0 comments on commit ec91fb2

Please sign in to comment.