Commit 4c0ea5c
MemoryLimiter extension as an http/grpc middleware (#14071)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This PR augments the memorylimiter extension to be an HTTP/GRPC
middleware. The extension can be used as an HTTP/GRPC middleware once
this is merged.
Example:
```
receivers:
otlp:
protocols:
grpc:
middlewares:
- id: memory_limiter
http:
middlewares:
- id: memory_limiter
extensions:
memory_limiter:
check_interval: 1s
limit_percentage: 1
spike_limit_percentage: 0.05
..........
```
<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes #9591
Fixes #14081
<!--Describe what testing was performed and which tests were added.-->
#### Testing
Setup a minimal collector to test that the middleware is indeed
ratelimiting while the memory usage is closer to limit.
```
receivers:
otlp:
protocols:
grpc:
middlewares:
- id: memory_limiter
http:
middlewares:
- id: memory_limiter
processors:
exporters:
debug:
verbosity: detailed
sampling_initial: 5
sampling_thereafter: 200
use_internal_logger: false
extensions:
memory_limiter:
check_interval: 1s
limit_percentage: 1 # this is the minimum possible, since it's an integer.
spike_limit_percentage: 0.05
service:
extensions:
- memory_limiter
pipelines:
metrics:
receivers: [otlp]
processors: []
exporters: [debug]
traces:
receivers: [otlp]
processors: []
exporters: [debug]
logs:
receivers: [otlp]
processors: []
exporters: [debug]
telemetry:
logs:
level: debug
development: false
disable_caller: false
disable_stacktrace: false
```
#### Documentation
Updated the readme for memory limiter extension.
---------
Co-authored-by: Bogdan Drutu <[email protected]>
Co-authored-by: Joshua MacDonald <[email protected]>1 parent b31ddb9 commit 4c0ea5c
File tree
6 files changed
+101
-2
lines changed- .chloggen
- cmd/otelcorecol
- extension/memorylimiterextension
6 files changed
+101
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
18 | 41 | | |
19 | 42 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| 55 | + | |
53 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
54 | 60 | | |
55 | 61 | | |
56 | 62 | | |
| |||
71 | 77 | | |
72 | 78 | | |
73 | 79 | | |
| 80 | + | |
| 81 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
| 16 | + | |
12 | 17 | | |
13 | 18 | | |
14 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
15 | 25 | | |
16 | 26 | | |
17 | 27 | | |
| |||
38 | 48 | | |
39 | 49 | | |
40 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
0 commit comments