Skip to content

Commit

Permalink
Add nodejs auto-instrumentation for runtime metrics in paymentservice (
Browse files Browse the repository at this point in the history
…#1797)

* add nodejs auto-intrumentation in paymentservice

* update CHANGELOG.md

* update description in changelog
  • Loading branch information
liyanwei93 authored Dec 4, 2024
1 parent 3823951 commit f925282
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ the release.
([#1785](https://github.com/open-telemetry/opentelemetry-demo/pull/1785))
* [chore] Generate protobuf code for Go and Python services
([#1794](https://github.com/open-telemetry/opentelemetry-demo/pull/1784))
* [paymentservice] Add nodejs 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

0 comments on commit f925282

Please sign in to comment.