-
Notifications
You must be signed in to change notification settings - Fork 100
Make action optional when upgrade details are provided #5609
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
base: main
Are you sure you want to change the base?
Changes from all commits
f8a4a2c
6331a01
e455769
e5e9f68
8a895c0
80d23ca
bd39320
0862864
7809dfb
45376cb
0ad1868
72ee7a5
3d7aa6a
42f4781
0e8cefe
378d270
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,45 @@ | ||
| # REQUIRED | ||
| # 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: bug-fix | ||
|
|
||
| # REQUIRED for all kinds | ||
| # Change summary; a 80ish characters long description of the change. | ||
| summary: make action optional when upgrade details are provided | ||
|
|
||
| # REQUIRED for breaking-change, deprecation, known-issue | ||
| # Long description; in case the summary is not enough to describe the change | ||
| # this field accommodate a description without length limits. | ||
| # description: | ||
|
|
||
| # REQUIRED for breaking-change, deprecation, known-issue | ||
| # impact: | ||
|
|
||
| # REQUIRED for breaking-change, deprecation, known-issue | ||
| # action: | ||
|
|
||
| # REQUIRED for all kinds | ||
| # Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc. | ||
| component: fleet-server | ||
|
|
||
| # AUTOMATED | ||
| # OPTIONAL to manually add other PR URLs | ||
| # PR URL: A link the PR 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/owner/repo/1234 | ||
|
|
||
| # AUTOMATED | ||
| # OPTIONAL to manually add other issue URLs | ||
| # 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 |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ import ( | |
| "github.com/elastic/fleet-server/v7/internal/pkg/checkin" | ||
| "github.com/elastic/fleet-server/v7/internal/pkg/config" | ||
| "github.com/elastic/fleet-server/v7/internal/pkg/dl" | ||
| "github.com/elastic/fleet-server/v7/internal/pkg/es" | ||
| "github.com/elastic/fleet-server/v7/internal/pkg/logger/ecs" | ||
| "github.com/elastic/fleet-server/v7/internal/pkg/model" | ||
| "github.com/elastic/fleet-server/v7/internal/pkg/monitor" | ||
|
|
@@ -454,22 +455,21 @@ func (ct *CheckinT) processUpgradeDetails(ctx context.Context, agent *model.Agen | |
| return nil | ||
| } | ||
| // update docs with in progress details | ||
|
|
||
| vSpan, vCtx := apm.StartSpan(ctx, "Check update action", "validate") | ||
| action, err := ct.verifyActionExists(ctx, vSpan, agent, details) | ||
| if err != nil { | ||
|
|
||
| var actionTraceparent string | ||
|
Contributor
Author
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. @blakerouse normally when no actin is present we stop here then later we check if we have here when setting parent span and continue until we reach a point where we update details on line 543 |
||
| if action, err := ct.verifyActionExists(ctx, vSpan, agent, details); err == nil && action != nil { | ||
|
Member
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. Does Kibana tolerate having an action ID it doesn't recognize as well? I think passing through the upgrade details unmodified is correct, but we need to avoid Kibana now or in the future trying to do this same validation or making assumption about this field.
Member
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.
Well a possibility here would be removing the action_id if it doesn't exist so kibana can't depend on it, or putting some marker in the details about whether the action exists or not (though kibana can also just check this).
Member
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. @juliaElastic any opinions on if sending upgrade_details to Kibana for action_ids that don't exist or are from another cluster is a problem? |
||
| actionTraceparent = action.Traceparent | ||
| } else if !errors.Is(err, es.ErrNotFound) { | ||
michel-laterman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return err | ||
| } | ||
| if action == nil { | ||
| return nil | ||
| } | ||
|
|
||
| // link action with APM spans | ||
| var links []apm.SpanLink | ||
| if ct.bulker.HasTracer() && action.Traceparent != "" { | ||
| traceCtx, err := apmhttp.ParseTraceparentHeader(action.Traceparent) | ||
| if ct.bulker.HasTracer() && actionTraceparent != "" { | ||
| traceCtx, err := apmhttp.ParseTraceparentHeader(actionTraceparent) | ||
| if err != nil { | ||
| zerolog.Ctx(vCtx).Trace().Err(err).Msgf("Error parsing traceparent: %s %s", action.Traceparent, err) | ||
| zerolog.Ctx(vCtx).Trace().Err(err).Msgf("Error parsing traceparent: %s %s", actionTraceparent, err) | ||
| } else { | ||
| links = []apm.SpanLink{ | ||
| { | ||
|
|
||
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.
Do we need to remove these tests in this PR?