Go-kit is a set of Golang toolkits that help developers build robust, reliable, and maintainable microservices. It was initially developed for large enterprises, but soon became available to small start-ups and organizations as well.

Go-kit adopts a three-tier architecture from top to bottom: Transport, Endpoint, and Service. The Transport layer is responsible for the logic related to Transport protocols such as HTTP, gRPC, Thrift, etc. The Endpoint layer is responsible for converting the Request/Response format and common interceptor logic. The Service layer focuses on business logic. As the core of go-Kit, the Endpoint layer adopts an onion-like model and provides extended capabilities for logging, traffic limiting, fusing, link tracing, and service monitoring. To help developers build microservices, Go-Kit offers support for registries like Consul, ETCD, ZooKeeper, Eureka, and more.

I learned how to use Go-Kit by studying the official website, Github instances and some go-Kit-related articles at home and abroad, and strengthened it by writing examples and sharing articles in the community. We hope to communicate with the majority of Go-Kit fans and make progress together.

This document will be a summary of the past period of time to write articles and examples, as a directory for everyone to exchange. This series of documents progressively extends the capabilities of microservices based on arithmetic operations services.

  • Go-kit microservices: HTTP REST: Arithmetic operation services are constructed using the go-Kit three-tier architecture pattern, and the Transport layer uses HTTP.
  • Go-kit Microservices: Logging capabilities: Use ServiceMidlleware to add logging capabilities to the Service layer, using the built-in log component of Go-Kit.
  • Go-kit microservices: limiting traffic: Use endpoint.Middleware to add limiting logic, using go’s built-in time/rate and Juju/Ratelimit, respectively.
  • Go-kit microservices: API monitoring: Using ServiceMiddleware and Prometheus Reporter component (built-in implementation of Go-Kit) to collect operational indicators of service interface request times and request latency; Then the visualization of index data was realized by Grafana.
  • Go-kit Microservices: Service Registration and Discovery: In this article, Consul is selected as the registry to implement the service discovery function using go-Kit’s built-in service discovery mechanism.
  • Go-kit Microservices: A simple API Gateway: Since the way of service discovery is not general enough in the article “Go-Kit Microservices: Service Registration and Discovery”, this paper adopts the way of “named service” to implement a simple API gateway. Just the idea of implementation, not optimization.
  • Go-kit Microservices: Service Link Tracing: This article uses the Tracing component of Go-Kit and the Zipkin-Go package to add link tracing functions to gateway services and arithmetic operations services, demonstrating the integration of Zipkin in Go-Kit.
  • Go-kit Microservice: Service fusing: In go-Kit, Hystrix-Go is used to add a service fusing management scheme for gateway service. By simulating register service from “normal-fail-recovery”, the change of circuit breaker status is observed in Hystrix-Dashboard.
  • Go-kit microservice: JWT Identity authentication: This paper introduces JWT into go-Kit microservice based on examples.

The above is the current go-Kit series of articles, each article corresponding to the sample code, can be accessed through Github source code. I will continue to improve this series of articles with the actual learning situation.

Due to my limited level, there must be improper or wrong description in the article, I hope you can criticize and correct.

This article is first published in my wechat public account [Xi Yi Ang bar], welcome to scan code attention!