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

Commit

Permalink
chore(log): Remove datadog/statsd integration (#1921); r=vladikoff
Browse files Browse the repository at this point in the history
We've had too many doubts about the reliability of the numbers to get any
value out of it in practice, so let's remove it to keep things simple.
  • Loading branch information
rfk committed Jun 4, 2017
1 parent c9b0c43 commit 3f7ed68
Show file tree
Hide file tree
Showing 20 changed files with 379 additions and 900 deletions.
3 changes: 0 additions & 3 deletions config/dev.json
Expand Up @@ -17,9 +17,6 @@
"secure": false
},
"snsTopicArn": "disabled",
"statsd": {
"sample_rate": 1
},
"verificationReminders": {
"rate": 1
},
Expand Down
22 changes: 0 additions & 22 deletions config/index.js
Expand Up @@ -520,28 +520,6 @@ var conf = convict({
}
}
},
statsd: {
enabled: {
doc: 'enable UDP based statsd reporting',
default: false,
env: 'STATSD_ENABLE'
},
host: {
doc: 'StatsD host for sending logging events',
default: 'localhost',
env: 'STATSD_HOST'
},
port: {
format: 'port',
default: 8125,
env: 'STATSD_PORT'
},
sample_rate: {
doc: 'statsd sample rate',
default: 0.1,
env: 'STATSD_SAMPLE_RATE'
}
},
metrics: {
flow_id_key: {
default: 'YOU MUST CHANGE ME',
Expand Down
7 changes: 0 additions & 7 deletions lib/email/bounces.js
Expand Up @@ -35,11 +35,6 @@ module.exports = function (log, error) {
accountDeleted.bind(null, record.uid, record.email),
gotError.bind(null, record.email)
)
} else {
// A previously-verified email is now bouncing.
// We don't know what to do here, yet.
// But we can measure it!
log.increment('account.email_bounced.already_verified')
}
}

Expand Down Expand Up @@ -112,9 +107,7 @@ module.exports = function (log, error) {
// Log the bounced flowEvent and emailEvent metrics
utils.logFlowEventFromMessage(log, message, 'bounced')
utils.logEmailEventFromMessage(log, message, 'bounced', emailDomain)

log.info(logData)
log.increment('account.email_bounced')

const shouldDelete = bounce.bounceType === 'Permanent' ||
(bounce.bounceType === 'Complaint' && bounce.bounceSubType === 'abuse')
Expand Down
1 change: 0 additions & 1 deletion lib/email/delivery.js
Expand Up @@ -43,7 +43,6 @@ module.exports = function (log) {
utils.logEmailEventFromMessage(log, message, 'delivered', emailDomain)

log.info(logData)
log.increment('account.email_delivered')
}).then(
function () {
// We always delete the message, even if handling some addrs failed.
Expand Down
23 changes: 0 additions & 23 deletions lib/log.js
Expand Up @@ -9,7 +9,6 @@ const util = require('util')
const mozlog = require('mozlog')
const config = require('../config')
const logConfig = config.get('log')
const StatsDCollector = require('./metrics/statsd')
const unbuffer = require('./crypto/butil').unbuffer


Expand All @@ -26,15 +25,11 @@ function Lug(options) {

this.stdout = options.stdout || process.stdout

this.statsd = new StatsDCollector(this.logger)
this.statsd.init()

this.notifier = require('./notifier')(this)
}
util.inherits(Lug, EventEmitter)

Lug.prototype.close = function() {
return this.statsd.close()
}

// Expose the standard error/warn/info/debug/etc log methods.
Expand Down Expand Up @@ -72,27 +67,10 @@ Lug.prototype.begin = function (op, request) {
this.logger.debug(op)
}

// Expose some statsd helpers directly on the logger object.

Lug.prototype.increment = function(event) {
this.statsd.write({
event: event
})
}

Lug.prototype.stat = function (stats) {
this.logger.info('stat', stats)
}

Lug.prototype.timing = function(name, timing, tags) {
this.statsd.timing(name, timing, tags)
}

Lug.prototype.histogram = function(name, value, tags) {
this.statsd.histogram(name, value, tags)
}


// Log a request summary line.
// This gets called once for each compelted request.
// See https://mana.mozilla.org/wiki/display/CLOUDSERVICES/Logging+Standard
Expand Down Expand Up @@ -167,7 +145,6 @@ Lug.prototype.activityEvent = function (data) {
}

this.logger.info('activityEvent', data)
this.statsd.write(data)
}

// Log a flow metrics event.
Expand Down
2 changes: 0 additions & 2 deletions lib/metrics/context.js
Expand Up @@ -179,7 +179,6 @@ module.exports = function (log, config) {
valid: true,
agent: this.headers['user-agent']
})
log.increment('metrics.context.valid')
return true
}

