-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: TypeScript: Log Metrics with JSON (not console.log) #1766
Comments
Hi @cortexcompiler thank you so much for taking the time to file this feature request. As you mentioned at the moment the Metrics utility uses I can see the value of adopting a similar strategy for the Metrics utility and between the two options you propose - at least for now - I'd be more inclined to go with option 1. The main reasons for this choice are keeping a relatively simple interface, and the fact that we are currently working on our next major release (#1714) so there's no better time than now to make this type of correction. Before making a final decision I'd like to take a bit of time to: 1/ test whether or not CloudWatch is still able to parse the EMF from the logs even after removing timestamp & request id from the log, and 2/ understand whether this has any impact for an eventual integration with other 3rd party observability providers. |
Hi @cortexcompiler, after looking into this I don't see any issue with supporting this. I'm working on a PR and the change will likely be released in the next version. |
|
This is now released under v1.15.0 version! |
Use case
We would like our Metrics to be logged in pure JSON to match the EMF document structure for
addMetric()
and thelogMetrics()
middleware. This will allow the logs to be machine readable and ingested by aggregators. Instead we are seeing the EMF JSON prefixed with the timestamp, request Id, and log level, because the code uses console.log()We use the Powertools for AWS Lambda (TypeScript) Metrics and Powertools for AWS Lambda (TypeScript) Logger. The Logger works fine because it uses its own console instance.
This is an example of one of the log events from CloudWatch:
Solution/User Experience
I would like to see the metrics logged with just JSON similar to how the logs are output from the Powertools Logger package.
console.log()
and do something similar to the Powertools Logger, or even re-use it.Alternative solutions
Acknowledgment
Future readers
Please react with 👍 and your use case to help us understand customer demand.
The text was updated successfully, but these errors were encountered: