-
Notifications
You must be signed in to change notification settings - Fork 821
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(tracer-web): adding tracer web * feat(basic-tracer): adding karma tests * feat(tracer-web): adding some example for easier debugging in browser - for development purposes * fix: lint * fix: creating base for karma * fix: fixing problem with target for browser, cleanup tests * refactor: moving polyfills for node karma tests to one file * fix: adding missing package * refactor: removing unneeded file * refactor: prefixing privates, cleanup * fix: duplicate package * refactor: aligning tslint with other tslint packages * refactor: cleanups, adding comments for class * fix: linting * fix: type * refactor: generation of id for scope * refactor: removed previous uid for scope as originally it was meant to be used with async which is not the case anymore * chore: adding test for restoring scope * fix: lint * refactor: simplifying the stack scope manager * chore: updating readme with basic example * chore: fixes after merge * fix: updating test to accept greater or equal - fails on browser * refactor: moving example for web tracer * refactor: removing WebTracerConfig to use BasicTracerConfig which changed recently * chore: updating types * chore: spacing * chore: removing mocha tests for tracer-web * chore: updating types and linting * chore: updating packages after merge * chore: adding nyc report for karma tests for browser * chore: updating lerna script to run coverage for browsers * feat(tracer-web): bump version to 0.1.0
- Loading branch information
1 parent
00cd2ec
commit 82b5fad
Showing
31 changed files
with
1,205 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>JS Example</title> | ||
<base href="/"> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
</head> | ||
|
||
<body> | ||
Testing, debugging in development | ||
<script type="text/javascript" src="/bundle.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { WebTracer } from '@opentelemetry/tracer-web'; | ||
|
||
import * as shimmer from 'shimmer'; | ||
|
||
class Tester { | ||
constructor() { | ||
} | ||
add(name) { | ||
console.log('calling add', name); | ||
} | ||
} | ||
|
||
const tester = new Tester(); | ||
|
||
const webTracer = new WebTracer(); | ||
const span = webTracer.startSpan('span1'); | ||
|
||
shimmer.wrap(Tester.prototype, 'add', (originalFunction) => { | ||
return function patchedFunction() { | ||
try { | ||
span.addEvent('start'); | ||
} catch (e) { | ||
console.log('error', e); | ||
} finally { | ||
const result = originalFunction.apply(this, arguments); | ||
span.addEvent('after call'); | ||
span.end(); | ||
return result; | ||
} | ||
}; | ||
}); | ||
|
||
webTracer.withSpan(span, function () { | ||
console.log(this === span); | ||
}); | ||
|
||
tester.add('foo'); | ||
console.log(span); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "web-tracer-example", | ||
"private": true, | ||
"version": "0.1.0", | ||
"description": "Example of using @opentelemetry/tracer-web in browser", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "webpack-dev-server -d --progress --colors --port 8090 --config webpack.config.js --hot --inline --host 0.0.0.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://[email protected]/open-telemetry/opentelemetry-js.git" | ||
}, | ||
"keywords": [ | ||
"opentelemetry", | ||
"tracing", | ||
"web" | ||
], | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"author": "OpenTelemetry Authors", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/open-telemetry/opentelemetry-js/issues" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.6.0", | ||
"@types/shimmer": "^1.0.1", | ||
"babel-loader": "^8.0.6", | ||
"shimmer": "^1.2.0", | ||
"webpack": "^4.35.2", | ||
"webpack-cli": "^3.3.9", | ||
"webpack-dev-server": "^3.8.1", | ||
"webpack-merge": "^4.2.2" | ||
}, | ||
"dependencies": { | ||
"@opentelemetry/tracer-web": "^0.1.0" | ||
}, | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
const webpack = require('webpack'); | ||
const webpackMerge = require('webpack-merge'); | ||
const path = require('path'); | ||
const mainPath = path.resolve(''); | ||
const directory = path.resolve(__dirname); | ||
|
||
const common = { | ||
mode: 'development', | ||
entry: 'index.js', | ||
target: 'web', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js[x]?$/, | ||
exclude: /(node_modules)/, | ||
use: { | ||
loader: 'babel-loader' | ||
} | ||
}, | ||
{ | ||
test: /\.ts$/, | ||
exclude: /(node_modules)/, | ||
use: { | ||
loader: 'ts-loader' | ||
} | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
new webpack.ProvidePlugin({ | ||
jQuery: 'jquery', | ||
$: 'jquery', | ||
jquery: 'jquery', | ||
'window.jQuery': 'jquery' | ||
}) | ||
], | ||
resolve: { | ||
modules: [ | ||
path.resolve(mainPath, 'src'), | ||
path.resolve(directory), | ||
'node_modules' | ||
], | ||
extensions: ['.ts', '.js', '.jsx', '.json'] | ||
} | ||
}; | ||
|
||
module.exports = webpackMerge(common, { | ||
devtool: 'eval-source-map', | ||
output: { | ||
filename: 'bundle.js', | ||
sourceMapFilename: '[file].map' | ||
}, | ||
devServer: { | ||
contentBase: path.resolve(__dirname), | ||
// contentBase: path.resolve('.'), | ||
// historyApiFallback: true | ||
}, | ||
plugins: [ | ||
new webpack.DefinePlugin({ | ||
'process.env.NODE_ENV': JSON.stringify('development') | ||
}) | ||
] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/*! | ||
* Copyright 2019, OpenTelemetry Authors | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
module.exports = { | ||
listenAddress: 'localhost', | ||
hostname: 'localhost', | ||
browsers: ['ChromeHeadless'], | ||
frameworks: ['mocha'], | ||
reporters: ['spec'], | ||
files: ['test/index-webpack.ts'], | ||
preprocessors: { 'test/index-webpack.ts': ['webpack'] }, | ||
webpackMiddleware: { noInfo: true } | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/*! | ||
* Copyright 2019, OpenTelemetry Authors | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
const webpackConfig = require('./webpack/test.config.js'); | ||
const karmaBaseConfig = require('../../karma.base'); | ||
|
||
module.exports = (config) => { | ||
config.set(Object.assign({}, karmaBaseConfig, { | ||
webpack: webpackConfig | ||
})) | ||
}; |
Oops, something went wrong.