fix(tracing): use resourceFromAttributes for OTel SDK 2.x compatibility

@opentelemetry/resources v2.x changed the API - Resource class constructor
was replaced with resourceFromAttributes() factory function.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock 2026-01-24 16:57:05 -06:00
parent c1475e0306
commit 74565b93af
1 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ if (isEnabled) {
const { NodeSDK } = require('@opentelemetry/sdk-node')
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node')
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc')
const { Resource } = require('@opentelemetry/resources')
const { resourceFromAttributes } = require('@opentelemetry/resources')
const {
ATTR_SERVICE_NAME,
ATTR_SERVICE_VERSION,
@ -33,7 +33,7 @@ if (isEnabled) {
console.log(`[Tracing] Initializing OpenTelemetry - endpoint: ${endpoint}, service: ${serviceName}, pod: ${podName}`)
const resource = new Resource({
const resource = resourceFromAttributes({
[ATTR_SERVICE_NAME]: serviceName,
[ATTR_SERVICE_VERSION]: serviceVersion,
[ATTR_DEPLOYMENT_ENVIRONMENT_NAME]: environment,