Skip to content

Commit

Permalink
Merge branch 'main' into agent-info-ext
Browse files Browse the repository at this point in the history
  • Loading branch information
jefchien authored Oct 23, 2023
2 parents fedd092 + b6c6bfa commit d75e9ed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/inputs/logfile/logfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ func createWriteRead(t *testing.T, prefix string, logFile *LogFile, done chan bo
select {
case <-done2:
t.Log("Child completed before timeout (as expected)")
case <-time.After(time.Second * 10):
case <-time.After(time.Second * 20):
require.Fail(t, "timeout waiting for child")
}
t.Log("Verify 1st temp file was auto deleted.")
Expand Down
1 change: 1 addition & 0 deletions translator/translate/otel/exporter/awsemf/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func (t *translator) Translate(c *confmap.Conf) (component.Config, error) {
if credentialsFileKey, ok := agent.Global_Config.Credentials[agent.CredentialsFile_Key]; ok {
cfg.AWSSessionSettings.SharedCredentialsFile = []string{fmt.Sprintf("%v", credentialsFileKey)}
}
cfg.AWSSessionSettings.RoleARN = agent.Global_Config.Role_arn
cfg.AWSSessionSettings.IMDSRetries = retryer.GetDefaultRetryNumber()

if isEcs(c) {
Expand Down
5 changes: 5 additions & 0 deletions translator/translate/otel/exporter/awsemf/translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ import (
"go.opentelemetry.io/collector/confmap"

legacytranslator "github.com/aws/amazon-cloudwatch-agent/translator"
"github.com/aws/amazon-cloudwatch-agent/translator/translate/agent"
)

var nilSlice []string
var nilMetricDescriptorsSlice []awsemfexporter.MetricDescriptor

func TestTranslator(t *testing.T) {
tt := NewTranslator()
agent.Global_Config.Region = "us-east-1"
agent.Global_Config.Role_arn = "global_arn"
require.EqualValues(t, "awsemf", tt.ID().String())
testCases := map[string]struct {
env map[string]string
Expand Down Expand Up @@ -675,6 +678,8 @@ func TestTranslator(t *testing.T) {
require.Equal(t, testCase.want["resource_to_telemetry_conversion"], gotCfg.ResourceToTelemetrySettings)
require.ElementsMatch(t, testCase.want["metric_declarations"], gotCfg.MetricDeclarations)
require.ElementsMatch(t, testCase.want["metric_descriptors"], gotCfg.MetricDescriptors)
require.Equal(t, "global_arn", gotCfg.RoleARN)
require.Equal(t, "us-east-1", gotCfg.Region)
}
})
}
Expand Down

0 comments on commit d75e9ed

Please sign in to comment.