forked from samcamwilliams/HyperBEAM
-
Notifications
You must be signed in to change notification settings - Fork 81
router-perf@1.0 — Erlang Execution Device for Performance-Based Routing
#741
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
Closed
Closed
Changes from 17 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
e478858
wip: permissionless data serving to Arweave API routers
samcamwilliams 6d5b0d8
feat: add admissibility checking for permissionless TX serving
Lucifer0x17 04b0208
fix: use content hash for TX admissibility instead of commitment IDs
Lucifer0x17 e9d884b
feat: support commitment-based ID check in is_tx_admissible
Lucifer0x17 2beba64
fix: correct way to verify while checking is_admissible
Lucifer0x17 c491dfd
feat: enable hooks so that node can sign when vouching for a tx
Lucifer0x17 c0e7e1e
fix: test to use http rather than get_tx
Lucifer0x17 bdef149
fix: simplify is_tx_admissible to check TXID membership in commitment…
Lucifer0x17 efc2397
feat: add router-perf@1.0 Erlang execution device for performance-bas…
Lucifer0x17 9d06e75
feat: add integration test for router-perf@1.0 and clean up device code
Lucifer0x17 dba1bd3
fix: calculating the weights post req
Lucifer0x17 54e1f72
Revert "fix: calculating the weights post req"
Lucifer0x17 e8b83a6
test: added test for load balancing on gateways
Lucifer0x17 0240c01
feat: add monitor-sampler@1.0 device for probabilistic sampling
Lucifer0x17 cab75a7
feat: register monitor-sampler@1.0 in preloaded devices
Lucifer0x17 f09b555
feat: integrate monitor sampling and path sanitization in http_client
Lucifer0x17 4534e66
impr: right key for acrion
Lucifer0x17 f11f3d3
feat: support nested hook names via deep_get in dev_hook
Lucifer0x17 6ff9118
feat: add generic chance@1.0 gate device, replace monitor-sampler
Lucifer0x17 863fca7
feat: replace custom monitor code with hook-based architecture
Lucifer0x17 bfc8833
refactor: migrate tests from http_monitor to hook-based config
Lucifer0x17 07b49bb
refactor: move tx admissibility logic from generic request/5 into get_tx
Lucifer0x17 16fe749
Merge branch 'impr/gun' of https://github.com/permaweb/HyperBEAM into…
Lucifer0x17 8e6a4bd
feat: add HTTP redirect following in hb_http_client
Lucifer0x17 0500f4a
Merge pull request #771 from permaweb/merge/gun-monitor
Lucifer0x17 1e23ffe
Revert "feat: add HTTP redirect following in hb_http_client"
Lucifer0x17 28c76b3
Merge branch 'neo/edge' of https://github.com/permaweb/HyperBEAM into…
Lucifer0x17 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| -module(dev_monitor_sampler). | ||
| -export([info/1, should_sample/3]). | ||
| -include("include/hb.hrl"). | ||
|
|
||
|
|
||
| %%% A lightweight device that gates HTTP monitor invocations via probabilistic | ||
| %%% sampling. When `sample-rate` is set to N in the monitor config, only | ||
| %%% ~1-in-N requests will be forwarded. If absent, every request is forwarded. | ||
|
|
||
| info(_Base) -> | ||
| #{default => fun should_sample/3}. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default should be... |
||
|
|
||
| should_sample(_Base, Req, Opts) -> | ||
| ?event({req, Req}), | ||
| case hb_maps:get(<<"sample-rate">>, Req, not_found, Opts) of | ||
| not_found -> | ||
| {ok, true}; | ||
| Rate when is_integer(Rate), Rate > 0 -> | ||
| {ok, rand:uniform(Rate) =:= 1}; | ||
| _Other -> | ||
| {ok, true} | ||
| end. | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
rawpath unfortunately doesn't emit the user's message as-is, so I don't think this change can work/is needed?