All Projects → go-masonry → Mortar

go-masonry / Mortar

Licence: mit
Mortar is a GO framework/library for building gRPC (and REST) web services.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Mortar

Jupiter
Jupiter是斗鱼开源的面向服务治理的Golang微服务框架
Stars: ✭ 3,455 (+602.24%)
Mutual labels:  microservice, grpc, metrics, trace
Go Project Sample
Introduce the best practice experience of Go project with a complete project example.通过一个完整的项目示例介绍Go语言项目的最佳实践经验.
Stars: ✭ 344 (-30.08%)
Mutual labels:  microservice, grpc, dependency-injection
Nex
Aiming to simplify the construction of JSON API service
Stars: ✭ 35 (-92.89%)
Mutual labels:  microservice, middleware, dependency-injection
Hyperf
🚀 A coroutine framework that focuses on hyperspeed and flexibility. Building microservice or middleware with ease.
Stars: ✭ 4,206 (+754.88%)
Mutual labels:  microservice, grpc, dependency-injection
Airframe
Essential Building Blocks for Scala
Stars: ✭ 442 (-10.16%)
Mutual labels:  grpc, metrics, dependency-injection
Yoyogo
🦄🌈 YoyoGo is a simple, light and fast , dependency injection based micro-service framework written in Go. Support Nacos ,Consoul ,Etcd ,Eureka ,kubernetes.
Stars: ✭ 277 (-43.7%)
Mutual labels:  grpc, middleware
Joyrpc
high-performance, high-extensibility Java rpc framework.
Stars: ✭ 290 (-41.06%)
Mutual labels:  microservice, grpc
Furan
Scale out Docker builds
Stars: ✭ 339 (-31.1%)
Mutual labels:  microservice, grpc
App perf
Open source application performance monitoring tool with emphasis on ease of setup and use. Providing similar functionality like NewRelic/AppNeta/Skylight etc.
Stars: ✭ 353 (-28.25%)
Mutual labels:  metrics, trace
SocketHook
Socket hook is an injector based on EasyHook (win only) which redirect the traffic to your local server.
Stars: ✭ 38 (-92.28%)
Mutual labels:  microservice, dependency-injection
Go Grpc Middleware
Golang gRPC Middlewares: interceptor chaining, auth, logging, retries and more.
Stars: ✭ 4,170 (+747.56%)
Mutual labels:  grpc, middleware
Rocky
Full-featured, middleware-oriented, programmatic HTTP and WebSocket proxy for node.js
Stars: ✭ 357 (-27.44%)
Mutual labels:  microservice, middleware
Turbo
A lightweight microservice tool, turn your grpc|thrift APIs into HTTP APIs!
Stars: ✭ 275 (-44.11%)
Mutual labels:  microservice, grpc
Waterdrop
💧Waterdrop is a high performance micro service framework. Waterdrop comes from (The Three Body Problem).
Stars: ✭ 305 (-38.01%)
Mutual labels:  microservice, trace
EvaEngine.js
A micro service development engine for node.js
Stars: ✭ 31 (-93.7%)
Mutual labels:  microservice, dependency-injection
Krakend
Ultra performant API Gateway with middlewares. A project hosted at The Linux Foundation
Stars: ✭ 4,752 (+865.85%)
Mutual labels:  microservice, middleware
Echo
High performance, minimalist Go web framework
Stars: ✭ 21,297 (+4228.66%)
Mutual labels:  microservice, middleware
granitic
Web/micro-services and IoC framework for Golang developers
Stars: ✭ 32 (-93.5%)
Mutual labels:  microservice, dependency-injection
kubernetes-go-grpc
Microservices using Go, gRPC and Kubernates
Stars: ✭ 35 (-92.89%)
Mutual labels:  microservice, grpc
Grapi
😮 A surprisingly easy API server and generator in gRPC and Go
Stars: ✭ 364 (-26.02%)
Mutual labels:  microservice, grpc

Mortar

Go codecov PkgGoDev Go Report Card

Mortar is a GO framework/library for building gRPC (and REST) web services. Mortar has out-of-the-box support for configuration, application metrics, logging, tracing, profiling, dependency injection and more. While it comes with predefined defaults Mortar gives you total control to fully customize it.

Demo

Clone this demo repository and play around.

When you done, read the documentation or create your own service with this template here.

Features

Telemetry (Everything connected)

  • Logs have Tracing Information traceId=6ff7e7e38d1e86f across services logs

  • Also visible in Jaeger traceId=6ff7e7e38d1e86f if it's sampled. jaeger

Support for *http.Client Interceptors, so you can

  • Add request and response info to Trace traceId=6ff7e7e38d1e86f

    jaeger_http

  • Log/Dump requests and/or responses when http request fails.

    return func(req *http.Request, handler client.HTTPHandler) (resp *http.Response, err error) {
        var reqBytes, respBytes []byte
        // If the response is Bad Request, log both Request and Response
        reqBytes, _ = httputil.DumpRequestOut(req, true) // it can be nil and it's ok
        if resp, err = handler(req); err == nil && resp.StatusCode >= http.StatusBadRequest {
            respBytes, _ = httputil.DumpResponse(resp, true) // it can be nil
            logger.WithError(fmt.Errorf("http request failed")).
            WithField("status",resp.StatusCode).
            Warn(req.Context(), "\nRequest:\n%s\n\nResponse:\n%s\n", reqBytes, respBytes)
        }
        return
    }
    

    http_client

  • Alter requests and/or responses (useful in Tests)

    func(*http.Request, clientInt.HTTPHandler) (*http.Response, error) {
        // special case, don't go anywhere just return the response
        return &http.Response{
            Status:        "200 OK",
            StatusCode:    200,
            Proto:         "HTTP/1.1",
            ProtoMajor:    1,
            ProtoMinor:    1,
            ContentLength: 11,
            Body:          ioutil.NopCloser(strings.NewReader("car painted")),
        }, nil
    }
    

Monitoring/Metrics support

Export to either Prometheus/Datadog/statsd/etc, it's your choice. Mortar only provides the Interface and also caches the metrics so you don't have to.

counter := w.deps.Metrics.WithTags(monitor.Tags{
 "color":   request.GetDesiredColor(),
 "success": fmt.Sprintf("%t", err == nil),
}).Counter("paint_desired_color", "New paint color for car")

counter.Inc()

counter is actually a singleton, uniqueness calculated here

grafana

For more information about Mortar Monitoring read here.

Additional Features

  • /debug/pprof and other useful handlers
  • Use config_test.yml during tests to override values in config.yml, it saves time.

There are some features not listed here, please check the Documentation for more.

Documentation

Mortar is not a drop-in replacement.

It's important to read its Documentation first.

Service Template

To help you bootstrap your services with Mortar here you can find a template.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].