ratel

package module
v1.7.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

README

Ratel

Go Go Report Card goproxy codecov Release

Ratel 介绍

Ratel 一套微服务治理框架,集成了各种工程实践的 web 和 rpc 框架。

优点:

  • 轻松获得支撑千万日活服务的稳定性
  • 内建级联超时控制、限流、自适应熔断、自适应降载等微服务治理能力,无需配置和额外代码
  • 微服务治理中间件可无缝集成到其它现有框架使用
  • 大量微服务治理和并发工具包

Ratel 目的

  • 高效的性能
  • 简洁的语法
  • 广泛验证的工程效率
  • 极致的部署体验
  • 极低的服务端资源成本

Ratel 思考

  • 保持简单,第一原则
  • 弹性设计,面向故障编程
  • 工具大于约定和文档
  • 高可用
  • 高并发
  • 易扩展
  • 对业务开发友好,封装复杂度
  • 约束做一件事只有一种方式

Ratel 特性

  • 统一的指标采集
  • 链路追踪
  • 日志埋点
  • 统一错误处理
  • 动态配置
  • 安全策略
  • Debug 模式 等,可以极大的提高应用开发效率
  • 强大的工具支持,尽可能少的代码编写
  • 极简的接口
  • 完全兼容 net/http
  • 支持中间件,方便扩展
  • 高性能
  • 面向故障编程,弹性设计
  • 内建服务发现、负载均衡
  • 内建限流、熔断、降载,且自动触发,自动恢复
  • API 参数自动校验
  • 超时级联控制
  • 自动缓存控制
  • 链路跟踪、统计报警等
  • 高并发支撑,稳定保障了疫情期间每天的流量洪峰

Documentation

Index

Constants

View Source
const (
	//StageAfterStop after app stop
	StageAfterStop uint32 = iota + 1
	//StageBeforeStop before app stop
	StageBeforeStop
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Ratel

type Ratel struct {
	// contains filtered or unexported fields
}

Ratel Create an instance of Application, by using &Ratel{}

var App *Ratel

func New

func New(fns ...func() error) (*Ratel, error)

New new a Application

func (*Ratel) GracefulStop

func (app *Ratel) GracefulStop(ctx context.Context) (err error)

GracefulStop application after necessary cleanup

func (*Ratel) RegisterHooks added in v1.7.16

func (app *Ratel) RegisterHooks(k uint32, fns ...func() error) error

RegisterHooks register a stage Hook

func (*Ratel) Registry added in v1.2.17

func (app *Ratel) Registry(reg registry.Registry) *Ratel

Registry set customize registry

func (*Ratel) Run

func (app *Ratel) Run(servers ...server.Server) error

Run run application

func (*Ratel) Serve

func (app *Ratel) Serve(s ...server.Server) error

Serve start server

func (*Ratel) Startup

func (app *Ratel) Startup(fns ...func() error) error

Startup ..

func (*Ratel) Stop

func (app *Ratel) Stop() (err error)

Stop application immediately after necessary cleanup

func (*Ratel) Tracer added in v1.2.17

func (app *Ratel) Tracer(name, host string) *Ratel

Tracer ...

func (*Ratel) Worker added in v1.2.17

func (app *Ratel) Worker(w worker.Worker) *Ratel

Worker ..

Directories

Path Synopsis
client
ftp
dotnev
Package dotnev provide load .env data to os ENV
Package dotnev provide load .env data to os ENV
hcl
ini
toml
Package toml is driver use TOML format content as config source Usage please see example:
Package toml is driver use TOML format content as config source Usage please see example:
yaml
Package yaml is a driver use YAML format content as config source Usage please see example:
Package yaml is a driver use YAML format content as config source Usage please see example:
Package cron implements a cron spec parser and job runner.
Package cron implements a cron spec parser and job runner.
gin
img
rpc
sysinfo
cpu
net

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL