Skip to content
This repository has been archived by the owner on Apr 24, 2018. It is now read-only.

Commit

Permalink
Revert "Disable unused Statistics"
Browse files Browse the repository at this point in the history
This reverts commit 54e71ab.
  • Loading branch information
MaxymVlasov committed Dec 28, 2016
1 parent 797f9c9 commit c225470
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
21 changes: 20 additions & 1 deletion data/dataIO.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ module.exports = {
dataIOTests
}

const url = require('url')
const parsedStatsdUrl = url.parse(process.env.STATSD_URL, true, true)
const StatsD = require('node-statsd')
const statsClient = new StatsD(
{
host: parsedStatsdUrl.hostname,
port: parsedStatsdUrl.port
}
)
statsClient.socket.on('error', function (error) {
_log_(`Error in socket: ${error}`)
})

const firstEvent = 0

/**
Expand Down Expand Up @@ -168,6 +181,8 @@ dataIO.sendtoAPI = (title, agenda, social, place, regUrl, imgUrl, whenStart, whe
'submitter_email': process.env.EMAIL
})

statsClient.increment('eventsparser.sendToAPI.sends')

const options = {
'hostname': process.env.HOSTNAME_URL,
'port': process.env.HOSTNAME_PORT,
Expand All @@ -187,7 +202,11 @@ dataIO.sendtoAPI = (title, agenda, social, place, regUrl, imgUrl, whenStart, whe
res.on('end', () => { _log_('No more data in response. \n') })
}
})
req.on('error', (e) => { _log_(`problem with request: ${e.message}`) })
req.on('error', (e) => {
_log_(`problem with request: ${e.message}`)
statsClient.increment('eventsparser.sendToAPI.errors')
})

req.write(body)
req.end()
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"moment": "~2.13.0",
"node-statsd": "0.1.1",
"sync-request": "~3.0.0",
"xml2json": "~0.9.2",
"url": "0.11.0",
"xml2json": "0.9.2",
"yandex-translate": "~2.1.0"
},
"devDependencies": {
Expand Down

0 comments on commit c225470

Please sign in to comment.