-
Notifications
You must be signed in to change notification settings - Fork 17
feat: introduce seatbelt crate #203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
a49cef7
feat: introduce seatbelt crate
martintmk 83e9b86
fixes
martintmk 07b7f4e
fixes
martintmk 299aa75
sort
martintmk a5bc1cf
fixes
martintmk ed0a1c1
fixies
martintmk 3a32ce1
fixes
martintmk d3b2ca7
fixes
martintmk 3bf81b6
fixes
martintmk 32fea51
format
martintmk 5b6b54b
fixes
martintmk 3a06b5a
rename CircuitBreaker to just Circuit
martintmk 9267c87
cleanup
martintmk 9a74869
rename SeatbeltOptions to Context
martintmk f4aa475
cleanup
martintmk e2fe66c
spelling fixes
martintmk 88c6bbc
clipy and fmt
martintmk e7c2aff
license headers
martintmk ae01de4
fixes
martintmk 5817ba1
Merge remote-tracking branch 'origin/main' into u/mtomka/seatbelt
martintmk 320d404
fixes
martintmk 6d40b71
cleanup
martintmk 5057b59
refine the features
martintmk ba87231
refine the features
martintmk cc1aa9c
PR comments
martintmk cc28b68
fixes
martintmk 45155d4
update library docs
martintmk 6cecc79
improvements
martintmk 92ec61c
fixes
martintmk cf70a2c
reorganize the crate modules
martintmk 3a1ce82
fixes
martintmk ac69bad
test fixes
martintmk 1ab0731
cleanup
martintmk 7c11ecc
fixes
martintmk 1fa6edc
fixes
martintmk a646f4e
cleanup
martintmk dfb2bb2
fixes
martintmk 9298bbf
fixes
martintmk d0be79c
Merge remote-tracking branch 'origin/main' into u/mtomka/seatbelt
martintmk 850d8e6
cleanup
martintmk 98f7bef
fixes
martintmk 6ac0b23
icons
martintmk 2c63f37
new tests
martintmk a51cb0b
fixes
martintmk afc1012
more tests
martintmk 8a98c9b
cleanup
martintmk 3fc1a0b
cleanup
martintmk ec8f6f8
fixes
martintmk 2550c45
kill mutants
martintmk 74e85f0
rename Context to PipelineContext
martintmk fa2f124
rename circuit to circuit_breaker
martintmk ebf0672
cleanup
martintmk 4eda7fd
spelling
martintmk 989784e
doc updates
martintmk b061a78
improve docs
martintmk 9d1f4c6
Merge remote-tracking branch 'origin/main' into u/mtomka/seatbelt
martintmk d2bafe3
fixes
martintmk 64cfbb9
address PR feedeback
martintmk ba35794
PR comments
martintmk 3587a9e
cleanup
martintmk 52a6cbd
type state concisenes
martintmk f73a666
cleanup
martintmk b0a20e7
PR comments
martintmk 06c1a45
Merge remote-tracking branch 'origin/main' into u/mtomka/seatbelt
martintmk 0345f6d
rebase
martintmk 9762e8a
enable_logs -> use_logs
martintmk bcf7c84
rename Circuit to Breaker
martintmk 880975d
cleanup
martintmk bfed2ba
rename PartitionKey to BreakerId
martintmk da99a8a
cleanup
martintmk d227dec
improve the docs
martintmk ae518fd
drop mention of polly
martintmk 22f22cb
drop redundant files
martintmk a5239a3
decrease base delay
martintmk d1cfa53
drop inifnite retries
martintmk c82ded7
improve docs
martintmk 1110821
refine the docs
martintmk b4cb313
rename the constant
martintmk 903af01
fixes
martintmk 8a92ab9
spelling
martintmk 37499a9
spelling
martintmk d8b2e29
PR comments
martintmk f6f8a75
Update README.md
martintmk 88bc6b9
Merge remote-tracking branch 'origin/main' into u/mtomka/seatbelt
martintmk f989b49
refined the docs
martintmk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Changelog | ||
|
|
||
| ## [0.2.0] - 2026-01-20 | ||
|
|
||
| Initial release. | ||
|
|
||
| - ✨ Features | ||
|
|
||
| - Timeout middleware for canceling long-running operations | ||
| - Retry middleware with constant, linear, and exponential backoff strategies | ||
| - Circuit breaker middleware with health-based failure detection and gradual recovery | ||
| - OpenTelemetry metrics integration (`metrics` feature) | ||
| - Structured logging via tracing (`logs` feature) | ||
| - Shared `Context` for clock and telemetry configuration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| [package] | ||
| name = "seatbelt" | ||
| description = "Resilience and recovery mechanisms for fallible operations." | ||
| version = "0.2.0" | ||
| readme = "README.md" | ||
| keywords = ["oxidizer", "resilience", "layered", "recovery", "retry", "breaker"] | ||
| categories = ["data-structures"] | ||
|
|
||
| edition.workspace = true | ||
| rust-version.workspace = true | ||
| authors.workspace = true | ||
| license.workspace = true | ||
| homepage.workspace = true | ||
| repository.workspace = true | ||
|
|
||
| [package.metadata.cargo_check_external_types] | ||
| allowed_external_types = [ | ||
| "layered::layer::stack::Stack", | ||
| "layered::service::Service", | ||
| "opentelemetry::metrics::meter::MeterProvider", | ||
| "recoverable::Recovery", | ||
| "recoverable::RecoveryInfo", | ||
| "recoverable::RecoveryKind", | ||
| "tick::clock::Clock", | ||
| "tower_layer::Layer", | ||
| ] | ||
|
|
||
| [package.metadata.docs.rs] | ||
| all-features = true | ||
|
|
||
| [features] | ||
| default = ["timeout", "retry", "breaker"] | ||
| timeout = [] | ||
| retry = ["dep:fastrand"] | ||
| breaker = ["dep:fastrand"] | ||
| metrics = ["dep:opentelemetry", "opentelemetry/metrics"] | ||
| logs = ["dep:tracing"] | ||
|
|
||
| [dependencies] | ||
| fastrand = { workspace = true, optional = true } | ||
| futures = { workspace = true } | ||
| layered = { workspace = true } | ||
| opentelemetry = { workspace = true, optional = true } | ||
| recoverable = { workspace = true } | ||
| tick = { workspace = true } | ||
| tracing = { workspace = true, optional = true } | ||
|
|
||
| [dev-dependencies] | ||
| alloc_tracker.workspace = true | ||
| criterion.workspace = true | ||
| fastrand.workspace = true | ||
| futures = { workspace = true, features = ["executor"] } | ||
| http.workspace = true | ||
| layered = { workspace = true } | ||
| mutants.workspace = true | ||
| ohno = { workspace = true, features = ["app-err"] } | ||
| opentelemetry = { workspace = true, default-features = false, features = ["metrics"] } | ||
| opentelemetry-stdout = { workspace = true, default-features = false, features = ["metrics", "logs"] } | ||
| opentelemetry_sdk = { workspace = true, default-features = false, features = ["metrics", "testing", "experimental_metrics_custom_reader"] } | ||
| static_assertions.workspace = true | ||
| tick = { workspace = true, features = ["test-util", "tokio"] } | ||
| tokio = { workspace = true, features = ["rt", "macros"] } | ||
| tracing.workspace = true | ||
| tracing-subscriber = { workspace = true, features = ["fmt", "std"] } | ||
|
|
||
| [[example]] | ||
| name = "timeout" | ||
| required-features = ["timeout"] | ||
|
|
||
| [[example]] | ||
| name = "timeout_advanced" | ||
| required-features = ["timeout"] | ||
|
|
||
| [[example]] | ||
| name = "retry" | ||
| required-features = ["retry"] | ||
|
|
||
| [[example]] | ||
| name = "retry_advanced" | ||
| required-features = ["retry"] | ||
|
|
||
| [[example]] | ||
| name = "retry_outage" | ||
| required-features = ["retry"] | ||
|
|
||
| [[example]] | ||
| name = "resilience_pipeline" | ||
| required-features = ["retry", "timeout"] | ||
|
|
||
| [[example]] | ||
| name = "breaker" | ||
| required-features = ["breaker", "metrics"] | ||
|
|
||
| [[bench]] | ||
| name = "observability" | ||
| harness = false | ||
| required-features = ["retry", "logs", "metrics"] | ||
|
|
||
| [[bench]] | ||
| name = "timeout" | ||
| harness = false | ||
| required-features = ["timeout"] | ||
|
|
||
| [[bench]] | ||
| name = "retry" | ||
| harness = false | ||
| required-features = ["retry"] | ||
|
|
||
| [[bench]] | ||
| name = "breaker" | ||
| harness = false | ||
| required-features = ["breaker"] | ||
|
|
||
| [lints] | ||
| workspace = true | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.