Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update the website getting started docs #2306

Merged
merged 3 commits into from Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion getting-started/README.md
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
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
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