Remove --sample-config flag from amazon-cloudwatch-agent executable
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 62/100
Research direction
Start in cmd/amazon-cloudwatch-agent/amazon-cloudwatch-agent.go, where --sample-config and the related filter flags are defined and handled. Trace their references and remove the flag handling so the executable no longer exposes these options or reaches the panicking sample-configuration path. Done means the obsolete flags and their uses are gone without affecting normal agent startup.
Written by the indexing model from the issue text.
Description
The --sample-config flag is useless, it prints out a TOML config which is not relevant for a CWAgent customer. Not to mention it panics because it tries to print the config for one of the container processors, which expects /rootfs to exist - see below. The existence of this flag is confusing to customers because they might think it could show them a sample JSON config.
This flag should be removed, along with the --section-filter, --input-filter, --output-filter, --aggregator-filter, and --processor-filter flags which are only used in conjunction with --sample-config.
Panic output:
2022-10-19T13:56:51Z E! /rootfs/proc does not exist
panic: E! /rootfs/proc does not exist
goroutine 1 [running]:
log.Panic({0xc0009bf738?, 0xc00050f500?, 0x3ad4dc0?})
/usr/lib/golang/src/log/log.go:385 +0x65
github.com/aws/amazon-cloudwatch-agent/internal/containerinsightscommon.NewNodeCapacity()
/builddir/build/BUILD/amazon-cloudwatch-agent-1.247354.0b251981/amazon-cloudwatch-agent/internal/containerinsightscommon/nodeCapacity.go:21 +0x7c
github.com/aws/amazon-cloudwatch-agent/plugins/processors/ecsdecorator.init.0.func1()
/builddir/build/BUILD/amazon-cloudwatch-agent-1.247354.0b251981/amazon-cloudwatch-agent/plugins/processors/ecsdecorator/ecsdecorator.go:166 +0x19
github.com/influxdata/telegraf/plugins/processors.upgradeToStreamingProcessor.func1()
/builddir/build/BUILD/amazon-cloudwatch-agent-1.247354.0b251981/amazon-cloudwatch-agent/vendor/github.com/influxdata/telegraf/plugins/processors/registry.go:24 +0x1d
github.com/influxdata/telegraf/config.printFilteredProcessors({0xc0006da180, 0x5, 0x8?}, 0x1?)
/builddir/build/BUILD/amazon-cloudwatch-agent-1.247354.0b251981/amazon-cloudwatch-agent/vendor/github.com/influxdata/telegraf/config/config.go:577 +0x266
github.com/influxdata/telegraf/config.PrintSampleConfig({0xc0009bfcf0, 0x0, 0x0}, {0x560d170?, 0x0, 0x0}, {0x560d170?, 0x0, 0x0}, {0xc0009bfcf0, ...}, ...)
/builddir/build/BUILD/amazon-cloudwatch-agent-1.247354.0b251981/amazon-cloudwatch-agent/vendor/github.com/influxdata/telegraf/config/config.go:519 +0x6a5
main.main()
/builddir/build/BUILD/amazon-cloudwatch-agent-1.247354.0b251981/amazon-cloudwatch-agent/cmd/amazon-cloudwatch-agent/amazon-cloudwatch-agent.go:473 +0xb9a
- Dominant language
- Go
- Stars
- 550
- Forks
- 275
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 15
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws/amazon-cloudwatch-agent
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
aws/amazon-cloudwatch-agent#2298 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
aws/amazon-cloudwatch-agent#2286 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aws/amazon-cloudwatch-agent#2256 ·
-
Stale
Difficulty 2/5 1-2 days Newbie friendliness 74/100
aws/amazon-cloudwatch-agent#2137 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
aws/amazon-cloudwatch-agent#2273 ·
All issues in aws/amazon-cloudwatch-agent
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100