robustly alternatives and similar packages
Based on the "Utilities" category.
Alternatively, view robustly alternatives based on common mentions on social networks and blogs.
-
项目文档
基于vite+vue3+gin搭建的开发基础平台(支持TS,JS混用),集成jwt鉴权,权限管理,动态路由,显隐可控组件,分页封装,多点登录拦截,资源权限,上传下载,代码生成器,表单生成器,chatGPT自动查表等开发必备功能。 -
excelize
Go language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets -
godotenv
A Go port of Ruby's dotenv library (Loads environment variables from .env files) -
Kopia
Cross-platform backup tool for Windows, macOS & Linux with fast, incremental backups, client-side end-to-end encryption, compression and data deduplication. CLI and GUI included. -
go-funk
A modern Go utility library which provides helpers (map, find, contains, filter, ...) -
hystrix-go
Netflix's Hystrix latency and fault tolerance library, for Go -
lancet
A comprehensive, efficient, and reusable util function library of Go. -
gorequest
GoRequest -- Simplified HTTP client ( inspired by nodejs SuperAgent ) -
goreporter
A Golang tool that does static analysis, unit testing, code review and generate code quality report. -
gojson
Automatically generate Go (golang) struct definitions from example JSON -
create-go-app
✨ A complete and self-contained solution for developers of any qualification to create a production-ready project with backend (Go), frontend (JavaScript, TypeScript) and deploy automation (Ansible, Docker) by running only one CLI command. -
spinner
Go (golang) package with 90 configurable terminal spinner/progress indicators. -
EaseProbe
A simple, standalone, and lightweight tool that can do health/status checking, written in Go. -
filetype
Fast, dependency-free Go package to infer binary file types based on the magic numbers header signature -
mole
CLI application to create ssh tunnels focused on resiliency and user experience. -
boilr
:zap: boilerplate template manager that generates files or directories from template repositories -
mimetype
A fast Golang library for media type and file extension detection, based on magic numbers -
beaver
💨 A real time messaging system to build a scalable in-app notifications, multiplayer games, chat apps in web and mobile apps. -
go-underscore
Helpfully Functional Go - A useful collection of Go utilities. Designed for programmer happiness. -
JobRunner
Framework for performing work asynchronously, outside of the request flow -
git-time-metric
Simple, seamless, lightweight time tracking for Git
WorkOS - The modern identity platform for B2B SaaS
Do you think we are missing an alternative of robustly or a related project?
README
Robustly
Robustly runs code resiliently, recovering from occasional errors. It also gives you the ability to probabilistically inject panics into your application, configuring them at runtime at crash sites of your choosing. We use it at VividCortex to ensure that unexpected problems don't disable our agent programs.
Getting Started
go get github.com/VividCortex/robustly
Now import the following in your code:
import (
"github.com/VividCortex/robustly"
)
func main() {
go robustly.Run(func() { somefunc() })
}
func somefunc() {
for {
// do something here that may panic
}
}
API Documentation
View the GoDoc generated documentation here.
Robustly's Purpose
Robustly is designed to help make Go programs more resilient to errors you don't discover until they're in the field. It is not a general-purpose approach and shouldn't be overused, but in specific conditions it can be valuable.
Imagine, for example, that you are writing a program designed to process events at a high rate, such as 50,000 per second. The program is stateful, and its value comes from observing the event stream for relatively long periods, such as several minutes, to learn its behavior. Now imagine that you introduce a subtle bug into the program, which will happen extremely rarely -- once in a million. Although rare, this bug will cause a panic and crash the program.
Your program will be completely useless for its intended purpose, because you're likely to hit a once-in-a-million error every 20 seconds. Handling such errors, especially when the program will take some time and effort to fix and redeploy, can make the program 99.9999% useful again.
Robustly is targeted towards this type of use case. Its design is inspired by
the net/http
server's code, where each HTTP request is handled in a goroutine
that can crash without crashing the entire server.
When Robustly handles a crash, it immediately restarts the offending code. It keeps track of how fast the code crashes, and if it crashes too quickly for too long, it gives up and crashes the whole program. This way once-in-a-million errors can be restarted without getting into infinite loops.
Using Run
To use Run, simply wrap around the function call that represents the entry point to the code you wish to catch and restart:
robustly.Run(func() { /* your code here */ }, nil)
To use the optional settings of Run, pass Run a pointer to a RunOptions struct.
// RunOptions is a struct to hold the optional arguments to Run.
type RunOptions struct {
RateLimit float64 // the rate limit in crashes per second
Timeout time.Duration // the timeout (after which Run will stop trying)
PrintStack bool // whether to print the panic stacktrace or not
RetryDelay time.Duration // inject a delay before retrying the run
}
Default options are shown below:
robustly.Run(func() { /* your code here */ }, &robustly.RunOptions{
RateLimit: 1.0,
Timeout: time.Second,
PrintStack: false,
RetryDelay: 0 * time.Nanosecond,
})
Using Crash
Robustly also includes Crash()
, a way to inject panics into your code at runtime.
To use it, select places where you'd like to cause crashes, and add the following
line of code:
robustly.Crash()
Configure crash sites with CrashSetup()
. Pass it a comma-separated string of crash
sites, which are colon-separated file:line:probability
specifications. Probability
should range between 0 and 1. If you pass the special spec "VERBOSE"
, it will enable
printouts of all crash sites that are located in your code.
The idea is to match the crash sites configured in the setup with those actually present in your code. For example, if you have added a crash site in the code at line 53 of client.go, and you'd like to crash there, as well as at line 18 of server.go:
client.go:53:.003,server.go:18:.02
That will cause a crash .003 of the time at client.go line 53, and .02 of the time at server.go line 18.
If you are using robustly.Run()
to make your code resilient to errors, it is a very
good idea to deliberately inject errors and make sure they are indeed handled. You can
easily miss a detail such as a potentially crashing function that is called as a goroutine.
Contributing
We only accept pull requests for minor fixes or improvements. This includes:
- Small bug fixes
- Typos
- Documentation or comments
Please open issues to discuss new features. Pull requests for new features will be rejected, so we recommend forking the repository and making changes in your fork for your use case.
License
This program is (c) VividCortex 2013, and is licensed under the MIT license. Please see the LICENSE file.
*Note that all licence references and agreements mentioned in the robustly README section above
are relevant to that project's source code only.