aws-observability / aws-otel-lambda

AWS Distro for OpenTelemetry - AWS Lambda
https://aws-otel.github.io/
Apache License 2.0
146 stars 55 forks source link

[nodejs lambda layer] no metrics is exported to cloudwatch logs #836

Open stevemao opened 7 months ago

stevemao commented 7 months ago

name: Bug report about: Create a report to help us improve title: ''[nodejs lambda layer] no metrics is exported to cloudwatch logs" labels: bug assignees: ''


Describe the bug A clear and concise description of what the bug is.

I have added the adot layer in the lambda

adotInstrumentation: {
      layerVersion: AdotLayerVersion.fromJavaScriptSdkLayerVersion(AdotLambdaLayerJavaScriptSdkVersion.LATEST),
      execWrapper: AdotLambdaExecWrapper.REGULAR_HANDLER,
    },

everything else is just default

I'm able to see tracing in xray so the setup is correct

I then add the metrics collector in the source code of the lambda

import { metrics } from '@opentelemetry/api';
const meter = metrics.getMeter('default');

// other code

// in the handler
        const counter = meter.createCounter('mymetric');
        counter.add(1, { success: true });

I can see surrounding logs around this code so the code has bee executed.

In cloudwatch, I do not see this metric.

Steps to reproduce If possible, provide a recipe for reproducing the error.

What did you expect to see? A clear and concise description of what you expected to see.

In cloudwatch, I should see this metric as a log

What did you see instead? A clear and concise description of what you saw instead.

Only surrounding logs

What version of collector/language SDK version did you use? Version: (e.g., v0.58.0, v1.11.0, etc)

latest layer

What language layer did you use? Config: (e.g., Java, Python, etc)

nodejs/typescript

Additional context Add any other context about the problem here.

### Tasks
github-actions[bot] commented 4 months ago

This issue is stale because it has been open 90 days with no activity. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled

stevemao commented 4 months ago

Not stale

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 90 days with no activity. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled

stevemao commented 1 month ago

Not stale