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

[Heartbeat] Add nil check to diagnostics processor serializer #35698

Merged
merged 4 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ automatic splitting at root level, if root level element is an array. {pull}3415
- Fix project monitor temp directories permission to include group access. {pull}35398[35398]
- Fix output pipeline exit on run_once. {pull}35376[35376]
- Fix formatting issue with socket trace timeout. {pull}35434[35434]
- Fix serialization of processors when running diagnostics. {pull}35698[35698]

*Heartbeat*

Expand Down
8 changes: 6 additions & 2 deletions libbeat/publisher/processing/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,13 @@ func newBuilder(
// Processors returns a string description of the processor config
func (b *builder) Processors() []string {
procList := []string{}
for _, proc := range b.processors.list {
procList = append(procList, proc.String())

if b.processors != nil {
cmacknz marked this conversation as resolved.
Show resolved Hide resolved
for _, proc := range b.processors.list {
procList = append(procList, proc.String())
}
}

return procList
}

Expand Down
8 changes: 8 additions & 0 deletions libbeat/publisher/processing/default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,14 @@ func TestProcessingClose(t *testing.T) {
assert.True(t, factoryProcessor.closed)
}

func TestProcessingDiagnostics(t *testing.T) {
factory, err := MakeDefaultSupport(true, nil)(beat.Info{}, logp.L(), config.NewConfig())
require.NoError(t, err)

p := factory.Processors()
assert.Empty(t, p)
}

func fromJSON(in string) mapstr.M {
var tmp mapstr.M
err := json.Unmarshal([]byte(in), &tmp)
Expand Down