awslabs/aws-embedded-metrics-java

ECS fargate is not working with EMF

Closed this issue · 9 comments

Problem:
We have migrated to embedded metrics logger, suddenly it stops logging metrics to cloudwatch

AWS Service:
ECS fargate

Log driver used in ECS container defintion
We are using
LogConfiguration:
LogDriver: awslogs

Questions:
Do we need to use separate LogDriver or ECS cloudwatch agent (non-blocking) as side car, any pointer ??
We want log metrics in blocking mode like awslogs driver

Are you seeing any logs appear into the log group that you specified in your logging configuration?

Using this EMF Java library, when you write the EMF logs to stdout, you should see them appear in the log group configured.

       **software.amazon.cloudwatchlogs.emf.MetricsBufferLogger.addMetric(extensionContext.getRequiredTestMethod().getName().concat(" - Failed"));** 

this is not creating any metrics in cloudwatch

        **log.info("Test Failed {}", extensionContext.getRequiredTestMethod().getName());**

This is creating logs in cloudwatch using slf4j

  1. Could you link me to MetricsBufferLogger?
  2. You must call the flush() method in order to serialize and write the log to stdout.

it was working before without emf logger , you can see flush() method in send() above code

  1. Could you link me to MetricsBufferLogger?
  2. You must call the flush() method in order to serialize and write the log to stdout.
    we are calling it

sorry its MetricsLogger not MetricsBufferLogger

Let me know if you need more info

@gordonpn is this à issue or i am doing something wrong ??

It looks like the issue is related to your implementation and not an issue with the library.

The library is in a stable state.

Have you found any gaps in code above ? We are getting issue in ECS fargate container with docker running inside

it has been fixed using ECS cloudwatch agent as side car container