Answer to a gentle polemic on Lessons Learned

This is an answer to: http://feelings-erased.blogspot.com/2020/03/robert-pajaks-lessons-learned-post.html Dear Grzesiek, I am very happy to see your answer to my blog post! It is a very valuable feedback for me. Thanks a lot. I wanted simply to leave a comment in you blog, but there is a limit of 4,096 characters. Therefore I decided to write my … Continue reading Answer to a gentle polemic on Lessons Learned

Lessons Learned after 1 year of programming in Go as a C# developer

Before pointing out my lessons learned, I am going to describe my background and the way I was learning and using Go to give you some context and better understanding. I was writing in C# from 2009 to 2018. I was developing different sort of applications such as desktop apps, web apps, web services. Some … Continue reading Lessons Learned after 1 year of programming in Go as a C# developer

Logging #9: Observability via Logging

Problem Application monitoring has grown more complex in the days of SaaS and microservices. Solution Observability, which for me means the ability to analyze the system usually based on its metrics, traces and logs. Example From the 3 standard tools used to achieve an observable system, logging is the most powerful one. It is possible … Continue reading Logging #9: Observability via Logging

Logging #7: Contextual Error Data Log Field

Problem Error logs miss contextual data, which are important to understand and troubleshoot the problem. Solution Add log fields containing contextual error data. If the error is raised deep in the call stack, then consider adding additional data to the returned error. Extract and add this contextual data to your structured logs when handling the … Continue reading Logging #7: Contextual Error Data Log Field

Logging #6: Correlation Log Field

Problem For concurrent applications it is hard to correlate multiple log entries which are emitted during the same request/pipeline. Solution Add contextual data to the log entries to enhance traceability. Example Let’s consider that we have following HTTP request handler that executes some background jobs (full code): func JobHandler(w http.ResponseWriter, r *http.Request) { go func() … Continue reading Logging #6: Correlation Log Field

Logging #5: Log Entry Builder

Problem Repetitive code when logging contextual data (like function's parameters, request's header). Solution Use Builder design pattern to create a log to be emitted. Example Let's consider that we have following HTTP request handler (full code): func OrderHandler(w http.ResponseWriter, r *http.Request) { var request struct { Product string `json:"product"` Quantity int `json:"quantity"` } if err … Continue reading Logging #5: Log Entry Builder

Go Starter Pack

Below I present a list of resources which I share with my colleagues new to Go (newbie Gophers). Fundamentals: Complete the Tour of Go: https://tour.golang.org/welcome/1 Read and practice: https://golang.org/doc/code.htmlRead and follow: https://golang.org/doc/effective_go.htmlRead and follow: https://github.com/golang/go/wiki/CodeReviewCommentsRead: https://golang.org/ref/memUse: https://gobyexample.comRead: http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/ Good Go resources: https://blog.golang.orghttps://www.ardanlabs.com/bloghttps://www.reddit.com/r/golang/ I would like to thank a lot everyone who helped me with the … Continue reading Go Starter Pack

Logging #3: Structured Logging

Structured Logging, also known as Semantic Logging, is probably the most powerful logging pattern I know. Let's assume that our log is normally emitted as follows (code - uses Go standard library): 2009/11/10 23:00:00.000000 Hello, Robert! Structured log differs from "regular" plain-text log, that is formatted in a consisted way. Usually in some form of … Continue reading Logging #3: Structured Logging