MCPcopy
hub / github.com/go-chassis/go-chassis

github.com/go-chassis/go-chassis @v2.8.0 sqlite

repository ↗ · DeepWiki ↗ · release v2.8.0 ↗
2,011 symbols 7,676 edges 324 files 1,149 documented · 57%
README

Coverage Status Go Report Card GoDoc HitCount
goproxy.cn Documentation Status

中文版README

Go-Chassis is a microservice framework for rapid development of microservices in Go. it focus on helping developer to deliver cloud native application more easily. The idea of logo is, developer can recreate and customize their own "wheel"(a framework) by go chassis to accelerate the delivery of software.

Why use Go chassis

  • powerful middleware "handler chain": powerful than "filter" or "interceptor". each handler in chain is able to get the running result of backward handler and your business logic. It is very useful in varies of scenario, for example:
  • a circuit breaker need to check command results
  • track response status and record it, so that prometheus can collect them
  • track critical response result, so that you can audit them
  • distribute tracing, you can complete the end span spec after business logic executed

the commonplace above is helping you decouple common function from business logic. without handler chain. those function will couple with business logic

  • go chassis is designed as a protocol-independent framework, any protocol is able to integrate with go chassis and leverage same function like load balancing, circuit breaker,rate limiting, routing management, those function resilient your service

  • go chassis makes service observable by bringing open tracing and prometheus to it.

  • go chassis is flexible, many different modules can be replaced by other implementation, like registry, metrics, handler chain, config server etc

  • With many build-in function like route management, circuit breaker, load balancing, monitoring etc, your don't need to investigate, implement and integrate many solutions yourself.

Features

  • Pluggable discovery service: Support Service center, kubernetes. fit both client side discovery and server side discovery pattern, and you can disable service discovery to use end to end communication.
  • Pluggable Protocol: You can customize protocol, by default support http and grpc, go chassis define standardized model to makes all request of different protocol leverage same features
  • Multiple server management: you can separate API by protocols and ports
  • Handler Chain: Able to add your own code during service calling for client and server side
  • rich middleware: based on handler chain, supply circuit breaker, rate limiting, monitoring, auth features. see
  • Traffic marker Traffic marker module is able to mark requests in both client(consumer) or server(provider) side, with marker, you can govern traffic based on it.
  • Traffic management: Able to route to different service based on weight and match rule, it can be used in many scenario, such as canary release
  • Security: build in cipher, authentication, RSA related funtions
  • Safety and resilience: support fault-tolerant(retry, rate limiting, client-side load-balancing, circuit breaker) to makes your service facing any unpredictable situation.
  • Telemetry: Able to expose Prometheus metric API automatically and customize metrics report. Use opentracing-go as standard library.
  • Backing services: use backend service as a plugin, so that your app can be easily tested, and swap to another plugin.
  • Hot re-configuration: Powered by go-archaius, configurations can be reload in runtime, like load balancing, circuit breaker, rate limiting, developer is also able to develop a service which has hot-reconfiguration feature easily. see
  • API first go chassis will automatically generate Open API 2.0 doc and register it to service center. you can manage all the API docs in one place
  • Spring Cloud integrate with servicecomb, go chassis can work together with spring cloud.
  • Service mesh: you can introduce multi-language to your microservice system. powered by servicecomb-mesher.
  • Less dependencies: checkout the go.mod file, it has less dependency on open source project by default, to import more features checkout plugins to see more features

Get started

1.Generate go mod

go mod init

2.Add go chassis ```shell script go get github.com/go-chassis/go-chassis/v2@v2.0.4

if you are facing network issue 
```bash
export GOPROXY=https://goproxy.io

3.Write your first http micro service

Documentations

You can see more documentations in here,

Examples

You can check examples here

NOTICE: Now examples is migrating to here

Communication Protocols

Go-Chassis supports 2 types of communication protocol. 1. http - an approach that leverages the HTTP protocol for communication. 3. gRPC - native grpc protocol, go chassis bring circuit breaker, route management etc to grpc.

Debug suggestion for dlv:

