Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: elastic/elastic-agent-client
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v7.9.0
Choose a base ref
...
head repository: elastic/elastic-agent-client
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v7.10.0
Choose a head ref
  • 3 commits
  • 9 files changed
  • 4 contributors

Commits on May 16, 2024

  1. [Unit/Change]: trigger config change on unit config and revision chan…

    …ges (#109)
    
    * fix: trigger config change also when unit config is changed
    
    * fix: check for config revision changes
    
    * fix: rely solely on configIdx changes to capture a TriggeredConfigChange
    
    * fix: re-introduce TriggeredNothing check in TestUnitUpdateWithSameMap
    pkoutsovasilis authored May 16, 2024
    Copy the full SHA
    dd64603 View commit details

Commits on May 24, 2024

  1. Replace go get usage (#111)

    * I think the install op is broken?
    
    * ooops
    
    * More fixes
    
    ---------
    
    Co-authored-by: fearful-symmetry <[email protected]>
    ycombinator and fearful-symmetry authored May 24, 2024
    Copy the full SHA
    ea71037 View commit details
  2. Add management mode enum to AgentInfo metadata (#110)

    * add management mode to agent info
    
    * I think the install op is broken?
    
    * ooops
    
    * update names
    fearful-symmetry authored May 24, 2024
    Copy the full SHA
    2c7ee2d View commit details
8 changes: 8 additions & 0 deletions elastic-agent-client.proto
Original file line number Diff line number Diff line change
@@ -107,6 +107,12 @@ enum UnitLogLevel {
TRACE = 4;
}

// Reports the mode agent is running in
enum AgentManagedMode {
MANAGED = 0;
STANDALONE = 1;
}

// Package metadata provided in the meta field of a unit.
message Package {
// Source is the original configuration of this Package in the agent policy. Only standard
@@ -207,6 +213,8 @@ message AgentInfo {
string version = 2;
// Snapshot is true when the running Elastic Agent is a snapshot version.
bool snapshot = 3;
// AgentManagedMode reports what config mode agent is running in.
AgentManagedMode mode = 4;
}

// Feature flags configurations.
6 changes: 3 additions & 3 deletions magefile.go
Original file line number Diff line number Diff line change
@@ -47,12 +47,12 @@ type Check mg.Namespace

// InstallGoLicenser install go-licenser to check license of the files.
func (Prepare) InstallGoLicenser() error {
return GoGet(goLicenserRepo)
return GoInstall(fmt.Sprintf("%s@latest", goLicenserRepo))
}

// InstallGoLint for the code.
func (Prepare) InstallGoLint() error {
return GoGet(goLintRepo)
return GoInstall(fmt.Sprintf("%s@latest", goLintRepo))
}

// All runs prepare:installGoLicenser and prepare:installGoLint.
@@ -162,7 +162,7 @@ func (Check) License() error {

// GoGet fetch a remote dependencies.
func GoGet(link string) error {
_, err := sh.Exec(map[string]string{"GO111MODULE": "off"}, os.Stdout, os.Stderr, "go", "get", link)
_, err := sh.Exec(map[string]string{}, os.Stdout, os.Stderr, "go", "get", link)
return err
}

6 changes: 2 additions & 4 deletions pkg/client/unit.go
Original file line number Diff line number Diff line change
@@ -325,10 +325,8 @@ func (u *Unit) updateState(

if u.configIdx != cfgIdx {
u.configIdx = cfgIdx
if !gproto.Equal(u.config.GetSource(), cfg.GetSource()) {
u.config = cfg
triggers |= TriggeredConfigChange
}
u.config = cfg
triggers |= TriggeredConfigChange
}

if !gproto.Equal(u.apm, expAPM) {
9 changes: 7 additions & 2 deletions pkg/client/unit_test.go
Original file line number Diff line number Diff line change
@@ -38,9 +38,14 @@ func TestUnitUpdateWithSameMap(t *testing.T) {
_, err = gproto.Marshal(newUnit)
require.NoError(t, err)

// This should return TriggeredNothing, as the two underlying maps in `source` are the same
got := defaultTest.updateState(UnitStateHealthy, UnitLogLevelDebug, 0, nil, newUnit, 2, nil)
// This should return TriggeredNothing, as the configIdx hasn't changed
got := defaultTest.updateState(UnitStateHealthy, UnitLogLevelDebug, 0, nil, newUnit, 1, nil)
assert.Equal(t, TriggeredNothing, got)

// This should return TriggeredConfigChange, as the configIdx has changed (this is our criteria)
// no matter if the actual map is the same
got = defaultTest.updateState(UnitStateHealthy, UnitLogLevelDebug, 0, nil, newUnit, 2, nil)
assert.Equal(t, TriggeredConfigChange, got)
}

func TestUnitUpdateWithNewMap(t *testing.T) {
2 changes: 1 addition & 1 deletion pkg/proto/elastic-agent-client-deprecated.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/proto/elastic-agent-client-future.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/proto/elastic-agent-client-future_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading