Pkg Url : https://github.com/uber-go/zap
- It is very fast in comparison to other golang logging packages.
- It provides both structured logging and printf style logging.
- It includes reflection-free, zero-allocation JSON encoder.
- The base 'Logger' avoids serialization overhead and allocations wherever possible.
- The base 'Logger' only supports strongly-typed, structured logging. Advisable to use where every microsecond and every allocation matter.
- The 'SuggaredLogger' is a bit slower in comparison to base 'Logger' as it supports both structured and printf-style logging.
Pkg Url : https://github.com/prometheus/client_golang
- It is used as a monitoring tool.
- It can provide insight on hardware and software metrics like response latency, resource overload, app errors, request count, request duration, etc.
- Provides automated monitoring coupled with alerting.
- Edge over other monitoring tools like NewRelic, datadog, etc. with polling strategy to pull metrics rather than pushing [by apps/services] to monitoring tools.
- Human-readable text based format for displaying metrics.
Pkg Url : https://github.com/oxequa/realize
- This is used as a watcher like nodemon in nodejs.
- High performance Live Reload.
- Custom env variables for project.
- Manage multiple projects at the same time.
- Protobuf instead of JSON : Protobuf serializes and deserializes structured data to communicate via binary.
- Built on HTTP 2 instead of HTTP 1.1 : supports bidirectional client-response communication.
- Code generation features are native to gRPC via its in-built protoc compiler versus use a third-party tool such as Swagger to auto-generate the code for API calls.
- gRPC is approx 7 times faster than REST when receiving data & almost 10 times faster than REST when sending data for a specific payload.
- protoc must be installed - if you wish to generate code from .proto file
- Define message types and services in a .proto file. Example format : proto-file
- Compile the .proto file using a proto compiler protoc using command format : protoc --proto_path= --go_out=.
- After successful code-generation, a .pb.go file will get created.
- In '.go' file where service needs to be implemented, import the auto-generated .pg.go file. Please see : service-implementation.
- Implement ServiceServer interface here.
In order to test the services, either create a client or use evans-cli:
- Client implementation example : https://github.com/HiteshRepo/GRPC-Template/blob/master/blog/client/client.go
- evans-cli : https://github.com/ktr0731/evans