-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Cleanup summarizer code * Separate concerns in summarizer * Checkpoint * Fix failing tests * FMT * Tweaks * Make linter happy * progress * cleanup docs * Bring back wrappers tests (partial) * Restore wrapper tests * Fix failing tests * Fix err handling * Re-init plugins on retry * Fix error field handling across retries * Incorporate PR feedback * Type fix * URLs now work, tests passing * Improved err handling * Test fixes * Cleanup naming * Fix handling of step counts / journey/end missing and also fix continuity test * Fix failing tests around logging / logging behavior * Rename OnRetry to BeforeRetry * Move monitor.status calculation for browsers into summarizer * Cleanup status logic * More status consolidation * Fixed failing tests * Make monitor logger errors more understandable * Fix retry delay * Fix retry delay * Remove spurious 'wrapped:' in logs * Incorporate pr feedback * Fix dur * Fix cmd status * Fix tests * Fmt * Integrate PR feedback --------- Co-authored-by: Vignesh Shanmugam <[email protected]>
- Loading branch information
1 parent
aa5b983
commit ccfa54a
Showing
38 changed files
with
1,033 additions
and
632 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
heartbeat/monitors/wrappers/summarizer/jobsummary/jobsummary.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Licensed to Elasticsearch B.V. under one or more contributor | ||
// license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright | ||
// ownership. Elasticsearch B.V. licenses this file to you under | ||
// the Apache License, Version 2.0 (the "License"); you may | ||
// not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package jobsummary | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/elastic/beats/v7/heartbeat/monitors/wrappers/monitorstate" | ||
) | ||
|
||
// JobSummary is the struct that is serialized in the `summary` field in the emitted event. | ||
type JobSummary struct { | ||
Attempt uint16 `json:"attempt"` | ||
MaxAttempts uint16 `json:"max_attempts"` | ||
FinalAttempt bool `json:"final_attempt"` | ||
Up uint16 `json:"up"` | ||
Down uint16 `json:"down"` | ||
Status monitorstate.StateStatus `json:"status"` | ||
RetryGroup string `json:"retry_group"` | ||
} | ||
|
||
func NewJobSummary(attempt uint16, maxAttempts uint16, retryGroup string) *JobSummary { | ||
if maxAttempts < 1 { | ||
maxAttempts = 1 | ||
} | ||
|
||
return &JobSummary{ | ||
MaxAttempts: maxAttempts, | ||
Attempt: attempt, | ||
RetryGroup: retryGroup, | ||
} | ||
} | ||
|
||
// BumpAttempt swaps the JobSummary object's pointer for a new job summary | ||
// that is a clone of the current one but with the Attempt field incremented. | ||
func (js *JobSummary) BumpAttempt() { | ||
*js = *NewJobSummary(js.Attempt+1, js.MaxAttempts, js.RetryGroup) | ||
} | ||
|
||
func (js *JobSummary) String() string { | ||
return fmt.Sprintf("<JobSummary status=%s attempt=%d/%d, final=%t, up=%d/%d retryGroup=%s>", js.Status, js.Attempt, js.MaxAttempts, js.FinalAttempt, js.Up, js.Down, js.RetryGroup) | ||
} |
Oops, something went wrong.