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

Add nodejs auto-instrumentation for runtime metrics in paymentservice #1797

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ the release.
([#1786](https://github.com/open-telemetry/opentelemetry-demo/pull/1786))
* [chore] Add multi-platform build support
([#1785](https://github.com/open-telemetry/opentelemetry-demo/pull/1785))
* [paymentservice] Add nodejs auto-instrumentation for runtime metrics
([#1797](https://github.com/open-telemetry/opentelemetry-demo/pull/1797))

## 1.12.0

Expand Down
4 changes: 4 additions & 0 deletions src/paymentservice/opentelemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const {awsEc2Detector, awsEksDetector} = require('@opentelemetry/resource-detect
const {containerDetector} = require('@opentelemetry/resource-detector-container')
const {gcpDetector} = require('@opentelemetry/resource-detector-gcp')
const {envDetector, hostDetector, osDetector, processDetector} = require('@opentelemetry/resources')
const {RuntimeNodeInstrumentation} = require('@opentelemetry/instrumentation-runtime-node')

const sdk = new opentelemetry.NodeSDK({
traceExporter: new OTLPTraceExporter(),
Expand All @@ -20,6 +21,9 @@ const sdk = new opentelemetry.NodeSDK({
'@opentelemetry/instrumentation-fs': {
requireParentSpan: true,
},
}),
new RuntimeNodeInstrumentation({
monitoringPrecision: 5000,
})
],
metricReader: new PeriodicExportingMetricReader({
Expand Down
62 changes: 59 additions & 3 deletions src/paymentservice/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/paymentservice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@opentelemetry/exporter-trace-otlp-grpc": "0.51.1",
"@opentelemetry/exporter-metrics-otlp-grpc": "0.51.1",
"@opentelemetry/sdk-node": "0.51.1",
"@opentelemetry/instrumentation-runtime-node": "^0.10.0",
"@opentelemetry/resource-detector-alibaba-cloud": "0.28.9",
"@opentelemetry/resource-detector-aws": "1.5.0",
"@opentelemetry/resource-detector-container": "0.3.9",
Expand Down