Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minor typos #1346

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Enhancements:
Amazon CloudWatch Agent 1.300044.0 (2024-08-14)
========================================================================
Bug Fixes:
* [ContainerInsights] Update GPU usage metrics emitted
* [ContainerInsights] Update GPU usage metrics emitted
* [ContainerInsights] Deprecate runtime tag from neuron metrics to fix false average calculation

Enhancements:
Expand Down Expand Up @@ -218,7 +218,7 @@ Enhancements:
Amazon CloudWatch Agent 1.300033.0 (2024-01-31)
========================================================================

Enchancements:
Enhancements:
* [AppSignals] Log correlation
* [AppSignals] New Metric Rollup
* [AppSignals] Add metrics cardinality control
Expand Down
2 changes: 1 addition & 1 deletion THIRD-PARTY
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


-------
internal/common/binary.go in the gopsutil is copied and modifid from
internal/common/binary.go in the gopsutil is copied and modified from
golang/encoding/binary.go.


Expand Down
2 changes: 1 addition & 1 deletion cfg/aws/aws_sdk_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var sdkLogLevel aws.LogLevelType = aws.LogOff
// The levels are a bit field that is OR'd together.
// So the user can specify multiple levels and we OR them together.
// Example: "aws_sdk_log_level": "LogDebugWithSigning | LogDebugWithRequestErrors".
// JSON string value must contain the levels seperated by "|" and optionally whitespace.
// JSON string value must contain the levels separated by "|" and optionally whitespace.
func SetSDKLogLevel(sdkLogLevelString string) {
var temp aws.LogLevelType = aws.LogOff

Expand Down
2 changes: 1 addition & 1 deletion cfg/aws/refreshable_shared_credentials_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Refreshable_shared_credentials_provider struct {
credentials.Expiry
sharedCredentialsProvider *credentials.SharedCredentialsProvider

// Retrival frequency, if the value is 15 minutes, the credentials will be retrieved every 15 minutes.
// Retrieval frequency, if the value is 15 minutes, the credentials will be retrieved every 15 minutes.
ExpiryWindow time.Duration
}

Expand Down
2 changes: 1 addition & 1 deletion internal/httpclient/httpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (h *HttpClient) request(endpoint string) ([]byte, error) {
}

if len(body) == maxHttpResponseLength {
return nil, fmt.Errorf("response from %s, execeeds the maximum length: %v", endpoint, maxHttpResponseLength)
return nil, fmt.Errorf("response from %s, exceeds the maximum length: %v", endpoint, maxHttpResponseLength)
}
return body, nil
}
2 changes: 1 addition & 1 deletion internal/k8sCommon/k8sclient/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func createNodeListWatch(client kubernetes.Interface) cache.ListerWatcher {
return &cache.ListWatch{
ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {
opts.ResourceVersion = ""
// Passing emput context as this was not required by old List()
// Passing empty context as this was not required by old List()
return client.CoreV1().Nodes().List(ctx, opts)
},
WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/logscommon/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const (

//Field key in metrics indicting if the line is the start of the multiline.
//If this key is not present, it means the multiline mode is not enabled,
// we set it to true, it indicates it is a real event, but not part of a mulltiple line.
// we set it to true, it indicates it is a real event, but not part of a multiple line.
//If this key is false, it means the line is not start line of multiline entry.
//If this key is true, it means the line is the start of multiline entry.
MultiLineStartField = "multi_line_start"
Expand Down
18 changes: 9 additions & 9 deletions internal/mapWithExpiry/mapWIthExpiry.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,38 @@ type mapEntry struct {

// MapWithExpiry act like a map which provide a method to clean up expired entries
type MapWithExpiry struct {
ttl time.Duration
entris map[string]*mapEntry
ttl time.Duration
entries map[string]*mapEntry
}

func NewMapWithExpiry(ttl time.Duration) *MapWithExpiry {
return &MapWithExpiry{ttl: ttl, entris: make(map[string]*mapEntry)}
return &MapWithExpiry{ttl: ttl, entries: make(map[string]*mapEntry)}
}

func (m *MapWithExpiry) CleanUp(now time.Time) {
for k, v := range m.entris {
for k, v := range m.entries {
if now.Sub(v.creation) >= m.ttl {
delete(m.entris, k)
delete(m.entries, k)
}
}
}

func (m *MapWithExpiry) Get(key string) (interface{}, bool) {
res, ok := m.entris[key]
res, ok := m.entries[key]
if ok {
return res.content, true
}
return nil, false
}

func (m *MapWithExpiry) Set(key string, content interface{}) {
m.entris[key] = &mapEntry{content: content, creation: time.Now()}
m.entries[key] = &mapEntry{content: content, creation: time.Now()}
}

func (m *MapWithExpiry) Size() int {
return len(m.entris)
return len(m.entries)
}

func (m *MapWithExpiry) Delete(key string) {
delete(m.entris, key)
delete(m.entries, key)
}
4 changes: 2 additions & 2 deletions internal/util/user/userutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func changeFileOwner(uid, gid int) error {
}

// chownRecursive would recursively change the ownership of the directory
// similar to `chown -R <dir>`, except it will igore any files that are:
// similar to `chown -R <dir>`, except it will ignore any files that are:
// - Executable
// - With SUID or SGID bit set
// - Allow anyone to write to
Expand All @@ -78,7 +78,7 @@ func chownRecursive(uid, gid int, dir string) error {
}

// Do not change ownership of executable files
// Perm() returns the lower 7 bit of permission of file, which represes rwxrwxrws
// Perm() returns the lower 7 bit of permission of file, which represents rwxrwxrws
// 0111 maps to --x--x--x, so it would check any user have the execution right
if fmode.Perm()&0111 != 0 {
return nil
Expand Down
2 changes: 1 addition & 1 deletion licensing/THIRD-PARTY-LICENSES
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


-------
internal/common/binary.go in the gopsutil is copied and modifid from
internal/common/binary.go in the gopsutil is copied and modified from
golang/encoding/binary.go.


Expand Down
6 changes: 3 additions & 3 deletions packaging/darwin/amazon-cloudwatch-agent-ctl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ readonly OTEL_YAML="${CONFDIR}/amazon-cloudwatch-agent.yaml"
readonly JSON="${CONFDIR}/amazon-cloudwatch-agent.json"
readonly JSON_DIR="${CONFDIR}/amazon-cloudwatch-agent.d"
readonly CV_LOG_FILE="${AGENTDIR}/logs/configuration-validation.log"
readonly COMMON_CONIG="${CONFDIR}/common-config.toml"
readonly COMMON_CONFIG="${CONFDIR}/common-config.toml"

readonly ALL_CONFIG='all'

Expand Down Expand Up @@ -176,7 +176,7 @@ cwa_config() {
if [ "${config_location}" = "${ALL_CONFIG}" ]; then
rm -rf "${JSON_DIR}"/*
else
runDownloaderCommand=$("${CMDDIR}/config-downloader" --output-dir "${JSON_DIR}" --download-source "${config_location}" --mode ${mode} --config "${COMMON_CONIG}" --multi-config ${multi_config})
runDownloaderCommand=$("${CMDDIR}/config-downloader" --output-dir "${JSON_DIR}" --download-source "${config_location}" --mode ${mode} --config "${COMMON_CONFIG}" --multi-config ${multi_config})
echo "${runDownloaderCommand}"
fi

Expand All @@ -185,7 +185,7 @@ cwa_config() {
rm -f "${TOML}"
rm -f "${OTEL_YAML}"
else
runTranslatorCommand=$("${CMDDIR}/config-translator" --input "${JSON}" --input-dir "${JSON_DIR}" --output "${TOML}" --mode ${mode} --config "${COMMON_CONIG}" --multi-config ${multi_config})
runTranslatorCommand=$("${CMDDIR}/config-translator" --input "${JSON}" --input-dir "${JSON_DIR}" --output "${TOML}" --mode ${mode} --config "${COMMON_CONFIG}" --multi-config ${multi_config})
echo "${runTranslatorCommand}"

runAgentSchemaTestCommand="${CMDDIR}/amazon-cloudwatch-agent -schematest -config ${TOML}"
Expand Down
6 changes: 3 additions & 3 deletions packaging/dependencies/amazon-cloudwatch-agent-ctl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ readonly OTEL_YAML="${CONFDIR}/amazon-cloudwatch-agent.yaml"
readonly JSON="${CONFDIR}/amazon-cloudwatch-agent.json"
readonly JSON_DIR="${CONFDIR}/amazon-cloudwatch-agent.d"
readonly CV_LOG_FILE="${AGENTDIR}/logs/configuration-validation.log"
readonly COMMON_CONIG="${CONFDIR}/common-config.toml"
readonly COMMON_CONFIG="${CONFDIR}/common-config.toml"
readonly ENV_CONFIG="${CONFDIR}/env-config.json"

readonly CWA_NAME='amazon-cloudwatch-agent'
Expand Down Expand Up @@ -263,7 +263,7 @@ cwa_config() {
if [ "${cwa_config_location}" = "${ALL_CONFIG}" ]; then
rm -rf "${JSON_DIR}"/*
else
runDownloaderCommand=$("${CMDDIR}/config-downloader" --output-dir "${JSON_DIR}" --download-source "${cwa_config_location}" --mode ${param_mode} --config "${COMMON_CONIG}" --multi-config ${multi_config})
runDownloaderCommand=$("${CMDDIR}/config-downloader" --output-dir "${JSON_DIR}" --download-source "${cwa_config_location}" --mode ${param_mode} --config "${COMMON_CONFIG}" --multi-config ${multi_config})
echo ${runDownloaderCommand} || return
fi

Expand All @@ -273,7 +273,7 @@ cwa_config() {
rm -f "${OTEL_YAML}"
else
echo "Start configuration validation..."
runTranslatorCommand=$("${CMDDIR}/config-translator" --input "${JSON}" --input-dir "${JSON_DIR}" --output "${TOML}" --mode ${param_mode} --config "${COMMON_CONIG}" --multi-config ${multi_config})
runTranslatorCommand=$("${CMDDIR}/config-translator" --input "${JSON}" --input-dir "${JSON_DIR}" --output "${TOML}" --mode ${param_mode} --config "${COMMON_CONFIG}" --multi-config ${multi_config})
echo "${runTranslatorCommand}" || return

runAgentSchemaTestCommand="${CMDDIR}/amazon-cloudwatch-agent -schematest -config ${TOML}"
Expand Down
6 changes: 3 additions & 3 deletions packaging/windows/amazon-cloudwatch-agent-ctl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ $TOML="${CWAProgramData}\amazon-cloudwatch-agent.toml"
$OTEL_YAML="${CWAProgramData}\amazon-cloudwatch-agent.yaml"
$JSON="${CWAProgramData}\amazon-cloudwatch-agent.json"
$JSON_DIR = "${CWAProgramData}\Configs"
$COMMON_CONIG="${CWAProgramData}\common-config.toml"
$COMMON_CONFIG="${CWAProgramData}\common-config.toml"
$ENV_CONFIG="${CWAProgramData}\env-config.json"

$EC2 = $false
Expand Down Expand Up @@ -301,7 +301,7 @@ Function CWAConfig() {
if ($ConfigLocation -eq $AllConfig) {
Remove-Item -Path "${JSON_DIR}\*" -Force -ErrorAction SilentlyContinue
} else {
& $CWAProgramFiles\config-downloader.exe --output-dir "${JSON_DIR}" --download-source "${ConfigLocation}" --mode "${param_mode}" --config "${COMMON_CONIG}" --multi-config "${multi_config}"
& $CWAProgramFiles\config-downloader.exe --output-dir "${JSON_DIR}" --download-source "${ConfigLocation}" --mode "${param_mode}" --config "${COMMON_CONFIG}" --multi-config "${multi_config}"
CheckCMDResult
}

Expand All @@ -313,7 +313,7 @@ Function CWAConfig() {
Remove-Item "${OTEL_YAML}" -Force -ErrorAction SilentlyContinue
} else {
Write-Output "Start configuration validation..."
& cmd /c "`"$CWAProgramFiles\config-translator.exe`" --input ${JSON} --input-dir ${JSON_DIR} --output ${TOML} --mode ${param_mode} --config ${COMMON_CONIG} --multi-config ${multi_config} 2>&1"
& cmd /c "`"$CWAProgramFiles\config-translator.exe`" --input ${JSON} --input-dir ${JSON_DIR} --output ${TOML} --mode ${param_mode} --config ${COMMON_CONFIG} --multi-config ${multi_config} 2>&1"
CheckCMDResult
# Let command pass so we can check return code and give user-friendly error-message
$ErrorActionPreference = "Continue"
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/logfile/fileconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type FileConfig struct {

//Indicate whether to tail the log file from the beginning or not.
//The default value for this field should be set as true in configuration.
//Otherwise, it may skip some log entries for timestampFromLogLine suffix roatated new file.
//Otherwise, it may skip some log entries for timestampFromLogLine suffix rotated new file.
FromBeginning bool `toml:"from_beginning"`
//Indicate whether it is a named pipe.
Pipe bool `toml:"pipe"`
Expand Down
6 changes: 3 additions & 3 deletions plugins/inputs/logfile/logfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (t *LogFile) Start(acc telegraf.Accumulator) error {

func (t *LogFile) Stop() {
// Tailer srcs are stopped by log agent after the output plugin is stopped instead of here
// because the tailersrc would like to record an accurate uploaded offset
// because the tailerSrc would like to record an accurate uploaded offset
close(t.done)
}

Expand Down Expand Up @@ -368,7 +368,7 @@ func (t *LogFile) cleanupStateFolder() {
}
for _, file := range files {
if info, err := os.Stat(file); err != nil || info.IsDir() {
t.Log.Debugf("File %v does not exist or is a dirctory: %v, %v", file, err, info)
t.Log.Debugf("File %v does not exist or is a directory: %v, %v", file, err, info)
continue
}

Expand All @@ -378,7 +378,7 @@ func (t *LogFile) cleanupStateFolder() {

byteArray, err := os.ReadFile(file)
if err != nil {
t.Log.Errorf("Error happens when reading the content from file %s in clean up state fodler step: %v", file, err)
t.Log.Errorf("Error happens when reading the content from file %s in clean up state folder step: %v", file, err)
continue
}
contentArray := strings.Split(string(byteArray), "\n")
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/logfile/logfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ append line`
}

func TestLogsMultilineTimeout(t *testing.T) {
// multline line starter as [^/s]
// multiline line starter as [^/s]
logEntryString1 := `multiline begin
append line
append line`
Expand Down
6 changes: 3 additions & 3 deletions plugins/inputs/logfile/tail/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type limiter interface {

// Config is used to specify how a file must be tailed.
type Config struct {
// File-specifc
// File-specific
Location *SeekInfo // Seek to this location before tailing
ReOpen bool // Reopen recreated files (tail -F)
MustExist bool // Fail early if the file does not exist
Expand Down Expand Up @@ -137,8 +137,8 @@ func TailFile(filename string, config Config) (*Tail, error) {

// Return the file's current position, like stdio's ftell().
// But this value is not very accurate.
// it may readed one line in the chan(tail.Lines),
// so it may lost one line.
// it may read one line in the chan(tail.Lines),
// so it may lose one line.
func (tail *Tail) Tell() (offset int64, err error) {
if tail.file == nil {
return
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/logfile/tailersrc.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (
)

type fileOffset struct {
seq, offset int64 // Seq handles file trucation, when file is trucated, we increase the offset seq
seq, offset int64 // Seq handles file truncation, when file is truncated, we increase the offset seq
}

func (fo *fileOffset) SetOffset(o int64) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/nvidia_smi/nvidia_smi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestErrorBehaviorDefault(t *testing.T) {
require.Error(t, plugin.Init())
}

func TestErorBehaviorIgnore(t *testing.T) {
func TestErrorBehaviorIgnore(t *testing.T) {
// make sure we can't find nvidia-smi in $PATH somewhere
os.Unsetenv("PATH")
plugin := &NvidiaSMI{
Expand Down
10 changes: 5 additions & 5 deletions plugins/inputs/prometheus/metrics_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (mh *metricsHandler) handle(pmb PrometheusMetricBatch) {
func (mh *metricsHandler) setEmfMetadata(mms []*metricMaterial) {
for _, mm := range mms {
if mh.clusterName != "" {
// Customer can specified the cluster name in the scraping job's relabel_config
// Customer can specify the cluster name in the scraping job's relabel_config
// CWAgent won't overwrite in this case to support cross-cluster monitoring
if _, ok := mm.tags[containerinsightscommon.ClusterNameKey]; !ok {
mm.tags[containerinsightscommon.ClusterNameKey] = mh.clusterName
Expand All @@ -76,17 +76,17 @@ func (mh *metricsHandler) setEmfMetadata(mms []*metricMaterial) {

// Historically, for Prometheus pipelines, we use the "job" corresponding to the target in the prometheus config as the log stream name
// https://github.com/aws/amazon-cloudwatch-agent/blob/59cfe656152e31ca27e7983fac4682d0c33d3316/plugins/inputs/prometheus_scraper/metrics_handler.go#L80-L84
// As can be seen, if the "job" tag was available, the log_stream_name would be set to it and if it wasnt available for some reason, the log_stream_name would be set as "default".
// As can be seen, if the "job" tag was available, the log_stream_name would be set to it and if it wasn't available for some reason, the log_stream_name would be set as "default".
// The old cloudwatchlogs exporter had logic to look for log_stream_name and if not found, it would use the log_stream_name defined in the config
// https://github.com/aws/amazon-cloudwatch-agent/blob/60ca11244badf0cb3ae9dd9984c29f41d7a69302/plugins/outputs/cloudwatchlogs/cloudwatchlogs.go#L175-L180
// But as we see above, there should never be a case for Prometheus pipelines where log_stream_name wasnt being set in metrics_handler - so the log_stream_name in the config would have never been used.
// But as we see above, there should never be a case for Prometheus pipelines where log_stream_name wasn't being set in metrics_handler - so the log_stream_name in the config would have never been used.

// Now that we have switched to awsemfexporter, we leverage the token replacement logic to dynamically set the log stream name
// https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/897db04f747f0bda1707c916b1ec9f6c79a0c678/exporter/awsemfexporter/util.go#L29-L37
// Hence we always set the log stream name in the default exporter config as {JobName} during config translation.
// If we have a "job" tag, we do NOT add a tag for "JobName" here since the fallback logic in awsemfexporter while doing pattern matching will fallback from "JobName" -> "job" and use that.
// Only when "job" tag isnt available, we set the "JobName" tag to default to retain same logic as before.
// We do it this way so we dont unnecessarily add an extra tag (that the awsemfexporter wont know to drop) for most cases where "job" will be defined.
// Only when "job" tag isn't available, we set the "JobName" tag to default to retain same logic as before.
// We do it this way so we don't unnecessarily add an extra tag (that the awsemfexporter won't know to drop) for most cases where "job" will be defined.

if _, ok := mm.tags["job"]; !ok {
mm.tags["JobName"] = "default"
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/statsd/graphite/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

const (
// DefaultSeparator is the default join character to use when joining multiple
// measurment parts in a template.
// measurement parts in a template.
DefaultSeparator = "."
)

Expand Down
8 changes: 4 additions & 4 deletions plugins/inputs/statsd/graphite/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ package graphite

import "fmt"

// An UnsupposedValueError is returned when a parsed value is not
// supposed.
type UnsupposedValueError struct {
// An UnsupportedValueError is returned when a parsed value is not
// supported.
type UnsupportedValueError struct {
Field string
Value float64
}

func (err *UnsupposedValueError) Error() string {
func (err *UnsupportedValueError) Error() string {
return fmt.Sprintf(`field "%s" value: "%v" is unsupported`, err.Field, err.Value)
}
Loading