Open thomasklinger1234 opened 2 years ago
While zerolog and logrus are both excellent libraries, it would be nice if logging didn't bring in a third-party dependency.
Another package to consider is the newly proposed slog package. Parts of the slog package could be implemented for Powertools logging usage.
The proposal is available here: https://go.googlesource.com/proposal/+/master/design/56345-structured-logging.md.
very interested in go powertools also!
Key information
Summary
Add support for Golang to make the awesome powertools ecosystem available to Go developers.
Motivation
As Go developers, we currently cannot benefit from the powertools, thus needing to re-implement the same functionality over and over. I have an internal implementation already setup but would like to contribute it to the wider community.
Proposal
If this feature should be available in other runtimes (e.g. Java), how would this look like to ensure consistency?
User Experience
How would customers use it?
First, install the dependency via
Next step would be to have a Lambda handler wrapper (similar to the
@Logging
/@Metrics
annotations for Java or the context managers for Python) to run some preprocessing / setup based on thePOWERTOOLS_
environment variables.The
LambdaHandler
definition could look something like thisDevelopers also want to use the Logger, Tracer and Metrics capabilities to enhance their experience.
Logger
The Logger capability will provide a standard logging facade with structured log support and leveled logging.
The output will be the same as in Powertools Python.
Metrics
The Metrics capability provides standard EMF metrics (maybe based on prozz/aws-embedded-metrics-golang.
Tracer
Tracer will provide capabilities for using X-Ray (based on aws/aws-xray-sdk-go)
Also, the
LambdaHandler
will automatically setup tracing when the appropriatePOWERTOOLS_
environment variables are set.Any configuration or corner cases you'd expect?
Demonstration of before and after on how the experience will be better
Drawbacks
For the initial implementation (and maybe in general), we should use establishes libraries like
Rationale and alternatives
The design for the UX needs to be fleshed out and check if it is ideomatic enough.
Unresolved questions
go get
table), one packagepowertools
or multiple packages in one project (likepowertools
,powertoolsmetrics
etc).