You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: api/README.md
+12-10
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,14 @@ This package provides everything needed to interact with the OpenTelemetry API,
9
9
10
10
## Quick Start
11
11
12
-
To get started tracing you need to install the SDK and plugins, create a TracerProvider, and register it with the API.
12
+
To get started you need to install the SDK and plugins, create a TracerProvider and/or MeterProvider, and register it with the API.
13
13
14
14
### Install Dependencies
15
15
16
16
```sh
17
17
$ # Install tracing dependencies
18
18
$ npm install \
19
+
@opentelemetry/api \
19
20
@opentelemetry/core \
20
21
@opentelemetry/node \
21
22
@opentelemetry/tracing \
@@ -28,6 +29,8 @@ $ npm install \
28
29
@opentelemetry/exporter-prometheus # add exporters as needed
29
30
```
30
31
32
+
> Note: this example is for node.js. See [examples/tracer-web](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/tracer-web) for a browser example.
33
+
31
34
### Initialize the SDK
32
35
33
36
Before any other module in your application is loaded, you must initialize the global tracer and meter providers. If you fail to initialize a provider, no-op implementations will be provided to any library which acquires them from the API.
@@ -50,9 +53,9 @@ const tracerProvider = new NodeTracerProvider();
50
53
*/
51
54
tracerProvider.addSpanProcessor(
52
55
newSimpleSpanProcessor(
53
-
newJaegerExporter(
54
-
/* export options */
55
-
)
56
+
newJaegerExporter({
57
+
serviceName:'my-service'
58
+
})
56
59
)
57
60
);
58
61
@@ -124,18 +127,18 @@ If you are writing an instrumentation library, or prefer to call the API methods
124
127
```javascript
125
128
constapi=require("@opentelemetry/api");
126
129
127
-
/* Initialize TraceProvider*/
128
-
api.trace.setGlobalTracerProvider(traceProvider);
129
-
/* returns traceProvider (no-op if a working provider has not been initialized) */
0 commit comments