Skip to content

instrumentation-aws-lambda: Error when configuring tracing without metrics #2747

Open
@jordankay13

Description

@jordankay13

What version of OpenTelemetry are you using?

instrumentation-aws-lambda: v0.50.3

What version of Node are you using?

22

What did you do?

Instrumented an AWS Lambda Function with opentelemetry

  const provider = new NodeTracerProvider({
    resource: new Resource({
      [ATTR_SERVICE_NAME]: 'my-service'
    }),
    sampler: new AlwaysOnSampler(),
    spanProcessors: [
      new BatchSpanProcessor(myExporter),
    ],
  });

  registerInstrumentations({
    instrumentations: [
      getNodeAutoInstrumentations({
        '@opentelemetry/instrumentation-aws-lambda': {
          disableAwsContextPropagation: true,
        },
      }),
    ],
  });

What did you expect to see?

Error logs should be clean.

What did you see instead?

Error logs:

diag.error(
'Metrics may not be exported for the lambda function because we are not force flushing before callback.'
);

Metrics may not be exported for the lambda function because we are not force flushing before callback.

Additional context

Despite not wanting metrics to be configured, the lambda instrumentation is requiring it through this error. We now either have to filter out these errors from our alerting or we have to configure a MeterProvider.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpkg:instrumentation-aws-lambdapriority:p4Bugs and spec inconsistencies which do not fall into a higher prioritization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions