Skip to content

Commit

Permalink
Add Resource Detectors to payment service (#651)
Browse files Browse the repository at this point in the history
* Add Resource Detectors to payment service

Signed-off-by: svrnm <[email protected]>

* Update CHANGELOG

Signed-off-by: svrnm <[email protected]>

* Update src/paymentservice/package.json

Co-authored-by: Michael Maxwell <[email protected]>

Signed-off-by: svrnm <[email protected]>
Co-authored-by: Juliano Costa <[email protected]>
Co-authored-by: Michael Maxwell <[email protected]>
Co-authored-by: Pierre Tessier <[email protected]>
  • Loading branch information
4 people authored Dec 24, 2022
1 parent 36d9fff commit c5e8196
Show file tree
Hide file tree
Showing 5 changed files with 378 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,7 @@ significant modifications will be credited to OpenTelemetry Authors.
([#628](https://github.com/open-telemetry/opentelemetry-demo/pull/628))
* Update `quoteservice` to use opentelemetry-php beta release
([#644](https://github.com/open-telemetry/opentelemetry-demo/pull/644))
* Add resource detectors to payment service
([#651](https://github.com/open-telemetry/opentelemetry-demo/pull/651))
* Add resource detectors to frontend service
([#648](https://github.com/open-telemetry/opentelemetry-demo/pull/648))
18 changes: 17 additions & 1 deletion docs/services/paymentservice.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,30 @@ const opentelemetry = require("@opentelemetry/sdk-node")
const { getNodeAutoInstrumentations } = require("@opentelemetry/auto-instrumentations-node")
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc')
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-grpc')
const { PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');
const { PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics')
const { alibabaCloudEcsDetector } = require('@opentelemetry/resource-detector-alibaba-cloud')
const { awsEc2Detector, awsEksDetector } = require('@opentelemetry/resource-detector-aws')
const { containerDetector } = require('@opentelemetry/resource-detector-container')
const { gcpDetector } = require('@opentelemetry/resource-detector-gcp')
const { envDetector, hostDetector, osDetector, processDetector } = require('@opentelemetry/resources')

const sdk = new opentelemetry.NodeSDK({
traceExporter: new OTLPTraceExporter(),
instrumentations: [ getNodeAutoInstrumentations() ],
metricReader: new PeriodicExportingMetricReader({
exporter: new OTLPMetricExporter()
}),
resourceDetectors: [
containerDetector,
envDetector,
hostDetector,
osDetector,
processDetector,
alibabaCloudEcsDetector,
awsEksDetector,
awsEc2Detector,
gcpDetector
],
})

sdk.start().then(() => require("./index"));
Expand Down
18 changes: 17 additions & 1 deletion src/paymentservice/opentelemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,30 @@ const opentelemetry = require("@opentelemetry/sdk-node")
const { getNodeAutoInstrumentations } = require("@opentelemetry/auto-instrumentations-node")
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc')
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-grpc')
const { PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');
const { PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics')
const { alibabaCloudEcsDetector } = require('@opentelemetry/resource-detector-alibaba-cloud')
const { awsEc2Detector, awsEksDetector } = require('@opentelemetry/resource-detector-aws')
const { containerDetector } = require('@opentelemetry/resource-detector-container')
const { gcpDetector } = require('@opentelemetry/resource-detector-gcp')
const { envDetector, hostDetector, osDetector, processDetector } = require('@opentelemetry/resources')

const sdk = new opentelemetry.NodeSDK({
traceExporter: new OTLPTraceExporter(),
instrumentations: [ getNodeAutoInstrumentations() ],
metricReader: new PeriodicExportingMetricReader({
exporter: new OTLPMetricExporter()
}),
resourceDetectors: [
containerDetector,
envDetector,
hostDetector,
osDetector,
processDetector,
alibabaCloudEcsDetector,
awsEksDetector,
awsEc2Detector,
gcpDetector
],
})

sdk.start().then(() => require("./index"));
Loading

0 comments on commit c5e8196

Please sign in to comment.