elastic / elastic/elastic-agent

Log integration package version on unit add/update/remove

Open
#14,916 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Team:Elastic-Agent-Control-Plane
Dominant language
Go
Stars
276
Forks
266
Avg merge
1d 23h
Merged PRs (30d)
312

Description

**Describe the enhancement:**

When the coordinator applies a new component model, log the effective integration package version and data stream for each unit that is added, removed, or changed. Currently the "component model updated" and "Spawned new unit" log lines include only the unit ID and state — they do not record what package version the unit is running or what changed relative to the previous model.

A line like the following at INFO level would be sufficient:

```
Unit cel-default-cel-microsoft_exchange_online_message_trace-: package=microsoft_exchange_online_message_trace version=2.2.2 stream_revision=13 action=updated (was version=2.2.1 stream_revision=12)
```

For added/removed units, only the current (or final) version is needed.

**Describe a specific use case for the enhancement or feature:**

During support triage of a customer running the Microsoft Exchange Online Message Trace integration, we needed to determine when the agent upgraded from v2.2.1 to v2.2.2 (which contained a pagination fix). The diagnostic bundle showed v2.2.2 at capture time, and the logs showed 400 errors earlier in the day, but there was no log entry recording the moment the version changed. We had to reverse-engineer the transition time by comparing base64-encoded URL byte patterns against expected CEL program output for different versions — a process that took significant time and would have been a thirty-second lookup if the version were logged.

This pattern recurs in every support case where the question is "was the fix deployed when the error occurred?" The information exists inside the coordinator (it computes the full component model diff), but it is not surfaced in the logs.

**What is the definition of done?**

- When a policy update changes, adds, or removes a unit, the agent logs at INFO level: the unit ID, the integration package name, the package version, and the action (added/updated/removed).
- For updated units, the previous version is also logged.
- The log entry is emitted in `coordinator.go` at the point where the diff is computed (the same place that currently logs "component model updated").
- The information is at the data-stream/unit level, not the package level, since different data streams within the same package can be at different revisions.

Related: https://github.com/elastic/elastic-agent/issues/3640

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in coordinator.go at the diff computation and the existing "component model updated" and "Spawned new unit" log lines. Trace the unit-level model data used there, then ensure added, updated, and removed units log their ID, package, version, stream revision, and action, with the previous version for updates; verify the resulting INFO output against the definition of done.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, observability-sre
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.