Skip to content

Commit

Permalink
[demo] update JS docs (#2637)
Browse files Browse the repository at this point in the history
  • Loading branch information
puckpuck authored Apr 28, 2023
1 parent d97c38b commit b78cdf2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
16 changes: 15 additions & 1 deletion content/en/docs/demo/services/frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const {
const {
OTLPTraceExporter,
} = require('@opentelemetry/exporter-trace-otlp-grpc');
const {
OTLPMetricExporter,
} = require('@opentelemetry/exporter-metrics-otlp-grpc');
const { PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');
const {
alibabaCloudEcsDetector,
} = require('@opentelemetry/resource-detector-alibaba-cloud');
Expand All @@ -48,7 +52,17 @@ const {

const sdk = new opentelemetry.NodeSDK({
traceExporter: new OTLPTraceExporter(),
instrumentations: [getNodeAutoInstrumentations()],
instrumentations: [
getNodeAutoInstrumentations({
// only instrument fs if it is part of another trace
'@opentelemetry/instrumentation-fs': {
requireParentSpan: true,
},
}),
],
metricReader: new PeriodicExportingMetricReader({
exporter: new OTLPMetricExporter(),
}),
resourceDetectors: [
containerDetector,
envDetector,
Expand Down
11 changes: 9 additions & 2 deletions content/en/docs/demo/services/payment.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ const {

const sdk = new opentelemetry.NodeSDK({
traceExporter: new OTLPTraceExporter(),
instrumentations: [getNodeAutoInstrumentations()],
instrumentations: [
getNodeAutoInstrumentations({
// only instrument fs if it is part of another trace
'@opentelemetry/instrumentation-fs': {
requireParentSpan: true,
},
}),
],
metricReader: new PeriodicExportingMetricReader({
exporter: new OTLPMetricExporter(),
}),
Expand All @@ -72,7 +79,7 @@ const sdk = new opentelemetry.NodeSDK({
],
});

sdk.start().then(() => require('./index'));
sdk.start();
```

You can then use `opentelemetry.js` to start your app. This can be done in the
Expand Down

0 comments on commit b78cdf2

Please sign in to comment.