Update JS docs for examples and typos (#2435)
This commit is contained in:
parent
948b53f964
commit
e862448335
|
|
@ -920,7 +920,7 @@ import express from "express";
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
app.get('/', (_req, _res) => {
|
app.get('/', (_req, _res) => {
|
||||||
const histogram = myMeter.createHistogram("taks.duration");
|
const histogram = myMeter.createHistogram("task.duration");
|
||||||
const startTime = new Date().getTime()
|
const startTime = new Date().getTime()
|
||||||
|
|
||||||
// do some work in an API call
|
// do some work in an API call
|
||||||
|
|
@ -939,7 +939,7 @@ const express = require('express');
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
app.get('/', (_req, _res) => {
|
app.get('/', (_req, _res) => {
|
||||||
const histogram = myMeter.createHistogram("taks.duration");
|
const histogram = myMeter.createHistogram("task.duration");
|
||||||
const startTime = new Date().getTime()
|
const startTime = new Date().getTime()
|
||||||
|
|
||||||
// do some work in an API call
|
// do some work in an API call
|
||||||
|
|
@ -1009,7 +1009,7 @@ let temperature = 32;
|
||||||
|
|
||||||
const gauge = myMeter.createObservableGauge('temperature.gauge');
|
const gauge = myMeter.createObservableGauge('temperature.gauge');
|
||||||
|
|
||||||
counter.addCallback((result) => {
|
gauge.addCallback((result) => {
|
||||||
result.observe(temperature);
|
result.observe(temperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1036,8 +1036,8 @@ In JavaScript, each configuration type means the following:
|
||||||
|
|
||||||
- `description` - a human-readable description for the instrument
|
- `description` - a human-readable description for the instrument
|
||||||
- `unit` - The description of the unit of measure that the value is intended to
|
- `unit` - The description of the unit of measure that the value is intended to
|
||||||
represent. For example, `milliseconds` to meaure duration, or `bytes` to count
|
represent. For example, `milliseconds` to measure duration, or `bytes` to
|
||||||
number of bytes.
|
count number of bytes.
|
||||||
- `valueType` - The kind of numeric value used in measurements.
|
- `valueType` - The kind of numeric value used in measurements.
|
||||||
|
|
||||||
It's generally recommended to describe each instrument you create.
|
It's generally recommended to describe each instrument you create.
|
||||||
|
|
@ -1049,7 +1049,7 @@ You can add Attributes to metrics when they are generated.
|
||||||
```js
|
```js
|
||||||
const counter = myMeter.createCounter('my.counter');
|
const counter = myMeter.createCounter('my.counter');
|
||||||
|
|
||||||
cntr.add(1, { 'some.optional.attribute': 'some value' });
|
counter.add(1, { 'some.optional.attribute': 'some value' });
|
||||||
```
|
```
|
||||||
|
|
||||||
### Configure Metric Views
|
### Configure Metric Views
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ and [http](https://www.npmjs.com/package/@opentelemetry/instrumentation-http)
|
||||||
instrumentation libraries to automatically propagate trace context across
|
instrumentation libraries to automatically propagate trace context across
|
||||||
services for you.
|
services for you.
|
||||||
|
|
||||||
**It is highly recommend that you use instrumentation libraries to progagate
|
**It is highly recommend that you use instrumentation libraries to propagate
|
||||||
context.** Although it is possible to propagate context manually, if your system
|
context.** Although it is possible to propagate context manually, if your system
|
||||||
uses libraries to communicate between services, use a matching instrumentation
|
uses libraries to communicate between services, use a matching instrumentation
|
||||||
library to propagate context.
|
library to propagate context.
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ Add the following content to your package.json:
|
||||||
|
|
||||||
### Add HTTP call to function
|
### Add HTTP call to function
|
||||||
|
|
||||||
The following code makes a call to the OpenTemetry web site to demonstrate an
|
The following code makes a call to the OpenTelemetry web site to demonstrate an
|
||||||
outbound call.
|
outbound call.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue