Skip to content
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

Add option to set rcv_buffer for UDP inputs #9906

Closed
wants to merge 749 commits into from

Conversation

cachedout
Copy link
Contributor

This resolves #9895.

It replaces the previous use of ListenPacket with a plain UDP listener. However, the upstream interface is the same and this continues to pass the inputsource tests for UDP.

This does not include additional testing and intentionally bypasses the logic for setting the socket option during test. If tests for this are desireable, I'm happy to write some.

@cachedout cachedout requested a review from a team as a code owner January 4, 2019 23:13
@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@urso urso requested a review from ph January 5, 2019 15:05
Copy link
Contributor

@ph ph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cachedout for the PR, code looks fine only minor changes. Also can you update the documentation and also the YAML files to mention the new option? You will need to run make update to propagate the changes and commit the changes to this PR.

if socketSize != 0 {
err = u.Listener.SetReadBuffer(socketSize)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the SetReadBuffer documentation it accepts the number of bytes, the cfgtype.Bytes is already the number of bytes set as a int64, so you only need to convert it to int.

Also, it's a good pratice in go to handle the error right away, I am suggesting the following changes:

udpAdddr, err := net.ResolveUDPAddr("udp", u.config.Host)
if err != nil {
    return err
}

u.Listener, err = net.ListenUDP("udp", udpAdddr)
if err != nil {
    return err
}

if socketSize != 0 {
	if err := u.Listener.SetReadBuffer(int(u.config.ReadBuffer)); err != nil {
        return err
    }

}

@@ -35,7 +35,8 @@ var defaultConfig = config{
// TODO: What should be default port?
Host: "localhost:8080",
// TODO: What should be the default timeout?
Timeout: time.Minute * 5,
Timeout: time.Minute * 5,
ReadBuffer: 0 * humanize.KiByte,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to set a default value since intX are set to 0 by default.

@ph
Copy link
Contributor

ph commented Jan 9, 2019

@cachedout Also make sure to run make check to make sure that the changes follow the style guide, you can fix most of the errors using the make fmt command.

And you need to add a changelog entry to the CHANGELOG at https://github.com/elastic/beats/blob/master/CHANGELOG.next.asciidoc

Carmelo Mirko Musumeci and others added 23 commits March 5, 2019 14:29
…kia module (elastic#11014)

Jolokia module was creating a new HTTP helper for each request, what
was leading to leaks under some scenarios. Make it reuse connections.
)

A number of fields in our `fields.yml` files now are `type: ip` (e.g. `source.ip`) and `type: boolean`, but the code generating index patterns does not know about these types yet and so does not add a `type` to the index pattern for those fields at all. This leads to errors in Kibana when looking at dashboards that contain references to those fields.
Migrate golang/heap to reporterV2 interface
Checks if given field conflicts with current fields. Fixes an error where `append_fields` could not add valid field.
The old docs weren't updated when 0dbb695 was merged.

This corrects them, indicating how we handle 4xx and 5xx HTTP codes
Bug fix was missing an entry in CHANGELOG.next
* fix pr review link

* recommend same Go version for dev, test and release. Fixes elastic#11069

* recommend cloning by SSH rather than HTTPS

* Revert "recommend cloning by SSH rather than HTTPS"

This reverts commit a435586.
This change is based on elastic#10648 to migrate to golden files instead of the dynamically generated data files.

This adds also support for query params to the testing framework.
…c#10945)

This PR adds support for loading custom (enterprise-specific) fields to the 
Filebeat NetFlow input. These fields can extend and/or override fields in
NetFlow V9 and IPFIX.

For compatibility, the feature uses the same field definition YAML format
as Logstash's netflow codec plugin.

A new configuration option custom_definitions consists of a list of paths
to definition files.
Currently each Metricset initialises its own logger. The selector has to be set manually. This PR moves this code to the initialisation of the Metricset, meaning each metricset has its own logger. This should reduce the code needed in each Metricset and removes errors like putting a wrong or inconsistent selectors.

It's different from before where there was a global logger for all instances of the same metricset and now each metricset instance has it's own logger. This should not make a difference.

As an example implementation the `system.fsstat` metricset was adjusted.
Prometheus histograms can contain buckets with keys in decimal
representation. They create events with dots in the field names, what
can be problematic when stored in Elasticsearch as they will create
sub-objects.

Add a new option to allow to store these keys in different units, so
precission is kept but in a different order of magnitude.
* Migrate golang/expvar to ReporterV2
This is intended to have a guide for users that want to test for example the Infra UI with some modules and have example containers available.
* Change number_of_objects to float in schema

* Change number_of_objects type to scaled_float
In Metricbeat modules we often see the pattern that before fetching the actual data, some processing is done and checks for errors happen. If an error happened, we have 3 lines of code:

* creating the error with wrap
* reporting the error
* logging the error

By introducing the reporter interface with support for return an error I would like to eliminate the overhead and allow to directly return and error which is then reported and also logged.

So far we logged the error on the Error level. I'm now wondering if we should log these errors actually on the Info level as it's normally not a misbehaving of the Beat but the service does not respond as expected. So for the operator of the Beat normally no actions are needed.

As an example metricset I took php_fpm.process.
* Add support in jolokia get response for single value

* Use reflect.TypeOf to check attribute and value type

* Add changelog

* Replace reflect by type switching

* Fix indentation for comments
return dashboardCmd()
if kibanaURL != "" {
return dashboardCmd("-kibana", kibanaURL)
} else {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if block ends with a return statement, so drop this else and outdent its block

return dashboardCmd()
if kibanaURL != "" {
return dashboardCmd("-kibana", kibanaURL)
} else {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if block ends with a return statement, so drop this else and outdent its block

OverwritePipelines bool `config:"overwrite_pipelines"`
}

type Registry struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type Registry should have comment or be unexported

OverwritePipelines bool `config:"overwrite_pipelines"`
}

type Registry struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type Registry should have comment or be unexported

OverwritePipelines bool `config:"overwrite_pipelines"`
}

type Registry struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type Registry should have comment or be unexported

@@ -44,3 +44,4 @@ func (p Pipe) Name() string { return p.File.Name() }
func (p Pipe) Stat() (os.FileInfo, error) { return p.File.Stat() }
func (p Pipe) Continuable() bool { return false }
func (p Pipe) HasState() bool { return false }
func (p Pipe) Removed() bool { return false }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method Pipe.Removed should have comment or be unexported


type File struct {
*os.File
}

func (File) Continuable() bool { return true }
func (File) HasState() bool { return true }
func (f File) Removed() bool { return file.IsRemoved(f.File) }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method File.Removed should have comment or be unexported

@@ -44,3 +44,4 @@ func (p Pipe) Name() string { return p.File.Name() }
func (p Pipe) Stat() (os.FileInfo, error) { return p.File.Stat() }
func (p Pipe) Continuable() bool { return false }
func (p Pipe) HasState() bool { return false }
func (p Pipe) Removed() bool { return false }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method Pipe.Removed should have comment or be unexported


type File struct {
*os.File
}

func (File) Continuable() bool { return true }
func (File) HasState() bool { return true }
func (f File) Removed() bool { return file.IsRemoved(f.File) }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method File.Removed should have comment or be unexported

@@ -31,6 +31,7 @@ import (
"github.com/elastic/beats/libbeat/logp"

"github.com/elastic/beats/journalbeat/config"
_ "github.com/elastic/beats/journalbeat/include"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a blank import should be only in a main or test package, or have a comment justifying it

@@ -31,6 +31,7 @@ import (
"github.com/elastic/beats/libbeat/logp"

"github.com/elastic/beats/journalbeat/config"
_ "github.com/elastic/beats/journalbeat/include"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a blank import should be only in a main or test package, or have a comment justifying it

@@ -31,6 +31,7 @@ import (
"github.com/elastic/beats/libbeat/logp"

"github.com/elastic/beats/journalbeat/config"
_ "github.com/elastic/beats/journalbeat/include"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a blank import should be only in a main or test package, or have a comment justifying it

"github.com/elastic/beats/libbeat/paths"
"github.com/elastic/beats/libbeat/template"
)

func GenTemplateConfigCmd(settings instance.Settings, name, idxPrefix, beatVersion string) *cobra.Command {
func GenTemplateConfigCmd(settings instance.Settings) *cobra.Command {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function GenTemplateConfigCmd should have comment or be unexported

"github.com/elastic/beats/libbeat/paths"
"github.com/elastic/beats/libbeat/template"
)

func GenTemplateConfigCmd(settings instance.Settings, name, idxPrefix, beatVersion string) *cobra.Command {
func GenTemplateConfigCmd(settings instance.Settings) *cobra.Command {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function GenTemplateConfigCmd should have comment or be unexported

"github.com/elastic/beats/libbeat/paths"
"github.com/elastic/beats/libbeat/template"
)

func GenTemplateConfigCmd(settings instance.Settings, name, idxPrefix, beatVersion string) *cobra.Command {
func GenTemplateConfigCmd(settings instance.Settings) *cobra.Command {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function GenTemplateConfigCmd should have comment or be unexported

"github.com/elastic/beats/libbeat/outputs"
"github.com/elastic/beats/libbeat/testing"
)

func GenTestOutputCmd(name, beatVersion string) *cobra.Command {
func GenTestOutputCmd(settings instance.Settings) *cobra.Command {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function GenTestOutputCmd should have comment or be unexported

@@ -27,18 +27,18 @@ import (
"github.com/elastic/beats/libbeat/cmd/instance"
)

func GenTestConfigCmd(name, version string, beatCreator beat.Creator) *cobra.Command {
func GenTestConfigCmd(settings instance.Settings, beatCreator beat.Creator) *cobra.Command {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function GenTestConfigCmd should have comment or be unexported

return c.access().Remove(name, idx, configOpts...)
}

func (c *Config) Has(name string, idx int) (bool, error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method Config.Has should have comment or be unexported

@@ -188,6 +188,14 @@ func (c *Config) PathOf(field string) string {
return c.access().PathOf(field, ".")
}

func (c *Config) Remove(name string, idx int) (bool, error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method Config.Remove should have comment or be unexported

"github.com/elastic/beats/libbeat/outputs"
"github.com/elastic/beats/libbeat/testing"
)

func GenTestOutputCmd(name, beatVersion string) *cobra.Command {
func GenTestOutputCmd(settings instance.Settings) *cobra.Command {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function GenTestOutputCmd should have comment or be unexported

@@ -27,18 +27,18 @@ import (
"github.com/elastic/beats/libbeat/cmd/instance"
)

func GenTestConfigCmd(name, version string, beatCreator beat.Creator) *cobra.Command {
func GenTestConfigCmd(settings instance.Settings, beatCreator beat.Creator) *cobra.Command {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function GenTestConfigCmd should have comment or be unexported

})
}

func ScopedIsUnique() UniqScopeTracker {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function ScopedIsUnique should have comment or be unexported

return c.access().Remove(name, idx, configOpts...)
}

func (c *Config) Has(name string, idx int) (bool, error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method Config.Has should have comment or be unexported

@@ -188,6 +188,14 @@ func (c *Config) PathOf(field string) string {
return c.access().PathOf(field, ".")
}

func (c *Config) Remove(name string, idx int) (bool, error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method Config.Remove should have comment or be unexported

@cachedout cachedout closed this Apr 10, 2019
@cachedout
Copy link
Contributor Author

Guh. That rebase went horribly wrong.

@@ -30,6 +31,8 @@ import (
var Version = "9.9.9"
var Name = "mockbeat"

var Settings = instance.Settings{Name: Name, Version: Version}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported var Settings should have comment or be unexported

return false
}

// Recursively generates the correct key based on the dots

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment on exported function GenerateKey should be of the form "GenerateKey ..."

return nil
}

func LoadFieldsYaml(path string) (Fields, error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function LoadFieldsYaml should have comment or be unexported


type DynamicType struct{ Value interface{} }

func (d *DynamicType) Unpack(s string) error {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method DynamicType.Unpack should have comment or be unexported

Value string `config:"value"`
}

type DynamicType struct{ Value interface{} }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type DynamicType should have comment or be unexported

// -ElasticSearch Template
// -Kibana Index Pattern

type Fields []Field

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type Fields should have comment or be unexported

@@ -24,7 +24,7 @@ import (
"github.com/elastic/beats/libbeat/mock"
)

var RootCmd = cmd.GenRootCmd(mock.Name, mock.Version, mock.New)
var RootCmd = cmd.GenRootCmdWithSettings(mock.New, mock.Settings)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported var RootCmd should have comment or be unexported

@@ -217,32 +217,24 @@ func (client *Client) readVersion() error {

code, result, err := client.Connection.Request("GET", "/api/status", nil, nil, nil)
if err != nil || code >= 400 {
return fmt.Errorf("HTTP GET request to /api/status fails: %v. Response: %s.",
err, truncateString(result))
return fmt.Errorf("HTTP GET request to %s/api/status fails: %v. Response: %s.",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error strings should not be capitalized or end with punctuation or a newline

}

var (
ErrESVersionNotSupported = errors.New("ILM is not supported by the Elasticsearch version in use")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported var ErrESVersionNotSupported should have comment or be unexported

} else {
importVia = useKibana
}
return errors.New("kibana configuration missing for loading dashboards.")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error strings should not be capitalized or end with punctuation or a newline


// WithBeatMeta adds beat meta information as builtin fields to a processing pipeline.
// The `key` parameter defines the field to be used.
func WithBeatMeta(key string) modifier {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported func WithBeatMeta returns unexported type processing.modifier, which can be annoying to use

}

// WithECS modifier adds `ecs.version` builtin fields to a processing pipeline.
var WithECS modifier = WithFields(common.MapStr{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should omit type modifier from declaration of var WithECS; it will be inferred from the right-hand side

}

// WithFields creates a modifier with the given default builtin fields.
func WithFields(fields common.MapStr) modifier {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported func WithFields returns unexported type processing.modifier, which can be annoying to use

@@ -96,22 +100,22 @@ func TestFetchEventContents(t *testing.T) {
assert.EqualValues(t, 2872860672, pgInfo["used_bytes"])

//check pg_state info
pg_stateInfo := events[1]["pg_state"].(common.MapStr)
pg_stateInfo := events[1].MetricSetFields["pg_state"].(common.MapStr)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use underscores in Go names; var pg_stateInfo should be pgStateInfo

}, nil
}

func (m *MetricSet) Fetch() ([]common.MapStr, error) {
func (m *MetricSet) Fetch(reporter mb.ReporterV2) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method MetricSet.Fetch should have comment or be unexported

@@ -96,22 +100,22 @@ func TestFetchEventContents(t *testing.T) {
assert.EqualValues(t, 2872860672, pgInfo["used_bytes"])

//check pg_state info
pg_stateInfo := events[1]["pg_state"].(common.MapStr)
pg_stateInfo := events[1].MetricSetFields["pg_state"].(common.MapStr)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use underscores in Go names; var pg_stateInfo should be pgStateInfo

}, nil
}

func (m *MetricSet) Fetch() ([]common.MapStr, error) {
func (m *MetricSet) Fetch(reporter mb.ReporterV2) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method MetricSet.Fetch should have comment or be unexported

@@ -96,22 +100,22 @@ func TestFetchEventContents(t *testing.T) {
assert.EqualValues(t, 2872860672, pgInfo["used_bytes"])

//check pg_state info
pg_stateInfo := events[1]["pg_state"].(common.MapStr)
pg_stateInfo := events[1].MetricSetFields["pg_state"].(common.MapStr)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use underscores in Go names; var pg_stateInfo should be pgStateInfo

}, nil
}

func (m *MetricSet) Fetch() ([]common.MapStr, error) {
func (m *MetricSet) Fetch(reporter mb.ReporterV2) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method MetricSet.Fetch should have comment or be unexported

}

// LoginRecord represents a login record.
type LoginRecord struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type name will be used as login.LoginRecord by other packages, and that stutters; consider calling this Record


UT_LINESIZE = 32
UT_NAMESIZE = 32
UT_HOSTSIZE = 256

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

ACCOUNTING UtType = 9

UT_LINESIZE = 32
UT_NAMESIZE = 32

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

DEAD_PROCESS UtType = 8
ACCOUNTING UtType = 9

UT_LINESIZE = 32

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

INIT_PROCESS UtType = 5
LOGIN_PROCESS UtType = 6
USER_PROCESS UtType = 7
DEAD_PROCESS UtType = 8

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

OLD_TIME UtType = 4
INIT_PROCESS UtType = 5
LOGIN_PROCESS UtType = 6
USER_PROCESS UtType = 7

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

RUN_LVL UtType = 1
BOOT_TIME UtType = 2
NEW_TIME UtType = 3
OLD_TIME UtType = 4

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

EMPTY UtType = 0
RUN_LVL UtType = 1
BOOT_TIME UtType = 2
NEW_TIME UtType = 3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

const (
EMPTY UtType = 0
RUN_LVL UtType = 1
BOOT_TIME UtType = 2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

// Possible values for UtType.
const (
EMPTY UtType = 0
RUN_LVL UtType = 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

}

// LoginRecord represents a login record.
type LoginRecord struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type name will be used as login.LoginRecord by other packages, and that stutters; consider calling this Record

// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package transaction_log

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use an underscore in package name


// +build integration

package s3_request

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use an underscore in package name

// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package s3_request

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use an underscore in package name

// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package s3_request

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use an underscore in package name


// +build integration

package s3_daily_storage

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use an underscore in package name

@@ -322,6 +323,34 @@ func (u UnsupportedDecoder) Decode(data []byte) (interface{}, error) {

var _ Decoder = (*UnsupportedDecoder)(nil)

type ACLIDDecoder struct{}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type ACLIDDecoder should have comment or be unexported

@@ -20,12 +20,20 @@ type Field struct {

type FieldDict map[Key]*Field

func RegisterFields(dict FieldDict) error {
func RegisterGlobalFields(dict FieldDict) error {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function RegisterGlobalFields should have comment or be unexported

@@ -6,7 +6,7 @@ package fields

import "fmt"

var Fields = FieldDict{}
var GlobalFields = FieldDict{}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported var GlobalFields should have comment or be unexported

@@ -170,6 +172,15 @@ func (user User) toMapStr() common.MapStr {
return evt
}

// entityID creates an ID that uniquely identifies this user across machines.
func (u User) entityID(hostID string) string {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

receiver name u should be consistent with previous receiver name user for User

}

// SystemMetricSet extends the Metricbeat BaseMetricSet.
type SystemMetricSet struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type name will be used as system.SystemMetricSet by other packages, and that stutters; consider calling this MetricSet


// SystemModule extends the Metricbeat BaseModule. The purpose is to allow
// configuring sub-modules as "datasets" rather than "metricsets".
type SystemModule struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type name will be used as system.SystemModule by other packages, and that stutters; consider calling this Module

}

// SystemModuleConfig contains the configuration specific to the system module.
type SystemModuleConfig struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type name will be used as system.SystemModuleConfig by other packages, and that stutters; consider calling this ModuleConfig

RPMTAG_URL = 1020
RPMTAG_ARCH = 1022
RPMTAG_SIZE = 1009
RPMTAG_INSTALLTIME = 1008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

RPMTAG_LICENSE = 1014
RPMTAG_URL = 1020
RPMTAG_ARCH = 1022
RPMTAG_SIZE = 1009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

RPMTAG_SUMMARY = 1004
RPMTAG_LICENSE = 1014
RPMTAG_URL = 1020
RPMTAG_ARCH = 1022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

const (
RPMTAG_NAME = 1000
RPMTAG_VERSION = 1001
RPMTAG_RELEASE = 1002

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

// Constants in sync with /usr/include/rpm/rpmtag.h
const (
RPMTAG_NAME = 1000
RPMTAG_VERSION = 1001

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase


// Constants in sync with /usr/include/rpm/rpmtag.h
const (
RPMTAG_NAME = 1000

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase


// +build integration

package transaction_log

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use an underscore in package name

// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package transaction_log

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use an underscore in package name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Filebeat/udp] Add a way to set SO_RCVBUF