Skip to content

Commit

Permalink
Fixes kuskoman#96, Last_error field isn't properly defined
Browse files Browse the repository at this point in the history
  • Loading branch information
excalq committed Apr 21, 2023
1 parent 4c50660 commit 6292739
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
11 changes: 10 additions & 1 deletion fetcher/responses/__snapshots__/nodestats_response_test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,16 @@ responses.NodeStatsResponse{
},
},
},
Reloads: responses.PipelineReloadResponse{},
Reloads: responses.PipelineReloadResponse{
LastFailureTimestamp: time.Date(2023, time.April, 20, 20, 0, 32, 437218256, time.UTC),
Successes: 3,
Failures: 1,
LastSuccessTimestamp: time.Date(2023, time.April, 20, 22, 30, 32, 437218256, time.UTC),
LastError: responses.LastError{
Message: "No configuration found in the configured sources.",
Backtrace: {"org/logstash/execution/AbstractPipelineExt.java:151:in `reload_pipeline'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:181:in `block in reload_pipeline'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:24:in `block in initialize'"},
},
},
Queue: struct { Type string "json:\"type\""; EventsCount int "json:\"events_count\""; QueueSizeInBytes int "json:\"queue_size_in_bytes\""; MaxQueueSizeInBytes int "json:\"max_queue_size_in_bytes\"" }{Type:"memory", EventsCount:0, QueueSizeInBytes:0, MaxQueueSizeInBytes:0},
Hash: "a73729cc9c29203931db21553c5edba063820a7e40d16cb5053be75cc3811a17",
EphemeralID: "a5c63d09-1ba6-4d67-90a5-075f468a7ab0",
Expand Down
7 changes: 6 additions & 1 deletion fetcher/responses/nodestats_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,12 @@ type PipelineReloadResponse struct {
Successes int `json:"successes"`
Failures int `json:"failures"`
LastSuccessTimestamp *time.Time `json:"last_success_timestamp,omitempty"`
LastError string `json:"last_error,omitempty"`
LastError LastError `json:"last_error,omitempty"`
}

type LastError struct {
Message string `json:"message"`
Backtrace []string `json:"backtrace"`
}

type ReloadResponse struct {
Expand Down
17 changes: 12 additions & 5 deletions fixtures/node_stats.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,18 @@
]
},
"reloads": {
"last_failure_timestamp": null,
"successes": 0,
"failures": 0,
"last_success_timestamp": null,
"last_error": null
"last_failure_timestamp": "2023-04-20T20:00:32.437218256Z",
"successes": 3,
"failures": 1,
"last_success_timestamp": "2023-04-20T22:30:32.437218256Z",
"last_error": {
"message": "No configuration found in the configured sources.",
"backtrace": [
"org/logstash/execution/AbstractPipelineExt.java:151:in `reload_pipeline'",
"/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:181:in `block in reload_pipeline'",
"/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:24:in `block in initialize'"
]
}
},
"queue": {
"type": "memory",
Expand Down

0 comments on commit 6292739

Please sign in to comment.