@opentelemetry/web
Advanced tools
Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "@opentelemetry/web", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "OpenTelemetry Web Tracer", | ||
@@ -12,2 +12,3 @@ "main": "build/src/index.js", | ||
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", | ||
"precompile": "tsc --version", | ||
"compile": "tsc -p .", | ||
@@ -45,2 +46,3 @@ "fix": "gts fix", | ||
"@babel/core": "^7.6.0", | ||
"@opentelemetry/scope-zone": "^0.3.0", | ||
"@types/mocha": "^5.2.5", | ||
@@ -51,4 +53,4 @@ "@types/node": "^12.6.8", | ||
"babel-loader": "^8.0.6", | ||
"codecov": "^3.1.0", | ||
"gts": "^1.0.0", | ||
"codecov": "^3.6.1", | ||
"gts": "^1.1.0", | ||
"istanbul-instrumenter-loader": "^3.0.1", | ||
@@ -70,3 +72,3 @@ "karma": "^4.4.1", | ||
"tslint-microsoft-contrib": "^6.2.0", | ||
"typescript": "^3.6.3", | ||
"typescript": "3.7.2", | ||
"webpack": "^4.35.2", | ||
@@ -77,7 +79,7 @@ "webpack-cli": "^3.3.9", | ||
"dependencies": { | ||
"@opentelemetry/core": "^0.2.0", | ||
"@opentelemetry/scope-base": "^0.2.0", | ||
"@opentelemetry/tracing": "^0.2.0", | ||
"@opentelemetry/types": "^0.2.0" | ||
"@opentelemetry/core": "^0.3.0", | ||
"@opentelemetry/scope-base": "^0.3.0", | ||
"@opentelemetry/tracing": "^0.3.0", | ||
"@opentelemetry/types": "^0.3.0" | ||
} | ||
} |
@@ -11,5 +11,25 @@ # OpenTelemetry Web | ||
For manual instrumentation see the | ||
[@opentelemetry/web](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-web) package. | ||
[@opentelemetry/tracing](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-tracing) package. | ||
## How does automatic tracing work? | ||
This package exposes a class `WebTracer` that will be able to automatically trace things in Browser only. | ||
See the example how to use it. | ||
OpenTelemetry comes with a growing number of instrumentation plugins for well know modules (see [supported modules](https://github.com/open-telemetry/opentelemetry-js#plugins)) and an API to create custom plugins (see [the plugin developer guide](https://github.com/open-telemetry/opentelemetry-js/blob/master/doc/plugin-guide.md)). | ||
Web Tracer currently supports one plugin for document load. | ||
Unlike Node Tracer, the plugins needs to be initialised and passed in configuration. | ||
The reason is to give user full control over which plugin will be bundled into web page. | ||
You can choose to use the ZoneScopeManager if you want to trace asynchronous operations. | ||
## Installation | ||
```bash | ||
npm install --save @opentelemetry/web | ||
``` | ||
## Usage | ||
```js | ||
@@ -19,3 +39,5 @@ import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing'; | ||
import { DocumentLoad } from '@opentelemetry/plugin-document-load'; | ||
import { ZoneScopeManager } from '@opentelemetry/scope-zone'; | ||
// Minimum required setup - supports only synchronous operations | ||
const webTracer = new WebTracer({ | ||
@@ -28,22 +50,11 @@ plugins: [ | ||
webTracer.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); | ||
``` | ||
## Installation | ||
```bash | ||
npm install --save @opentelemetry/web | ||
``` | ||
## Usage | ||
```js | ||
// Manual | ||
const { WebTracer } = require('@opentelemetry/web'); | ||
const webTracer = new WebTracer(); | ||
const span = webTracer.startSpan('span1'); | ||
webTracer.withSpan(span, function () { | ||
this.addEvent('start'); | ||
// Changing default scopeManager to use ZoneScopeManager - supports asynchronous operations | ||
const webTracerWithZone = new WebTracer({ | ||
scopeManager: new ZoneScopeManager(), | ||
plugins: [ | ||
new DocumentLoad() | ||
] | ||
}); | ||
span.addEvent('middle'); | ||
span.end(); | ||
webTracerWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); | ||
@@ -50,0 +61,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26693
79
29
+ Added@opentelemetry/base@0.3.3(transitive)
+ Added@opentelemetry/core@0.3.3(transitive)
+ Added@opentelemetry/scope-base@0.3.3(transitive)
+ Added@opentelemetry/tracing@0.3.3(transitive)
+ Added@opentelemetry/types@0.3.3(transitive)
- Removed@opentelemetry/base@0.2.0(transitive)
- Removed@opentelemetry/core@0.2.0(transitive)
- Removed@opentelemetry/scope-base@0.2.0(transitive)
- Removed@opentelemetry/tracing@0.2.0(transitive)
- Removed@opentelemetry/types@0.2.0(transitive)
Updated@opentelemetry/core@^0.3.0
Updated@opentelemetry/types@^0.3.0