oneapm-cheniu

1.2.4 • Public • Published

OneAPM Agent for Node.js

Build Status

安装

  1. 在需要监控的APP中安装oneapm模块 npm install oneapm --registry http://npm.oneapm.com
  2. 拷贝 node_modules/oneapm/oneapm.js 到APP根目录
  3. 修改配置文件 oneapm.js,将 license_key 的值修改为您的OneAPM帐号中的 license_key
  4. var oneapm = require('oneapm'); 写到APP主模块文件的第一行

浏览器性能监控

oneapm.getBrowserTimingHeader() 写到html模板的 <head> 标签的开头。(如果<head>中存在X-UA-COMPATIBLE HTTP-EQUIV等meta tags,请将语句写到meta tags之后,以便监控的更加精准。)

例子

app.js

   var oneapm = require('oneapm');
   var app = require('express')();
   app.locals.oneapm = oneapm;
   app.get('/user/:id', function (req, res) {
      res.render('user');
   });
   app.listen(process.env.PORT);

layout.jade:

doctype html
html
  head
    != oneapm.getBrowserTimingHeader()
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css')
  body
    block content

Package Sidebar

Install

npm i oneapm-cheniu

Weekly Downloads

2

Version

1.2.4

License

none

Last publish

Collaborators

  • yutou_cn