From 686a0e98e12b8900d35d940d31de854f1640e55e Mon Sep 17 00:00:00 2001 From: Viola_Pioggia <114391708+ViolaPioggia@users.noreply.github.com> Date: Mon, 11 Dec 2023 12:28:49 +0800 Subject: [PATCH] docs:optimize README (#87) --- README.md | 66 +++++++++++++++++-- README_CN.md | 65 ++++++++++++++++++ governance/{client => }/circuitbreak/fail.go | 0 governance/{client => }/circuitbreak/main.go | 0 governance/{client => }/circuitbreak/util.go | 0 governance/{server => }/limit/main.go | 0 .../retry}/client/backup/main.go | 3 +- .../retry}/client/failure/main.go | 3 +- .../retry}/failure/failure.go | 0 {retry => governance/retry}/server/main.go | 0 .../timeout => timeout/client}/main.go | 0 .../timeout => timeout/server}/main.go | 0 {protobuf => kitex/protobuf}/client/main.go | 0 {protobuf => kitex/protobuf}/server/main.go | 0 14 files changed, 130 insertions(+), 7 deletions(-) create mode 100644 README_CN.md rename governance/{client => }/circuitbreak/fail.go (100%) rename governance/{client => }/circuitbreak/main.go (100%) rename governance/{client => }/circuitbreak/util.go (100%) rename governance/{server => }/limit/main.go (100%) rename {retry => governance/retry}/client/backup/main.go (95%) rename {retry => governance/retry}/client/failure/main.go (95%) rename {retry => governance/retry}/failure/failure.go (100%) rename {retry => governance/retry}/server/main.go (100%) rename governance/{client/timeout => timeout/client}/main.go (100%) rename governance/{server/timeout => timeout/server}/main.go (100%) rename {protobuf => kitex/protobuf}/client/main.go (100%) rename {protobuf => kitex/protobuf}/server/main.go (100%) diff --git a/README.md b/README.md index 2d23c281..ffadc6c8 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,65 @@ # Kitex Examples -This repo contains useful examples for Kitex. +English | [中文](README_CN.md) -## Build +## How to run -```bash -docker build -t kitex-examples . -``` +You can go into the related examples for information on "how to run" + +## Bizdemo +- [bizdemo/easy_note](bizdemo/easy_note) Example of using kitex as an rpc framework to implement a simple note service with multiple middlewares +- [Bookinfo](https://github.com/cloudwego/biz-demo/tree/main/bookinfo) Example of using kitex as the rpc framework to implement multi-functional book service programs including istio, opentelemetry, etc. +- [Open Payment Platform](https://github.com/cloudwego/biz-demo/tree/main/open-payment-platform) Example of using kitex as the rpc framework to demonstrate the usage of kitex generic call, and builds an integrated payment platform. +- [Book Shop](https://github.com/cloudwego/biz-demo/tree/main/book-shop) Example of using kitex as an rpc framework to implement an e-commerce system including an ElasticSearch search engine +- [FreeCar](https://github.com/CyanAsterisk/FreeCar) Example of using kitex as the rpc framework to implement cloud native time-sharing car rental system suite services + +## Basic features +- [basic](basic) Basic example of kitex +- [async_call](async_call) Example of using asynchronous call in kitex server +- [codec](codec) Example of kitex server and client using custom codecs + - [codec-dubbo](https://github.com/kitex-contrib/codec-dubbo/tree/main/samples/helloworld) Example of dubbo protocol codec launched by Kitex to support kitex <-> dubbo interoperability +- [long_connection](longconnection) Kitex example of using long connections between server and client +- [streaming](streaming) Example of kitex server and client using streams +- [middleware](middleware) Kitex Example of using middleware between server and client + +## Governance Features +- Example of kitex server using configuration center to connect to governance features + - [etcd](https://github.com/kitex-contrib/config-etcd/tree/main/example) Kitex server uses etcd as an example of connecting the configuration center with governance features + - [nacos](https://github.com/kitex-contrib/config-nacos/tree/main/example) Kitex server uses nacos as an example of connecting the configuration center with governance features + - [apollo](https://github.com/kitex-contrib/config-apollo/tree/main/example) Kitex server uses apollo as an example of connecting the configuration center with governance features +- [discovery](discovery)Example of kitex server and client using service registration and discovery + - [etcd](https://github.com/kitex-contrib/registry-etcd/tree/main/example) Example of kitex server and client using etcd as service registration center + - [nacos](https://github.com/kitex-contrib/registry-nacos/tree/main/example) Kitex server and client use nacos as an example of service registration center + - [polaris](https://github.com/kitex-contrib/registry-polaris/tree/main/example) Kitex server and client use polaris as an example of service registration center + - [zookeeper](https://github.com/kitex-contrib/registry-zookeeper) Example of kitex server and client using zookeeper as service registration center + - [consul](https://github.com/kitex-contrib/registry-consul/tree/main/example) Example of kitex server and client using consul as service registration center + - [servicecomb](https://github.com/kitex-contrib/registry-servicecomb/tree/main/example) Kitex server and client use servicecomb as an example of service registration center + - [eureka](https://github.com/kitex-contrib/registry-eureka/tree/main/example) Kitex server and client use eureka as an example of service registration center + - [dns](https://github.com/kitex-contrib/resolver-dns) Example of kitex server and client using dns for service discovery + - [resolver_rule_based](https://github.com/kitex-contrib/resolver-rule-based/tree/main/demo) provides a rule-based resolver for kitex. It allows users to configure rules in service discovery to filter service instances and implement traffic segmentation. +- [timeout](governance/timeout) Example of using timeout control between kitex server and client +- [limit](governance/limit) Example of using current limit on kitex server +- [circuit_breaker](governance/circuitbreak) Example of kitex client using circuit breaker +- [retry](governance/retry) Example of kitex client using retry +- [load_balance](loadbalancer) Example of kitex server and client using load balancing + +## Observability +- [opentelemetry](opentelemetry) Example of kitex server and client using opentelemetry +- [prometheus](prometheus) Example of kitex server and client using prometheus +- [tracer](tracer) Example of using tracer on kitex server and client +- [klog](klog) Example of using klog logs on the kitex server + +## Advanced features +- [frugal](frugal) Kitex example of using frugal on the server and client +- [grpc_proxy](grpcproxy) Example of kitex server and client using grpc_proxy +- [generic](generic) kitex example of using generic calls between server and client +- [meta_info](metainfo) Example of kitex server and client using meta information +- [profiler](profiler) Example of kitex server and client performance analysis using request cost metrics +- [proxyless](proxyless) Example of letting Kitex services run in proxyless mode and be managed uniformly by the service mesh + +## Kitex generated code +- [protobuf](kitex/protobuf) Example of using kitex and protobuf to generate server code + +## Note + +All commands to execute the example should be executed under "kitex-example". \ No newline at end of file diff --git a/README_CN.md b/README_CN.md new file mode 100644 index 00000000..2edc375b --- /dev/null +++ b/README_CN.md @@ -0,0 +1,65 @@ +# Kitex Examples + +[English](README.md) | 中文 + +## 如何运行 + +您可以进入相关示例以获取有关“如何运行”的信息 + +## Bizdemo +- [bizdemo/easy_note](bizdemo/easy_note) 使用 kitex 作为 rpc 框架实现多中间键简易笔记服务的示例 +- [Bookinfo](https://github.com/cloudwego/biz-demo/tree/main/bookinfo) 使用 kitex 作为 rpc 框架实现包含 istio 服务网格,opentelemetry 监控等多功能书籍服务程序的示例 +- [Open Payment Platform](https://github.com/cloudwego/biz-demo/tree/main/open-payment-platform) 使用 kitex 作为 rpc 框架演示了 kitex 泛化调用的用法,构建了一体化支付平台 +- [Book Shop](https://github.com/cloudwego/biz-demo/tree/main/book-shop) 使用 kitex 作为 rpc 框架实现包含 ElasticSearch 搜索引擎的电子商务系统的示例 +- [FreeCar](https://github.com/CyanAsterisk/FreeCar) 使用 kitex 作为 rpc 框架实现云原生分时租车系统套件服务的示例 + +## 基本特性 +- [basic](basic) kitex 的基础示例 +- [async_call](async_call) 在 kitex server 中使用异步调用的示例 +- [codec](codec) kitex 服务端和客户端使用自定义编解码器的示例 + - [codec-dubbo](https://github.com/kitex-contrib/codec-dubbo/tree/main/samples/helloworld) Kitex 为了支持 kitex <-> dubbo 互通 推出的 dubbo 协议编解码器的示例 +- [long_connection](longconnection) kitex 服务端和客户端使用长连接的示例 +- [streaming](streaming) kitex 服务端和客户端使用流式调用的示例 +- [middleware](middleware) kitex 服务端和客户端使用中间件的示例 + +## 治理特性 +- kitex 服务端使用配置中心对接治理特性的示例 + - [etcd](https://github.com/kitex-contrib/config-etcd/tree/main/example) kitex 服务端使用 etcd 作为配置中心对接治理特性的示例 + - [nacos](https://github.com/kitex-contrib/config-nacos/tree/main/example) kitex 服务端使用 nacos 作为配置中心对接治理特性的示例 + - [apollo](https://github.com/kitex-contrib/config-apollo/tree/main/example) kitex 服务端使用 apollo 作为配置中心对接治理特性的示例 +- [discovery](discovery)kitex 服务端和客户端使用服务注册与发现的示例 + - [etcd](https://github.com/kitex-contrib/registry-etcd/tree/main/example) kitex 服务端和客户端使用 etcd 作为服务注册中心的示例 + - [nacos](https://github.com/kitex-contrib/registry-nacos/tree/main/example) kitex 服务端和客户端使用 nacos 作为服务注册中心的示例 + - [polaris](https://github.com/kitex-contrib/registry-polaris/tree/main/example) kitex 服务端和客户端使用 polaris 作为服务注册中心的示例 + - [zookeeper](https://github.com/kitex-contrib/registry-zookeeper) kitex 服务端和客户端使用 zookeeper 作为服务注册中心的示例 + - [consul](https://github.com/kitex-contrib/registry-consul/tree/main/example) kitex 服务端和客户端使用 consul 作为服务注册中心的示例 + - [servicecomb](https://github.com/kitex-contrib/registry-servicecomb/tree/main/example) kitex 服务端和客户端使用 servicecomb 作为服务注册中心的示例 + - [eureka](https://github.com/kitex-contrib/registry-eureka/tree/main/example) kitex 服务端和客户端使用 eureka 作为服务注册中心的示例 + - [dns](https://github.com/kitex-contrib/resolver-dns) kitex 服务端和客户端使用 dns 进行服务发现的示例 + - [resolver_rule_based](https://github.com/kitex-contrib/resolver-rule-based/tree/main/demo) 为 kitex 提供了一个基于规则的解析器。它允许用户在服务发现中配置规则来过滤服务实例,实现流量切分的功能。 +- [timeout](governance/timeout) kitex 服务端和客户端使用超时控制的示例 +- [limit](governance/limit) kitex 服务端使用限流的示例 +- [circuit_breaker](governance/circuitbreak) kitex 客户端使用熔断的示例 +- [retry](governance/retry) kitex 客户端使用重试的示例 +- [load_balance](loadbalancer) kitex 服务端和客户使用负载均衡的示例 + +## 可观测性 +- [opentelemetry](opentelemetry) kitex 服务端和客户端使用 opentelemetry 的示例 +- [prometheus](prometheus) kitex 服务端和客户端使用 prometheus 的示例 +- [tracer](tracer) kitex 服务端和客户端使用 tracer 的示例 +- [klog](klog) kitex 服务端使用 klog 日志的示例 + +## 高级特性 +- [frugal](frugal) kitex 服务端和客户端使用 frugal 的示例 +- [grpc_proxy](grpcproxy) kitex 服务端和客户端使用 grpc_proxy 的示例 +- [generic](generic) kitex 服务端和客户端使用泛化调用的示例 +- [meta_info](metainfo) kitex 服务端和客户端使用元信息的示例 +- [profiler](profiler) kitex 服务端和客户端使用请求成本度量进行性能分析的示例 +- [proxyless](proxyless) 让 Kitex 服务以 Proxyless 的模式运行,被服务网格统一纳管的示例 + +## Kitex 生成代码 +- [protobuf](kitex/protobuf) 使用 kitex 与 protobuf 生成服务端代码的示例 + +## Note + +执行示例的所有命令都应在 kitex-examples 下执行。 \ No newline at end of file diff --git a/governance/client/circuitbreak/fail.go b/governance/circuitbreak/fail.go similarity index 100% rename from governance/client/circuitbreak/fail.go rename to governance/circuitbreak/fail.go diff --git a/governance/client/circuitbreak/main.go b/governance/circuitbreak/main.go similarity index 100% rename from governance/client/circuitbreak/main.go rename to governance/circuitbreak/main.go diff --git a/governance/client/circuitbreak/util.go b/governance/circuitbreak/util.go similarity index 100% rename from governance/client/circuitbreak/util.go rename to governance/circuitbreak/util.go diff --git a/governance/server/limit/main.go b/governance/limit/main.go similarity index 100% rename from governance/server/limit/main.go rename to governance/limit/main.go diff --git a/retry/client/backup/main.go b/governance/retry/client/backup/main.go similarity index 95% rename from retry/client/backup/main.go rename to governance/retry/client/backup/main.go index 5193651b..f735cb09 100644 --- a/retry/client/backup/main.go +++ b/governance/retry/client/backup/main.go @@ -20,9 +20,10 @@ import ( "log" "time" + "github.com/cloudwego/kitex-examples/governance/retry/failure" + "github.com/cloudwego/kitex-examples/kitex_gen/api" "github.com/cloudwego/kitex-examples/kitex_gen/api/echo" - "github.com/cloudwego/kitex-examples/retry/failure" "github.com/cloudwego/kitex/client" "github.com/cloudwego/kitex/pkg/retry" ) diff --git a/retry/client/failure/main.go b/governance/retry/client/failure/main.go similarity index 95% rename from retry/client/failure/main.go rename to governance/retry/client/failure/main.go index 8af60bb3..3dce5510 100644 --- a/retry/client/failure/main.go +++ b/governance/retry/client/failure/main.go @@ -20,9 +20,10 @@ import ( "log" "time" + "github.com/cloudwego/kitex-examples/governance/retry/failure" + "github.com/cloudwego/kitex-examples/kitex_gen/api" "github.com/cloudwego/kitex-examples/kitex_gen/api/echo" - "github.com/cloudwego/kitex-examples/retry/failure" "github.com/cloudwego/kitex/client" "github.com/cloudwego/kitex/pkg/retry" ) diff --git a/retry/failure/failure.go b/governance/retry/failure/failure.go similarity index 100% rename from retry/failure/failure.go rename to governance/retry/failure/failure.go diff --git a/retry/server/main.go b/governance/retry/server/main.go similarity index 100% rename from retry/server/main.go rename to governance/retry/server/main.go diff --git a/governance/client/timeout/main.go b/governance/timeout/client/main.go similarity index 100% rename from governance/client/timeout/main.go rename to governance/timeout/client/main.go diff --git a/governance/server/timeout/main.go b/governance/timeout/server/main.go similarity index 100% rename from governance/server/timeout/main.go rename to governance/timeout/server/main.go diff --git a/protobuf/client/main.go b/kitex/protobuf/client/main.go similarity index 100% rename from protobuf/client/main.go rename to kitex/protobuf/client/main.go diff --git a/protobuf/server/main.go b/kitex/protobuf/server/main.go similarity index 100% rename from protobuf/server/main.go rename to kitex/protobuf/server/main.go