|
| 1 | +# Example demonstrating the new unified RateSpec for throttle configuration |
| 2 | +# |
| 3 | +# RateSpec allows you to specify rates in two ways: |
| 4 | +# 1. bytes: Rate specified in bytes per second (e.g., "1 MiB") |
| 5 | +# 2. blocks: Rate specified in blocks per second (integer count) |
| 6 | +# |
| 7 | +# Both can be used with: |
| 8 | +# - stable: Fixed rate throttling |
| 9 | +# - linear: Linearly increasing rate throttling |
| 10 | +# - all_out: No throttling (doesn't use RateSpec) |
| 11 | +# |
| 12 | +# BACKWARD COMPATIBILITY: |
| 13 | +# The parser supports the legacy BytesThrottleConfig format: |
| 14 | +# - For stable: bytes_per_second can be specified directly or as a rate struct |
| 15 | +# - For linear: Both old field names (initial_bytes_per_second, maximum_bytes_per_second) |
| 16 | +# and new field names (initial, maximum) are supported |
| 17 | +# - For linear: rate_of_change works in both formats |
| 18 | +# - Legacy format accepts direct Byte values (e.g., "10 MiB") which are automatically |
| 19 | +# converted to bytes-based RateSpec |
| 20 | + |
| 21 | +generator: |
| 22 | + # Example 1: HTTP generator with stable byte-based throttling |
| 23 | + # This is the most common use case - controlling throughput in bytes per second |
| 24 | + - http: |
| 25 | + seed: [2, 3, 5, 7, 11, 13, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137] |
| 26 | + target_uri: "http://localhost:8080/logs" |
| 27 | + method: |
| 28 | + post: |
| 29 | + variant: |
| 30 | + ascii: |
| 31 | + length: |
| 32 | + inclusive: |
| 33 | + min: 100 |
| 34 | + max: 500 |
| 35 | + maximum_prebuild_cache_size_bytes: "128 MiB" |
| 36 | + headers: |
| 37 | + "Content-Type": "application/json" |
| 38 | + parallel_connections: 10 |
| 39 | + maximum_block_size: "1 MiB" |
| 40 | + # Stable throttle with byte-based rate |
| 41 | + throttle: |
| 42 | + stable: |
| 43 | + bytes_per_second: "10 MiB" |
| 44 | + timeout_millis: 100 |
| 45 | + |
| 46 | + # Example 2: TCP generator with stable block-based throttling |
| 47 | + # Useful when you want to control the number of messages/blocks per second |
| 48 | + # rather than total byte throughput |
| 49 | + - tcp: |
| 50 | + seed: [2, 3, 5, 7, 11, 13, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137] |
| 51 | + addr: "0.0.0.0:8282" |
| 52 | + variant: |
| 53 | + json: |
| 54 | + max_depth: 3 |
| 55 | + max_width: 5 |
| 56 | + length: |
| 57 | + inclusive: |
| 58 | + min: 50 |
| 59 | + max: 200 |
| 60 | + maximum_prebuild_cache_size_bytes: "256 MiB" |
| 61 | + # Stable throttle with block-based rate |
| 62 | + # This will send exactly 1000 blocks (messages) per second, |
| 63 | + # regardless of their individual sizes |
| 64 | + throttle: |
| 65 | + stable: |
| 66 | + blocks_per_second: 1000 |
| 67 | + timeout_millis: 0 |
| 68 | + |
| 69 | + # Example 3: HTTP generator with linear byte-based throttling |
| 70 | + # Starts at a low rate and gradually increases to maximum |
| 71 | + - http: |
| 72 | + seed: [2, 3, 5, 7, 11, 13, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137] |
| 73 | + target_uri: "http://localhost:8080/metrics" |
| 74 | + method: |
| 75 | + post: |
| 76 | + variant: |
| 77 | + dogstatsd: |
| 78 | + contexts: |
| 79 | + constant: 1000 |
| 80 | + name_length: |
| 81 | + inclusive: |
| 82 | + min: 10 |
| 83 | + max: 50 |
| 84 | + tag_length: |
| 85 | + inclusive: |
| 86 | + min: 5 |
| 87 | + max: 30 |
| 88 | + tags_per_msg: |
| 89 | + inclusive: |
| 90 | + min: 2 |
| 91 | + max: 10 |
| 92 | + kind_weights: |
| 93 | + metric: 95 |
| 94 | + event: 3 |
| 95 | + service_check: 2 |
| 96 | + metric_weights: |
| 97 | + count: 50 |
| 98 | + gauge: 30 |
| 99 | + timer: 10 |
| 100 | + distribution: 5 |
| 101 | + set: 3 |
| 102 | + histogram: 2 |
| 103 | + maximum_prebuild_cache_size_bytes: "512 MiB" |
| 104 | + headers: |
| 105 | + "Content-Type": "text/plain" |
| 106 | + parallel_connections: 5 |
| 107 | + maximum_block_size: "2 MiB" |
| 108 | + # Linear throttle with byte-based rate |
| 109 | + # Starts at 1 MiB/s, increases by 500 KiB/s every second, up to 50 MiB/s |
| 110 | + throttle: |
| 111 | + linear: |
| 112 | + initial: |
| 113 | + bytes_per_second: "1 MiB" |
| 114 | + maximum: |
| 115 | + bytes_per_second: "50 MiB" |
| 116 | + rate_of_change: |
| 117 | + bytes_per_second: "500 KiB" |
| 118 | + |
| 119 | + # Example 4: TCP generator with linear block-based throttling |
| 120 | + # Gradually ramps up the number of blocks sent per second |
| 121 | + - tcp: |
| 122 | + seed: [2, 3, 5, 7, 11, 13, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137] |
| 123 | + addr: "0.0.0.0:8383" |
| 124 | + variant: "syslog5424" |
| 125 | + maximum_prebuild_cache_size_bytes: "128 MiB" |
| 126 | + # Linear throttle with block-based rate |
| 127 | + # Starts at 100 blocks/sec, increases by 50 blocks/sec every second, |
| 128 | + # up to 5000 blocks/sec |
| 129 | + throttle: |
| 130 | + linear: |
| 131 | + initial: |
| 132 | + blocks_per_second: 100 |
| 133 | + maximum: |
| 134 | + blocks_per_second: 5000 |
| 135 | + rate_of_change: |
| 136 | + blocks_per_second: 50 |
| 137 | + |
| 138 | + # Example 5: TCP generator with LEGACY linear throttle format (backward compatible) |
| 139 | + # This demonstrates backward compatibility with the old BytesThrottleConfig format |
| 140 | + # which used direct Byte values with different field names |
| 141 | + - tcp: |
| 142 | + seed: [2, 3, 5, 7, 11, 13, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137] |
| 143 | + addr: "0.0.0.0:8585" |
| 144 | + variant: "syslog5424" |
| 145 | + maximum_prebuild_cache_size_bytes: "128 MiB" |
| 146 | + # Legacy format with old field names |
| 147 | + throttle: |
| 148 | + linear: |
| 149 | + initial_bytes_per_second: "500 KiB" |
| 150 | + maximum_bytes_per_second: "10 MiB" |
| 151 | + rate_of_change: "100 KiB" |
| 152 | + |
| 153 | + # Example 6: UDP generator with all-out throttling (no rate limiting) |
| 154 | + # This doesn't use RateSpec - just sends as fast as possible |
| 155 | + - udp: |
| 156 | + seed: [2, 3, 5, 7, 11, 13, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137] |
| 157 | + addr: "0.0.0.0:8484" |
| 158 | + variant: |
| 159 | + ascii: |
| 160 | + length: |
| 161 | + inclusive: |
| 162 | + min: 64 |
| 163 | + max: 256 |
| 164 | + maximum_prebuild_cache_size_bytes: "64 MiB" |
| 165 | + throttle: |
| 166 | + all_out |
| 167 | + |
| 168 | +blackhole: |
| 169 | + - http: |
| 170 | + binding_addr: "0.0.0.0:8080" |
| 171 | + - tcp: |
| 172 | + binding_addr: "0.0.0.0:8282" |
| 173 | + - tcp: |
| 174 | + binding_addr: "0.0.0.0:8383" |
| 175 | + - tcp: |
| 176 | + binding_addr: "0.0.0.0:8585" |
| 177 | + - udp: |
| 178 | + binding_addr: "0.0.0.0:8484" |
| 179 | + |
0 commit comments