Skip to content

Commit 088e3d2

Browse files
refactor: remove all receiver references to bundled config host files
1 parent 8b3f6e8 commit 088e3d2

File tree

15 files changed

+41
-172
lines changed

15 files changed

+41
-172
lines changed

internal/commands/config/config_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,13 @@ func setEnvVars(t *testing.T, packageType PackageType) {
128128
switch packageType {
129129
case MacOS:
130130
assert.NoError(t, os.Setenv("FILESTORAGE_PATH", "/var/lib/observe-agent/filestorage"))
131+
assert.NoError(t, os.Setenv("OBSERVE_AGENT_CONFIG_PATH", "/usr/local/observe-agent/observe-agent.yaml"))
131132
case Windows:
132133
assert.NoError(t, os.Setenv("FILESTORAGE_PATH", "C:\\ProgramData\\Observe\\observe-agent\\filestorage"))
134+
assert.NoError(t, os.Setenv("OBSERVE_AGENT_CONFIG_PATH", "C:\\Program Files\\Observe\\observe-agent\\observe-agent.yaml"))
133135
case Linux, Docker:
134136
assert.NoError(t, os.Setenv("FILESTORAGE_PATH", "/var/lib/observe-agent/filestorage"))
137+
assert.NoError(t, os.Setenv("OBSERVE_AGENT_CONFIG_PATH", "/etc/observe-agent/observe-agent.yaml"))
135138
default:
136139
t.Errorf("Unknown package type: %s", packageType)
137140
}

internal/commands/config/test/snap1-docker-output.yaml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,6 @@ processors:
131131
- truncate_all(attributes, 4095)
132132
- truncate_all(resource.attributes, 4095)
133133
receivers:
134-
filelog/agent-config:
135-
include:
136-
- /etc/observe-agent/connections/common/base.yaml.tmpl
137-
include_file_path: true
138-
multiline:
139-
line_end_pattern: ENDOFLINEPATTERN
140-
poll_interval: 5m
141-
start_at: beginning
142134
filelog/host_monitoring:
143135
exclude:
144136
- exclude1
@@ -160,7 +152,7 @@ receivers:
160152
storage: file_storage
161153
filestats/agent:
162154
collection_interval: 5m
163-
include: /etc/observe-agent/connections/common/base.yaml.tmpl
155+
include: /etc/observe-agent/observe-agent.yaml
164156
initial_delay: 60s
165157
hostmetrics/host-monitoring-host:
166158
collection_interval: 60s
@@ -264,17 +256,9 @@ service:
264256
pipelines:
265257
logs/agent-config:
266258
exporters:
267-
- otlphttp/observe
268-
processors:
269-
- memory_limiter
270-
- transform/truncate
271-
- resourcedetection
272-
- resourcedetection/cloud
273-
- attributes/observe_global_attributes
274-
- resource/observe_global_resource_attributes
275-
- batch
259+
- nop
276260
receivers:
277-
- filelog/agent-config
261+
- nop
278262
logs/agent-journald:
279263
exporters:
280264
- otlphttp/observe

internal/commands/config/test/snap1-linux-output.yaml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,6 @@ processors:
128128
- truncate_all(attributes, 4095)
129129
- truncate_all(resource.attributes, 4095)
130130
receivers:
131-
filelog/agent-config:
132-
include:
133-
- /etc/observe-agent/connections/common/base.yaml.tmpl
134-
include_file_path: true
135-
multiline:
136-
line_end_pattern: ENDOFLINEPATTERN
137-
poll_interval: 5m
138-
start_at: beginning
139131
filelog/host_monitoring:
140132
exclude:
141133
- exclude1
@@ -157,7 +149,7 @@ receivers:
157149
storage: file_storage
158150
filestats/agent:
159151
collection_interval: 5m
160-
include: /etc/observe-agent/connections/common/base.yaml.tmpl
152+
include: /etc/observe-agent/observe-agent.yaml
161153
initial_delay: 60s
162154
hostmetrics/host-monitoring-host:
163155
collection_interval: 60s
@@ -258,17 +250,9 @@ service:
258250
pipelines:
259251
logs/agent-config:
260252
exporters:
261-
- otlphttp/observe
262-
processors:
263-
- memory_limiter
264-
- transform/truncate
265-
- resourcedetection
266-
- resourcedetection/cloud
267-
- attributes/observe_global_attributes
268-
- resource/observe_global_resource_attributes
269-
- batch
253+
- nop
270254
receivers:
271-
- filelog/agent-config
255+
- nop
272256
logs/agent-journald:
273257
exporters:
274258
- otlphttp/observe

internal/commands/config/test/snap1-macos-output.yaml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,6 @@ processors:
128128
- truncate_all(attributes, 4095)
129129
- truncate_all(resource.attributes, 4095)
130130
receivers:
131-
filelog/agent-config:
132-
include:
133-
- /usr/local/observe-agent/connections/common/base.yaml.tmpl
134-
include_file_path: true
135-
multiline:
136-
line_end_pattern: ENDOFLINEPATTERN
137-
poll_interval: 5m
138-
start_at: beginning
139131
filelog/host_monitoring:
140132
exclude:
141133
- exclude1
@@ -157,7 +149,7 @@ receivers:
157149
storage: file_storage
158150
filestats/agent:
159151
collection_interval: 5m
160-
include: /usr/local/observe-agent/connections/common/base.yaml.tmpl
152+
include: /usr/local/observe-agent/observe-agent.yaml
161153
initial_delay: 60s
162154
hostmetrics/host-monitoring-host:
163155
collection_interval: 60s
@@ -245,17 +237,9 @@ service:
245237
pipelines:
246238
logs/agent-config:
247239
exporters:
248-
- otlphttp/observe
249-
processors:
250-
- memory_limiter
251-
- transform/truncate
252-
- resourcedetection
253-
- resourcedetection/cloud
254-
- attributes/observe_global_attributes
255-
- resource/observe_global_resource_attributes
256-
- batch
240+
- nop
257241
receivers:
258-
- filelog/agent-config
242+
- nop
259243
logs/forward:
260244
exporters:
261245
- otlphttp/observe

internal/commands/config/test/snap1-windows-output.yaml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,6 @@ processors:
107107
- truncate_all(attributes, 4095)
108108
- truncate_all(resource.attributes, 4095)
109109
receivers:
110-
filelog/agent-config:
111-
include:
112-
- C:\Program Files\Observe\observe-agent\connections\common\base.yaml.tmpl
113-
include_file_path: true
114-
multiline:
115-
line_end_pattern: ENDOFLINEPATTERN
116-
poll_interval: 5m
117-
start_at: beginning
118110
filelog/host_monitoring:
119111
exclude:
120112
- exclude1
@@ -136,7 +128,7 @@ receivers:
136128
storage: file_storage
137129
filestats/agent:
138130
collection_interval: 5m
139-
include: C:\Program Files\Observe\observe-agent\connections\common\base.yaml.tmpl
131+
include: C:\Program Files\Observe\observe-agent\observe-agent.yaml
140132
initial_delay: 60s
141133
hostmetrics/host-monitoring-host:
142134
collection_interval: 60s
@@ -224,17 +216,9 @@ service:
224216
pipelines:
225217
logs/agent-config:
226218
exporters:
227-
- otlphttp/observe
228-
processors:
229-
- memory_limiter
230-
- transform/truncate
231-
- resourcedetection
232-
- resourcedetection/cloud
233-
- attributes/observe_global_attributes
234-
- resource/observe_global_resource_attributes
235-
- batch
219+
- nop
236220
receivers:
237-
- filelog/agent-config
221+
- nop
238222
logs/forward:
239223
exporters:
240224
- otlphttp/observe

internal/connections/allconnectiontypes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ var HostMonitoringConnectionType = MakeConnectionType(
5858
[]CollectorConfigFragment{
5959
{
6060
enabledCheck: func(agentConfig *config.AgentConfig) bool {
61+
// TODO remove this deprecated template
6162
return agentConfig.HostMonitoring.Enabled
6263
},
6364
colConfigFilePath: "host.yaml.tmpl",

internal/root/root.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ func setEnvVars() error {
104104
os.Setenv("OBSERVE_AUTHORIZATION_HEADER", "Bearer "+token)
105105
os.Setenv("FILESTORAGE_PATH", getDefaultFilestoragePath())
106106

107+
configFile := viper.ConfigFileUsed()
108+
if configFile != "" {
109+
os.Setenv("OBSERVE_AGENT_CONFIG_PATH", configFile)
110+
}
111+
107112
// Default TRACE_TOKEN to be the value of the configured token if it's not set. This allows for users to upgrade to
108113
// direct write tracing with ingest tokens in kubernetes without breaking backwards compatibility in our helm chart.
109114
// TODO: remove this once our helm chart no longer supports TRACE_TOKEN

packaging/docker/observe-agent/connections/host_monitoring/host.yaml.tmpl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
receivers:
2-
# TODO deprecate this
32
filestats/agent:
4-
include: '/etc/observe-agent/connections/common/base.yaml.tmpl'
3+
include: "${env:OBSERVE_AGENT_CONFIG_PATH}"
54
collection_interval: 5m
65
initial_delay: 60s
76

packaging/docker/observe-agent/connections/self_monitoring/logs_and_metrics.yaml.tmpl

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
receivers:
2-
filelog/agent-config: # TODO: Add observe-agent.yaml once we can obfuscate sensitive config fields
3-
# TODO deprecate this
4-
include: [/etc/observe-agent/connections/common/base.yaml.tmpl]
5-
include_file_path: true
6-
start_at: beginning
7-
poll_interval: 5m
8-
multiline:
9-
line_end_pattern: ENDOFLINEPATTERN
2+
# TODO: Add observe-agent.yaml once we can obfuscate sensitive config fields
103

114
prometheus/agent:
125
config:
@@ -60,18 +53,7 @@ service:
6053
- batch
6154
exporters: [otlphttp/observe, count]
6255

56+
# Deprecated
6357
logs/agent-config:
64-
receivers: [filelog/agent-config]
65-
processors:
66-
- memory_limiter
67-
- transform/truncate
68-
- resourcedetection
69-
- resourcedetection/cloud
70-
{{- if .HasAttributes }}
71-
- attributes/observe_global_attributes
72-
{{- end }}
73-
{{- if .HasResourceAttributes }}
74-
- resource/observe_global_resource_attributes
75-
{{- end }}
76-
- batch
77-
exporters: [otlphttp/observe]
58+
receivers: [nop]
59+
exporters: [nop]

packaging/linux/connections/host_monitoring/host.yaml.tmpl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
receivers:
2-
# TODO deprecate this
32
filestats/agent:
4-
include: '/etc/observe-agent/connections/common/base.yaml.tmpl'
3+
include: "${env:OBSERVE_AGENT_CONFIG_PATH}"
54
collection_interval: 5m
65
initial_delay: 60s
76

0 commit comments

Comments
 (0)