kieker-javascript-cli

0.11.4 • Public • Published

kieker-javascript-cli

Instrument your JS code via commmand-line

Install

$ npm install --global kieker-javascript-cli

Usage

$ kieker

Configuration

The configuration is done as part of the `package.json:

{
	...
	"kieker": {
		"serverUrl": "http://localhost:8000",
		"es6": true, // allow ECMAScript 6 code
		"entryFile": "./index.js", // required
		"files": [{
			"cwd": "src/",
			"src": "**/*.js",
			"dest": "dist/"
		}],
		"output": "./build.js", // required
		"workerOutput": "./worker.js",
		"advices": [{
			"type": "function",
			"exclude": { // blacklisting
				"name": "private_*" // any valid regex
			},
			"include": { // whitelisting
				"type": "function" // method or function
			}
		}, {
			"type": "function", // multiple advices of same type possible
			"include": {
				"type": "method"
			}
		}, {
			"type": "metainformation",
			"include": ["os", "version", "name"]
		}],
		"writer": [{
			"type": "console",
			"logLevel": "info"
		}, {
			"type": "websocket",
			"serverUrl": "http://myKiekerDataBridge.com:3333"
		}]
	}
	...
}

entryFile

Sets the entry file, normally the first file to be loaded. The basic configuration will be included in the output file.

files

The files to be transpiled given in an array of object with these three keys

cwd

The current working directory to take the files from

src

The source files, globbing is possible here

dest

The directory to write the files to (respectant to their path from the cwd directory)

output

The output file to write the transformed entry file to.

advices

An array of objects containing the configuration for the advices. Advices are the foundation of this library, as they collect the data to be monitored. They may be found on npm.

es6

Boolean flag that allows or disallows ECMAScript 6 code to be instrumented.

Writing your own Advice

  • If the advice needs an own Kieker Record, please enhance the kieker instrumentation-languages, specifically the Javascript one
  • As you (most likely) need some form of configuration or automated instrumentation to be used in this cli you need to add your package to this package.json.
    • For Configuration: Please see kieker-javascript-advice-environment as an example
    • For automated instrumentation: Please see kieker-javascript-advice-function as an example

writer

Writer work in a separate thread and send the data to the destination you want. They may be found on npm.

FAQ

require is not a function / undefined

The problem is that you are currently not using a build tool which

  • inlines the required JS files or
  • provides a require function in both the normal and the worker thread

To solve this, please use browserify in your build chain.

License

MIT © Daniel Schmidt

Readme

Keywords

Package Sidebar

Install

npm i kieker-javascript-cli

Weekly Downloads

1

Version

0.11.4

License

MIT

Last publish

Collaborators

  • dschmidt