-
Notifications
You must be signed in to change notification settings - Fork 158
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
Fix log level value reported by Agent to Fleet #4838
Fix log level value reported by Agent to Fleet #4838
Conversation
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
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.
lgtm
@@ -329,6 +329,15 @@ func (f *FleetGateway) execute(ctx context.Context) (*fleetapi.CheckinResponse, | |||
// convert components into checkin components structure | |||
components := f.convertToCheckinComponents(state.Components) | |||
|
|||
if ecsMeta.Elastic == nil || ecsMeta.Elastic.Agent == nil { | |||
// escMeta struct is incomplete: log a warning | |||
f.log.Warnw("Agent ECSMetadata struct is missing/incomplete", "elastic_ecs_metadata", ecsMeta.Elastic) |
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.
can't this become a bit chatty in case ecs metadata is in fact incomplete?
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.
It can, the fact is that the current implementation of AgentInfo.ECSMetadata()
guarantees that those structures exist but they are pointers so I would like to avoid a segmentation fault when something changes...
Maybe I can replace that with a unit test + assertion that AgentInfo.ECSMetadata()
always returns initialized Elastic
and Elastic.Agent
pointers
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.
removed in 4973844 in favor of assertions on ECSMetadata()
unit tests
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.
Basically a 1 line change, with lots of tests!
Looks good.
buildkite test it |
2657ada
to
75403ca
Compare
|
…ic#4838)" (elastic#4938)" This reverts commit 2b2e8d0.
What does this PR do?
This PR fixes the log level reported by Agent when checking in with Fleet.
Since merging #3090, a managed elastic-agent has now 2 sources of configuration for log level:
fleet.enc
Before this change, the agent was sending only the information coming from 1. (with a default value equal to
info
), now we send back to Fleet the actual log level specified in coordinator state (which is the end result of evaluating the multiple settings with the correct priority)There has also been a modification of the integration test related to the feature with additional assertions on log level received by Fleet.
Why is it important?
The log level is now correctly displayed in Fleet UI regardless for each agent, regardless of how it's been set (agent settings, policy or default value)
Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files[ ] I have added an entry in./changelog/fragments
using the changelog toolDisruptive User Impact
How to test this PR locally
Advanced settings
under the Policy'ssettings
Tabinfo
offline
state in the image below, the screenshot was taken after the agent has been uninstalled)Related issues
log_level
metadata is not accurate #4747Questions to ask yourself