open-telemetry / opentelemetry-lambda

Create your own Lambda Layer in each OTel language using this starter code. Add the Lambda Layer to your Lamdba Function to get tracing with OpenTelemetry.
https://opentelemetry.io
Apache License 2.0
277 stars 167 forks source link

Java Info log message with HTTP Server closed in cloudwatch? #1325

Closed sharanraj124 closed 1 month ago

sharanraj124 commented 4 months ago

Hi I am using java otel instrumentation in my lambda application, I got HTTP Server closed error message in my cloudwatch console

Screenshot 2024-05-14 at 7 38 29 PM

using java: 11

Added config.yaml file under resources directory

# config.yaml
receivers:
  otlp:
    protocols:
      http:

exporters:
  logging:
    loglevel: debug
  otlphttp:
    endpoint: "https://demo.test.com"

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [logging, otlphttp]
    metrics:
      receivers: [otlp]
      exporters: [logging, otlphttp]

pom.xml

    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>config.yaml</include>
        </includes>
      </resource>
    </resources>

serverless.yml

  environment:
    AWS_LAMBDA_EXEC_WRAPPER: /opt/otel-handler
    OPENTELEMETRY_COLLECTOR_CONFIG_FILE: /var/task/config.yaml
    OTEL_PROPAGATORS: tracecontext
    OTEL_TRACES_SAMPLER: always_on
    OTEL_INSTRUMENTATION_COMMON_DEFAULT_ENABLED: false
    OTEL_INSTRUMENTATION_AWS_LAMBDA_ENABLED: true
    OTEL_INSTRUMENTATION_AWS_SDK_ENABLED: true
    OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
  layers:
    - arn:aws:lambda:us-east-1:184161586896:layer:opentelemetry-javaagent-0_5_0:1
    - arn:aws:lambda:us-east-1:184161586896:layer:opentelemetry-collector-amd64-0_6_0:1

could please help for fixing these errors in lambda auto instrumentation java agent

rapphil commented 4 months ago

Hi, beside the error message, are you seeing anything wrong with the telemetry generated by the layers? Is it missing data points?

serkan-ozal commented 2 months ago

@rapphil @sharanraj124 This is not error log, but expected info log written by collector just before Lambda container shutdown in response to SHUTDOWN event (https://docs.aws.amazon.com/lambda/latest/dg/runtimes-extensions-api.html#runtimes-lifecycle-extensions-shutdown) as OTEL Lambda collector works as an external Lambda extension.

serkan-ozal commented 1 month ago

@tylerbenson @rapphil I believe that this is the expected behavior, not a bug.

tylerbenson commented 1 month ago

Thanks for investigating @serkan-ozal. @sharanraj124 I suggest you address this with the Java SIG if you'd like to remove that log. Closing the issue.