Add -tags debug into go build arguments before debugging, if your go version is go1.10 onward.

example:

go build -tags debug -o server -gcflags "all=-N -l" server.go

Chassis customized debug tag to resolve dlv debug issue:

https://github.com/golang/go/issues/23733

https://github.com/derekparker/delve/issues/865

Other project using go-chassis

  • apache/servicecomb-kie: A cloud native distributed configuration management service, go chassis and mesher integrate with it, so that user can manage service configurations by this service.
  • apache/servicecomb-mesher: A service mesh able to co-work with go chassis, it is able to run as a API gateway also.
  • KubeEdge: Kubernetes Native Edge Computing Framework (project under CNCF) https://kubeedge.io

Known Users

To register your self, go to https://github.com/go-chassis/go-chassis/issues/592

huawei qutoutiao Shopee
tencent-ieg changhong

Contributing

If you're interested in being a contributor and want to get involved in developing, please check CONTRIBUTING and wiki for details.

Join slack

Committer

  • ichiro999
  • humingcheng

Extension points exported contracts — how you extend this code

Handler (Interface)
Handler interface for handlers [28 implementers]
core/handler/handler.go
Strategy (Interface)
Strategy is load balancer algorithm , call Pick to return one instance [4 implementers]
core/loadbalancer/load_balancer.go
Registrator (Interface)
Registrator is the interface for developer to update information in service registry [2 implementers]
core/registry/registrator.go
RouteGroup (Interface)
RouteGroup is to define the route group name [2 implementers]
server/restful/router.go
Plugin (Interface)
Plugin is a interface which declares Init method [2 implementers]
bootstrap/bootstrap.go
Panel (Interface)
Panel is a abstraction of pulling configurations from various of systems, and transfer different configuration into stan [1 …
control/panel.go
Authenticator (Interface)
Authenticator can sign a token and authenticate that token [1 implementers]
security/authr/authenticator.go
ProtocolClient (Interface)
ProtocolClient is a interface to communicate with one kind of ProtocolServer, it is used in transport handler. this hand [1 …
core/client/client.go

Core symbols most depended-on inside this repo

Equal
called by 489
core/registry/struct.go
Error
called by 415
core/fault/fault.go
Run
called by 158
health/healthz.go
Info
called by 109
examples/schemas/restful_router_V1.go
Set
called by 106
core/registry/cache.go
Get
called by 75
core/registry/cache.go
Next
called by 72
core/handler/handler_chain.go
Write
called by 52
server/restful/context.go

Shape

Function 1,089
Method 590
Struct 276
FuncType 29
Interface 21
TypeAlias 6

Languages

Go100%
Python1%

Modules by API surface

pkg/metrics/metrics.go36 symbols
core/registry/servicecenter/servicecenter.go36 symbols
core/config/key_generator.go32 symbols
third_party/forked/afex/hystrix-go/hystrix/metric_collector/default_metric_collector.go25 symbols
core/provider/default_provider_test.go24 symbols
examples/schemas/employ/employ.pb.go23 symbols
core/registry/mock/mock.go23 symbols
pkg/metrics/prometheus.go22 symbols
core/config/model/chassis.go22 symbols
session/session_manager.go21 symbols
core/registry/struct.go21 symbols
examples/schemas/restful_hello.go20 symbols

Dependencies from manifests, versioned

github.com/beorn7/perksv1.0.1 · 1×
github.com/cenkalti/backoffv2.0.0+incompatible · 1×
github.com/cespare/xxhash/v2v2.1.2 · 1×
github.com/deckarep/golang-setv1.7.1 · 1×
github.com/emicklei/go-restfulv2.16.0+incompatible · 1×
github.com/fsnotify/fsnotifyv1.4.9 · 1×
github.com/go-chassis/cariv0.7.1-0.20220815112 · 1×
github.com/go-chassis/foundationv0.4.0 · 1×
github.com/go-chassis/go-archaiusv1.5.1 · 1×
github.com/go-chassis/go-restful-swagger20v1.0.4-0.20220704025 · 1×

For agents

$ claude mcp add go-chassis \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact