-
Notifications
You must be signed in to change notification settings - Fork 148
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
Include upgrade details in diagnostics bundle during ongoing upgrade #3624
Changes from all commits
7bc8fc8
b6bd1ea
28ce34f
0ec900a
5682966
ba3e4f7
ff0a038
1730cd9
3cd9f84
b1f368f
f98765d
2f864f0
f7dbb2d
cba774d
f93d5e2
a8aed84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Kind can be one of: | ||
# - breaking-change: a change to previously-documented behavior | ||
# - deprecation: functionality that is being removed in a later release | ||
# - bug-fix: fixes a problem in a previous version | ||
# - enhancement: extends functionality but does not break or fix existing behavior | ||
# - feature: new functionality | ||
# - known-issue: problems that we are aware of in a given version | ||
# - security: impacts on the security of a product or a user’s deployment. | ||
# - upgrade: important information for someone upgrading from a prior version | ||
# - other: does not fit into any of the other categories | ||
kind: enhancement | ||
|
||
# Change summary; a 80ish characters long description of the change. | ||
summary: Include upgrade details in diagnostics bundle. | ||
|
||
# Long description; in case the summary is not enough to describe the change | ||
# this field accommodate a description without length limits. | ||
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment. | ||
#description: | ||
|
||
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc. | ||
component: elastic-agent | ||
|
||
# PR URL; optional; the PR number that added the changeset. | ||
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added. | ||
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number. | ||
# Please provide it if you are adding a fragment for a different PR. | ||
pr: https://github.com/elastic/elastic-agent/pull/3624 | ||
|
||
# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of). | ||
# If not present is automatically filled by the tooling with the issue linked to the PR number. | ||
#issue: https://github.com/owner/repo/1234 |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -791,12 +791,13 @@ func (c *Coordinator) DiagnosticHooks() diagnostics.Hooks { | |||||
State runtime.ComponentState `yaml:"state"` | ||||||
} | ||||||
type StateHookOutput struct { | ||||||
State agentclient.State `yaml:"state"` | ||||||
Message string `yaml:"message"` | ||||||
FleetState agentclient.State `yaml:"fleet_state"` | ||||||
FleetMessage string `yaml:"fleet_message"` | ||||||
LogLevel logp.Level `yaml:"log_level"` | ||||||
Components []StateComponentOutput `yaml:"components"` | ||||||
State agentclient.State `yaml:"state"` | ||||||
Message string `yaml:"message"` | ||||||
FleetState agentclient.State `yaml:"fleet_state"` | ||||||
FleetMessage string `yaml:"fleet_message"` | ||||||
LogLevel logp.Level `yaml:"log_level"` | ||||||
Components []StateComponentOutput `yaml:"components"` | ||||||
UpgradeDetails *details.Details `yaml:"upgrade_details,omitempty"` | ||||||
} | ||||||
|
||||||
s := c.State() | ||||||
|
@@ -809,12 +810,13 @@ func (c *Coordinator) DiagnosticHooks() diagnostics.Hooks { | |||||
} | ||||||
} | ||||||
output := StateHookOutput{ | ||||||
State: s.State, | ||||||
Message: s.Message, | ||||||
FleetState: s.FleetState, | ||||||
FleetMessage: s.FleetMessage, | ||||||
LogLevel: s.LogLevel, | ||||||
Components: compStates, | ||||||
State: s.State, | ||||||
Message: s.Message, | ||||||
FleetState: s.FleetState, | ||||||
FleetMessage: s.FleetMessage, | ||||||
LogLevel: s.LogLevel, | ||||||
Components: compStates, | ||||||
UpgradeDetails: s.UpgradeDetails, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When is this field present? Do we get details about the upgrade after a failure ? Or those get cleared as soon as the grace period is over ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This field is populated when the upgrade process starts: elastic-agent/internal/pkg/agent/application/coordinator/coordinator.go Lines 475 to 476 in 2a93086
Yes, if the upgrade process fails at any point, this field will continue to remain populated.
I assume you are referring to the Upgrade Watcher's grace period. Exactly when we clear it out after that is not yet implemented. We need to decide whether we want to clear it out based on some timeout (maybe the grace period or maybe something even beyond that) or due to some user intervention (which could be retrying the upgrade or something else just to clear the upgrade details, not sure yet) or either (whichever happens first). |
||||||
} | ||||||
o, err := yaml.Marshal(output) | ||||||
if err != nil { | ||||||
|
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 don't see any changes in the tests related to this change... could you please add a unit test to document what we can expect in the hook output when UpgradeDetails is populated ?
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.
Thanks. Added in 02625e8.