Permalink
Browse files

new relic support in progress

  • Loading branch information...
1 parent dd31eeb commit 07bce8670eed108c7cbcd75af9ab5d1a4087a35c @moul committed Apr 20, 2013
Showing with 38 additions and 22 deletions.
  1. +4 −2 package.json
  2. +29 −20 src/app.coffee
  3. +5 −0 src/defaultConfig.coffee
View
@@ -1,6 +1,6 @@
{
"name": "tapas",
- "version": "0.2.4",
+ "version": "0.3.1",
"description": "Preconfigured Express environment with multiple modules and helpers",
"main": "index",
"dependencies": {
@@ -21,7 +21,9 @@
"bootstrap-stylus": "*",
"less": "*",
"underscore": "*",
- "winston": "0.6.2"
+ "winston": "0.6.2",
+ "newrelic": "0.9.20",
+ "statsd": "0.6.0"
},
"devDependencies": {
"coffee-script": "~1.3.3",
View
@@ -1,25 +1,24 @@
-_ = require 'underscore'
-http = require 'http'
-express = require 'express'
-express_View = require 'express/lib/view'
+_ = require 'underscore'
+http = require 'http'
+express = require 'express'
+express_View = require 'express/lib/view'
express_Utils = require 'express/lib/utils'
-coffee = require 'coffee-script'
-path = require 'path'
-fs = require 'fs'
-connect = require 'connect'
-jade = require 'jade'
-stylus = require 'stylus'
-nib = require 'nib'
-io = require 'socket.io'
-iolog = require 'socket.io/lib/logger'
-hogan = require 'hogan.js'
-htc = require 'hogan-template-compiler'
+coffee = require 'coffee-script'
+path = require 'path'
+fs = require 'fs'
+connect = require 'connect'
+jade = require 'jade'
+stylus = require 'stylus'
+nib = require 'nib'
+io = require 'socket.io'
+iolog = require 'socket.io/lib/logger'
+hogan = require 'hogan.js'
+htc = require 'hogan-template-compiler'
connect_assets = require 'connect-assets'
-exists = fs.existsSync || path.existsSync
-winston = require 'winston'
-util = require 'util'
-
-utils = require './utils'
+exists = fs.existsSync || path.existsSync
+winston = require 'winston'
+util = require 'util'
+utils = require './utils'
defaultConfig = require './defaultConfig'
hoganTemplateRenderers = []
@@ -133,6 +132,16 @@ class ksApp
@config.locals = coffee.helpers.merge defaultConfig.locals, @config.locals
@config.locals.print_errors = @config.debug
@config.locals.dirs = @config.dirs
+ if @config.newRelic.license_key
+ process.env.NEW_RELIC_NO_CONFIG_FILE ?= true
+ options = @config.newRelic
+ options.app_name ?= ["Tapas: #{@config.locals.site_name}"]
+ options.component ?= 'express_random_delays'
+ process.env.NEW_RELIC_APP_NAME ?= options.app_name
+ process.env.NEW_RELIC_LICENSE_KEY ?= options.license_key
+ require 'newrelic'
+ @logger = require('newrelic/lib/logger').child options
+ @logger.log = @logger.trace
@process = process
@iolog = new (iolog)()
do @ksAppInit
View
@@ -17,6 +17,11 @@ module.exports =
cache: true
viewEngine: 'jade' #hjs
staticMaxAge: 86400
+ newRelic:
+ license_key: null
+ app_name: null
+ logging:
+ level: 'trace'
locals:
title: ''
site_name: 'Tapas'

0 comments on commit 07bce86

Please sign in to comment.