Skip to content

Commit 223a523

Browse files
committed
fix: use resourceFromAttributes instead of Resource constructor
1 parent f3ef07c commit 223a523

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/instrumentation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
44
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-proto";
55
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-proto";
66
import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
7-
import { Resource } from "@opentelemetry/resources";
7+
import { resourceFromAttributes } from "@opentelemetry/resources";
88
import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from "@opentelemetry/semantic-conventions";
99

1010
// Only initialize OpenTelemetry in production (unless OTEL_ENABLED is explicitly set to "true")
@@ -19,7 +19,7 @@ if (shouldEnableOtel) {
1919
const environment = process.env.NODE_ENV || "development";
2020

2121
// Create resource with service information
22-
const resource = new Resource({
22+
const resource = resourceFromAttributes({
2323
[ATTR_SERVICE_NAME]: serviceName,
2424
[ATTR_SERVICE_VERSION]: serviceVersion,
2525
environment: environment, // Tag all data with environment

0 commit comments

Comments
 (0)