Skip to content

Commit

Permalink
chore: update the website getting started docs (open-telemetry#2306)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan authored Jun 30, 2021
1 parent 2276e4f commit b09ee6f
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 236 deletions.
2 changes: 1 addition & 1 deletion getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ To create traces on NodeJS, you need `@opentelemetry/node`, `@opentelemetry/core

```sh
$ npm install \
@opentelemetry/core \
@opentelemetry/api \
@opentelemetry/node \
@opentelemetry/instrumentation-http \
@opentelemetry/instrumentation-express \
Expand Down
7 changes: 4 additions & 3 deletions website_docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ export data.

## Status and Releases

| Tracing | Metrics |
| ------- | ------- |
| Beta | Alpha |
| | Tracing | Metrics |
| ----- | ------- | ------- |
| API | GA | Alpha |
| SDK | Beta | Alpha |

You can find release information [here](https://github.com/open-telemetry/opentelemetry-js/releases)

Expand Down
46 changes: 30 additions & 16 deletions website_docs/getting_started/browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,24 @@ Add the following code to the `document-load.js` to create a tracer provider, wh
```javascript
// This is necessary for "parcel" to work OOTB. It is not needed for other build tools.
import 'regenerator-runtime/runtime'
import { LogLevel } from "@opentelemetry/core";
import { WebTracerProvider } from '@opentelemetry/web';
import { DocumentLoad } from '@opentelemetry/plugin-document-load';
import { ZoneContextManager } from '@opentelemetry/context-zone';
import { registerInstrumentations } from '@opentelemetry/instrumentation';

// Minimum required setup - supports only synchronous operations
const provider = new WebTracerProvider({
plugins: [
new DocumentLoad()
]
const provider = new WebTracerProvider();

provider.register({
// Changing default contextManager to use ZoneContextManager - supports asynchronous operations - optional
contextManager: new ZoneContextManager(),
});

// Registering instrumentations / plugins
registerInstrumentations({
instrumentations: [
new DocumentLoad(),
],
});
provider.register();
```

Run `parcel index.html` and open the development webserver (e.g. at `http://localhost:1234`) to see if your code works.
Expand All @@ -93,19 +100,26 @@ To export traces, modify `document-load.js` so that it matches the following cod
```javascript
// This is necessary for "parcel" to work OOTB. It is not needed for other build tools.
import 'regenerator-runtime/runtime'
import { LogLevel } from "@opentelemetry/core";
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { WebTracerProvider } from '@opentelemetry/web';
import { DocumentLoad } from '@opentelemetry/plugin-document-load';
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { ZoneContextManager } from '@opentelemetry/context-zone';
import { registerInstrumentations } from '@opentelemetry/instrumentation';

// Minimum required setup - supports only synchronous operations
const provider = new WebTracerProvider({
plugins: [
new DocumentLoad()
]
const provider = new WebTracerProvider();
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));

provider.register({
// Changing default contextManager to use ZoneContextManager - supports asynchronous operations - optional
contextManager: new ZoneContextManager(),
});

// Registering instrumentations / plugins
registerInstrumentations({
instrumentations: [
new DocumentLoad(),
],
});
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()))
provider.register();
```

Now, rebuild your application and open the browser again. In the console of the developer toolbar you should see some traces being exporterd:
Expand Down
Loading

0 comments on commit b09ee6f

Please sign in to comment.