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

EMF Exporter does not forward metrics if IRSA is enabled #915

Merged
merged 14 commits into from
Oct 23, 2023
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):
SaxyPandaBear marked this conversation as resolved.
Show resolved Hide resolved
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
SaxyPandaBear marked this conversation as resolved.
Show resolved Hide resolved
cfg.AWSSessionSettings.IMDSRetries = retryer.GetDefaultRetryNumber()

if isEcs(c) {
Expand Down
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