[OpAMP] Map fields from AgentToServer message to Agent fields#6400
[OpAMP] Map fields from AgentToServer message to Agent fields#6400juliaElastic wants to merge 11 commits intoelastic:mainfrom
Conversation
|
This pull request does not have a backport label. Could you fix it @juliaElastic? 🙏
|
6f00b37 to
6b39f50
Compare
|
Depending on merge order, the test in #6289 will have to be updated not to expect the updating state anymore. |
|
@ycombinator Could you help merge the PR, it seems I no longer have access. |
internal/pkg/api/handleOpAMP.go
Outdated
| } | ||
|
|
||
| // if agents index doesn't exist yet, it will be created when the first agent document is indexed | ||
| if err != nil && strings.Contains(err.Error(), "index_not_found_exception") { |
There was a problem hiding this comment.
Can we compare to es.ErrIndexNotFound here instead?
| Type: agentType, | ||
| }, | ||
| LocalMetadata: data, | ||
| // Setting revision to 1, the collector won't receive policy changes and 0 would keep the collector in updating state |
There was a problem hiding this comment.
qq: the policy on fleet will never have a policy id > 1, if it can then agents can appear as outdated
There was a problem hiding this comment.
The UI hides the policy name and revision for collectors, as policies are not relevant for them (other than needing an enrollment token to authenticate with).
| // suite.Equal(otelVersion, agentDoc.Agent.Version, "expected agent.version to match otelcol-contrib binary version") | ||
| // suite.Equal(1, agentDoc.Revision, "expected policy_revision_idx to be 1") | ||
| // suite.Contains(agentDoc.Tags, "otelcontribcol", "expected tags to contain otelcontribcol") | ||
| // suite.Equal("online", agentDoc.Status, "expected status to be online") |
There was a problem hiding this comment.
removed the status field check from the agent doc, it's calculated by a runtime field by Fleet UI
What is the problem this PR solves?
Map data from OpAMP AgentToServer message to Agent fields in
.fleet-agentsHow does this PR solve the problem?
Add OpAMP message fields to Agent document:
How to test this PR locally
Follow instructions in https://github.com/elastic/fleet-server/blob/main/docs/opamp.md
Download and extract otel collector, e.g.:
Create otel config to include system fields and internal telemetry, e.g.
otel-opamp.yaml:Create API keys and start otel collector:
Design Checklist
Checklist
./changelog/fragmentsusing the changelog toolRelated issues
Closes https://github.com/elastic/ingest-dev/issues/6982