Expand All @@ -194,7 +193,6 @@ module.exports = function (log, config) {
reason: reason,
agent: request.headers['user-agent']
})
log.increment('metrics.context.invalid')
return false
}

Expand Down
146 changes: 0 additions & 146 deletions lib/metrics/statsd.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/push.js
Expand Up @@ -151,7 +151,6 @@ module.exports = function (log, db, config) {
op: LOG_OP_PUSH_TO_DEVICES,
name: name
})
log.increment(name)
}
}

Expand Down
14 changes: 0 additions & 14 deletions lib/routes/account.js
Expand Up @@ -1266,7 +1266,6 @@ module.exports = (
if (payload.id) {
// Don't write out the update if nothing has actually changed.
if (isSpuriousUpdate(payload, sessionToken)) {
log.increment('device.update.spurious')
return reply(payload)
}
// We also reserve the right to disable updates until
Expand Down Expand Up @@ -1298,23 +1297,18 @@ module.exports = (
var spurious = true
if (! token.deviceId || payload.id !== token.deviceId.toString('hex')) {
spurious = false
log.increment('device.update.sessionToken')
}
if (payload.name && payload.name !== token.deviceName) {
spurious = false
log.increment('device.update.name')
}
if (payload.type && payload.type !== token.deviceType) {
spurious = false
log.increment('device.update.type')
}
if (payload.pushCallback && payload.pushCallback !== token.deviceCallbackURL) {
spurious = false
log.increment('device.update.pushCallback')
}
if (payload.pushPublicKey && payload.pushPublicKey !== token.deviceCallbackPublicKey) {
spurious = false
log.increment('device.update.pushPublicKey')
}
return spurious
}
Expand Down Expand Up @@ -1635,8 +1629,6 @@ module.exports = (
log.begin('Account.RecoveryEmailStatus', request)
var sessionToken = request.auth.credentials
if (request.query && request.query.reason === 'push') {
// only log recovery_email requests with 'push' to avoid sending too many requests.
log.increment('recovery_email_reason.push')
// log to the push namespace that account was verified via push
log.info({
op: 'push.pushToDevices',
Expand Down Expand Up @@ -1978,17 +1970,12 @@ module.exports = (
// for sign-in confirmation or they may have been clicking a
// stale link. Silently succeed.
if (account.emailVerified) {
if (butil.buffersAreEqual(code, account.emailCode)) {
log.increment('account.already_verified')
}
return true
}

// Any matching code verifies the account
return db.verifyEmail(account, account.emailCode)
.then(function () {
log.timing('account.verified', Date.now() - account.createdAt)
log.increment('account.verified')
return log.notifyAttachedServices('verified', request, {
email: account.email,
uid: account.uid,
Expand All @@ -2005,7 +1992,6 @@ module.exports = (
// if verified using a known reminder
var reminderOp = 'account.verified_reminder.' + reminder

log.increment(reminderOp)
// log to the mailer namespace that account was verified via a reminder
log.info({
op: 'mailer.send',
Expand Down
12 changes: 2 additions & 10 deletions lib/verification-reminders.js
Expand Up @@ -6,8 +6,6 @@ var config = require('../config')
var P = require('./promise')
var reminderConfig = config.get('verificationReminders')

var LOG_REMINDERS_CREATED = 'verification-reminders.created'
var LOG_REMINDERS_DELETED = 'verification-reminders.deleted'
var LOG_REMINDERS_ERROR_CREATE = 'verification-reminder.create'
var LOG_REMINDERS_ERROR_DELETE = 'verification-reminder.delete'

Expand Down Expand Up @@ -48,10 +46,7 @@ module.exports = function (log, db) {
var secondReminder = db.createVerificationReminder(reminderData)

return P.all([firstReminder, secondReminder])
.then(
function () {
log.increment(LOG_REMINDERS_CREATED)
},
.catch(
function (err) {
log.error({ op: LOG_REMINDERS_ERROR_CREATE, err: err })
}
Expand All @@ -70,10 +65,7 @@ module.exports = function (log, db) {
var secondReminder = db.deleteVerificationReminder(reminderData)

return P.all([firstReminder, secondReminder])
.then(
function () {
log.increment(LOG_REMINDERS_DELETED)
},
.catch(
function (err) {
log.error({ op: LOG_REMINDERS_ERROR_DELETE, err: err })
}
Expand Down

0 comments on commit 3f7ed68

Please sign in to comment.