Open sarwaan001 opened 1 year ago
I do not see anything going to awsemf at all. I am able to see logs when using logging exporter with the same code.
Hi @sarwaan001, I see that you set the flush timeout to 900 ms and I think his might not be enough (for functions will small memory limit) on coldstart because total flush timeout is shared between traces first and then metrics.
decouple
processor (https://github.com/open-telemetry/opentelemetry-lambda/blob/main/collector/processor/decoupleprocessor/README.md) in the collector to be aligned with Lambda lifecycle. Otherwise, because of container freeze, some metrics might be missing or delayed.
Describe the bug OTEL Python Layer does not always flush metrics at the end of lambda invocation.
Steps to reproduce
trace.get_tracer_provider() tracer = trace.get_tracer(name)
meter = get_meter(name)
counter = meter.create_counter(name="invocation_counter", description="A counter metric", unit="invocations")
def lambdahandler(event, ): """Sample Lambda for testing""" counter.add(1) return {"status_code": 200}
Ensure that the following configuration for the lambda is set:
Ensure the lamdba has the following permissions:
Obtain the lambda arn
Ensure that you are logged in to aws cli
Create the following pytest and replace the lambda arn with the lamdba that was just created. test.py
ensure you have boto3 installed
run pytest
What did you expect to see? There should be 100 values in cloudwatch. pytest should pass
What did you see instead? Less than 100 values sent to cloudwatch, sometimes 100 on warm lambdas and the test passes.
What version of collector/language SDK version did you use? arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-python-amd64-ver-1-18-0:1
What language layer did you use? Python
Additional context I believe that sometimes the lambda layer does not flush emf metrics before the lambda freezes.