Skip to content

Commit

Permalink
feat: set global meter provider when configureMeterProvider is not de…
Browse files Browse the repository at this point in the history
…fined (#1504)
  • Loading branch information
pragmaticivan authored Sep 4, 2024
1 parent 76f78b9 commit aeb3e92
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nodejs/packages/layer/src/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ import {
AwsLambdaInstrumentation,
AwsLambdaInstrumentationConfig,
} from '@opentelemetry/instrumentation-aws-lambda';
import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api';
import {
diag,
DiagConsoleLogger,
DiagLogLevel,
metrics,
} from '@opentelemetry/api';
import { getEnv } from '@opentelemetry/core';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto';
import {
Expand Down Expand Up @@ -200,6 +205,8 @@ async function initializeProvider() {
const meterProvider = new MeterProvider(meterConfig);
if (typeof configureMeterProvider === 'function') {
configureMeterProvider(meterProvider);
} else {
metrics.setGlobalMeterProvider(meterProvider);
}

const logExporter = new OTLPLogExporter();
Expand Down

0 comments on commit aeb3e92

Please sign in to comment.