提交 8a49283d 编写于 作者: X Xin,Zhang 提交者: wu-sheng

add skywalking-egg-require module (#31)

* add skywalking-egg-require module

* Modify .tarvis.yml

* Modify .tarvis.yml
上级 24b05260
......@@ -10,4 +10,6 @@ cache:
directories:
- "node_modules"
script: cd modules/nodejs-agent && npm install && npm run check
script:
- cd ${TRAVIS_BUILD_DIR}/modules/nodejs-agent && npm install && npm run check
- cd ${TRAVIS_BUILD_DIR}/modules/skywalking-egg-require && npm install && npm run check
{
"extends": "google",
"plugins": [
"header"
],
"rules": {
"semi": [
"error",
"always"
],
"quotes": [
"error",
"double"
],
"max-len": [
"error",
{
"code": 120
}
],
"header/header": [
"error",
"copyright.js"
],
"no-invalid-this": "off",
"prefer-rest-params": "off",
"prefer-spread": "off"
},
"parserOptions": {
"ecmaVersion": 2017
}
}
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
npm-debug.log
.DS_Store
.idea/
.eslintrc
.gitignore
.gitmodules
.npmrc
.travis.yml
package-lock.json
copyright.js
package-lock=false
\ No newline at end of file
# Skywalking egg require
## How to use
1. Install package
```
npm i skywalking-egg-require --save
```
2. Add start arguments
add the following script arguments to the start script of your egg application.
```
--require sw-egg-script --sw_pplication_code=test --sw_direct_Servers
```
/*
* Licensed to the OpenSkywalking under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Licensed to the OpenSkywalking under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
"use strict";
const args = JSON.parse(process.argv.slice(2));
let applicationCode = "You Application";
let directServers = "localhost:11800";
if (args.hasOwnProperty("sw_pplication_code")) {
applicationCode = args["sw_pplication_code"];
}
if (args.hasOwnProperty("sw_direct_Servers")) {
directServers = args["sw_direct_Servers"];
}
require("skywalking-nodejs").start({
applicationCode: applicationCode,
directServers: directServers,
});
{
"name": "skywalking-egg-require",
"version": "0.1.0",
"description": "The require module that Skywalking nodejs agent enhance the egg framework",
"main": "index.js",
"scripts": {
"check": "eslint index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/OpenSkywalking/skywalking-nodejs.git"
},
"keywords": [
"skywalking",
"egg"
],
"contributors": [
{
"name": "Xin Zhang",
"email": "zhangxin@apache.org",
"url": "https://github.com/ascrutae"
}
],
"author": "Zhang Xin",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/OpenSkywalking/skywalking-nodejs/issues"
},
"homepage": "https://github.com/OpenSkywalking/skywalking-nodejs#readme",
"dependencies": {
"skywalking-nodejs": "^0.1.2"
},
"devDependencies": {
"eslint": "^4.19.1",
"eslint-config-google": "^0.9.1",
"eslint-plugin-header": "^1.2.0"
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册