Skip to content

Commit 732f736

Browse files
committed
remove ENABLE_BEATS_RECEIVERS, add AGENT_MONITORING_RUNTIME_EXPERIMENTAL
1 parent cf54e83 commit 732f736

File tree

6 files changed

+58
-325
lines changed

6 files changed

+58
-325
lines changed

internal/pkg/agent/application/application.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func New(
163163

164164
var configMgr coordinator.ConfigManager
165165
var managed *managedConfigManager
166-
var compModifiers = []coordinator.ComponentsModifier{InjectAPMConfig, EnableBeatsReceivers()}
166+
var compModifiers = []coordinator.ComponentsModifier{InjectAPMConfig}
167167
var composableManaged bool
168168
var isManaged bool
169169
var actionAcker acker.Acker

internal/pkg/agent/application/beats_receivers_modifier.go

Lines changed: 0 additions & 47 deletions
This file was deleted.

internal/pkg/agent/application/beats_receivers_modifier_test.go

Lines changed: 0 additions & 91 deletions
This file was deleted.

internal/pkg/agent/cmd/container.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,9 @@ be used when the same credentials will be used across all the possible actions a
149149
ELASTIC_AGENT_TAGS - user provided tags for the agent [linux,staging]
150150
151151
* Beats Receivers
152-
This enables the Beats Receivers for supported components.
152+
The following experimental environment variables can be set to enable using Beats Receivers.
153153
154-
ENABLE_BEATS_RECEIVERS - Set to 1 to enable the Beats Receivers for supported components in the policy.
155-
ENABLE_BEATS_RECEIVERS_MONITORING - Set to 1 to enable using Beats Receivers for self-monitoring.
154+
AGENT_MONITORING_RUNTIME_EXPERIMENTAL - Set to either "process" or "otel" to enable the respective runtime for the monitoring components.
156155
157156
* Elastic-Agent event logging
158157
If EVENTS_TO_STDERR is set to true log entries containing event data or whole raw events will be logged to stderr alongside
@@ -827,13 +826,10 @@ func containerCfgOverrides(cfg *configuration.Configuration) {
827826
cfg.Settings.EventLoggingConfig.ToStderr = true
828827
}
829828

830-
enableBeatsReceiversMonitoringEnv := envWithDefault("false", "ENABLE_BEATS_RECEIVERS_MONITORING")
831-
enableBeatsReceiversMonitoring, err := strconv.ParseBool(enableBeatsReceiversMonitoringEnv)
832-
if err != nil {
833-
logp.Warn("cannot parse ENABLE_BEATS_RECEIVERS_MONITORING='%s' as boolean, using default monitoring runtime", enableBeatsReceiversMonitoringEnv)
834-
}
835-
if enableBeatsReceiversMonitoring {
836-
cfg.Settings.MonitoringConfig.RuntimeManager = string(component.OtelRuntimeManager)
829+
agentMonitoringRuntimeEnv := envWithDefault("false", "AGENT_MONITORING_RUNTIME_EXPERIMENTAL")
830+
switch agentMonitoringRuntimeEnv {
831+
case string(monitoringCfg.OtelRuntimeManager), string(monitoringCfg.ProcessRuntimeManager):
832+
cfg.Settings.MonitoringConfig.RuntimeManager = agentMonitoringRuntimeEnv
837833
}
838834

839835
configuration.OverrideDefaultContainerGRPCPort(cfg.Settings.GRPC)

internal/pkg/agent/cmd/container_test.go

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"github.com/elastic/elastic-agent/internal/pkg/agent/storage"
2828
"github.com/elastic/elastic-agent/internal/pkg/cli"
2929
"github.com/elastic/elastic-agent/internal/pkg/config"
30+
monitoringCfg "github.com/elastic/elastic-agent/internal/pkg/core/monitoring/config"
3031
"github.com/elastic/elastic-agent/internal/pkg/crypto"
3132
"github.com/elastic/elastic-agent/internal/pkg/fleetapi/client"
3233
"github.com/elastic/elastic-agent/internal/pkg/remote"
@@ -68,48 +69,38 @@ func TestEnvTimeout(t *testing.T) {
6869
require.Equal(t, time.Second*10, res)
6970
}
7071

71-
func TestContainerCfgOverrides_EnableBeatsReceiversMonitoring(t *testing.T) {
72+
func TestContainerCfgOverrides_AgentMonitoringRuntimeExperimental(t *testing.T) {
7273
tests := []struct {
7374
name string
7475
envValue string
7576
expected string
7677
}{
7778
{
78-
name: "enabled",
79-
envValue: "true",
80-
expected: "otel",
79+
name: "otel",
80+
envValue: "otel",
81+
expected: string(monitoringCfg.OtelRuntimeManager),
8182
},
8283
{
83-
name: "enabled with 1",
84-
envValue: "1",
85-
expected: "otel",
84+
name: "process",
85+
envValue: "process",
86+
expected: string(monitoringCfg.ProcessRuntimeManager),
8687
},
8788
{
88-
name: "disabled",
89-
envValue: "false",
90-
expected: "",
91-
},
92-
{
93-
name: "disabled with 0",
94-
envValue: "0",
95-
expected: "",
89+
name: "invalid",
90+
envValue: "invalid",
91+
expected: string(monitoringCfg.DefaultRuntimeManager),
9692
},
9793
{
98-
name: "not set",
94+
name: "empty",
9995
envValue: "",
100-
expected: "",
101-
},
102-
{
103-
name: "invalid value",
104-
envValue: "invalid",
105-
expected: "",
96+
expected: string(monitoringCfg.DefaultRuntimeManager),
10697
},
10798
}
10899

109100
for _, tt := range tests {
110101
t.Run(tt.name, func(t *testing.T) {
111102
if tt.envValue != "" {
112-
t.Setenv("ENABLE_BEATS_RECEIVERS_MONITORING", tt.envValue)
103+
t.Setenv("AGENT_MONITORING_RUNTIME_EXPERIMENTAL", tt.envValue)
113104
}
114105

115106
cfg := &configuration.Configuration{

0 commit comments

Comments
 (0)