-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
UDP inputs now uses human friendly size to define MaxMessageSize #6886
Conversation
libbeat/common/size.go
Outdated
|
||
import "github.com/dustin/go-humanize" | ||
|
||
type Size int64 |
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.
exported type Size should have comment or be unexported
filebeat/input/udp/config.go
Outdated
@@ -3,6 +3,8 @@ package udp | |||
import ( | |||
"time" | |||
|
|||
humanize "github.com/dustin/go-humanize" |
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.
I might be wrong, but AFAIK the prefix "go-" is removed automatically. So you don't need to alias this import.
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.
I really need to fix my editor to stop adding theses.
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.
@kvch Your vim doesn't do that?
@kvch updated |
jenkins test this please |
@kvch don't merge it yet, I have second thoughts about the name, I think It will go with byteSize instead of size it will a bit more explicit. |
filebeat/inputsource/tcp/client.go
Outdated
@@ -18,7 +19,7 @@ type client struct { | |||
done chan struct{} | |||
metadata Metadata | |||
splitFunc bufio.SplitFunc | |||
maxReadMessage size | |||
maxReadMessage common.Size |
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.
Could we rename the variable here to be in line with the config naming? This will make it easier to read the code base.
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.
Will rename it to maxMessageSize
libbeat/common/size.go
Outdated
type Size int64 | ||
|
||
// Unpack convert a size defined from a human readable format into bytes. | ||
func (s *Size) Unpack(value string) error { |
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.
I like this as a temporarely fix to make migration easier. But I would remove it again in 7.0 to only have 1 way to configure the values.
This would mean to when someone uses it without a unit, we should log a deprecation warning.
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.
I am OK to add a deprecation warning.
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.
@ruflin When I tried to use cfgwarn
in that file, I hit aimport cycle not allowed
, to fix that I have either to move theses new common type out of common
OR maybe cfgwarn
out of common and have a backward compatible alias? ...
790363b
to
77d5271
Compare
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.
I would keep the current default of 10KB as a mutline event can reach that limit pretty easily I'm thinking. If we change it, we should add it to the changelog.
Code LGTM.
filebeat/input/udp/config.go
Outdated
@@ -12,7 +14,7 @@ var defaultConfig = config{ | |||
Type: "udp", | |||
}, | |||
Config: udp.Config{ | |||
MaxMessageSize: 10240, | |||
MaxMessageSize: 1 * humanize.KiByte, |
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.
Sorry for the late comment, but I just realised we are changing the default here from 10KB to 1KB?
facepalm
On Thu, Apr 19, 2018 at 5:33 AM Nicolas Ruflin ***@***.***> wrote:
***@***.**** commented on this pull request.
I would keep the current default of 10KB as a mutline event can reach that
limit pretty easily I'm thinking. If we change it, we should add it to the
changelog.
Code LGTM.
------------------------------
In filebeat/input/udp/config.go
<#6886 (comment)>:
> @@ -12,7 +14,7 @@ var defaultConfig = config{
Type: "udp",
},
Config: udp.Config{
- MaxMessageSize: 10240,
+ MaxMessageSize: 1 * humanize.KiByte,
Sorry for the late comment, but I just realised we are changing the
default here from 10KB to 1KB?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#6886 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAACgEmxtYIoqVDiS9fEqpn-7yK5dIFOks5tqFnOgaJpZM4TYneA>
.
--
ph
|
@ruflin all update good catch, waiting for green. |
@@ -29,13 +29,13 @@ The `udp` input supports the following configuration options plus the | |||
[id="{beatname_lc}-input-{type}-max-message-size"] | |||
==== `max_message_size` | |||
|
|||
The maximum size of the message received over UDP. The default is `10240`. | |||
The maximum size of the message received over UDP. The default is `1KiB`. |
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.
@ph I think you forgot the docs. Also see above.
Uses go-humanize to parse values for `MaxMessageSize` and fallback to raw bytes if no suffix is found. Also create a new type for future configuration named `cfgtype.ByteSize` that will take care of correctly unpacking values.
@ruflin I've fixed the docs issue and manually rebased to have a cleaner history. |
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.
WFG
Uses go-humanize to parse values for
MaxMessageSize
and fallback toraw bytes if no suffix is found. Also create a new type for future
configuration named
cfgtype.ByteSize
that will take care of correctlyunpacking values.