Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ WIN_BUILD = GOOS=windows GOARCH=amd64 go build -trimpath -buildmode=${CWAGENT_BU
DARWIN_BUILD_AMD64 = CGO_ENABLED=1 GO111MODULE=on GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags="${LDFLAGS}" -o $(BUILD_SPACE)/bin/darwin_amd64
DARWIN_BUILD_ARM64 = CGO_ENABLED=1 GO111MODULE=on GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags="${LDFLAGS}" -o $(BUILD_SPACE)/bin/darwin_arm64

IMAGE_REGISTRY = amazon
IMAGE_REGISTRY = 506463145083.dkr.ecr.us-west-2.amazonaws.com
IMAGE_REPO = cloudwatch-agent
IMAGE_TAG = $(VERSION)
IMAGE_TAG = latest
IMAGE = $(IMAGE_REGISTRY)/$(IMAGE_REPO):$(IMAGE_TAG)
DOCKER_BUILD_FROM_SOURCE = docker build -t $(IMAGE) -f ./amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/source/Dockerfile
DOCKER_WINDOWS_BUILD_FROM_SOURCE = docker build -t $(IMAGE) -f ./amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/source/Dockerfile.Windows
Expand Down
6 changes: 6 additions & 0 deletions cmd/config-translator/translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ func TestMetricsDestinationsConfig(t *testing.T) {
expectedErrorMap["required"] = 1
checkIfSchemaValidateAsExpected(t, "../../translator/config/sampleSchema/invalidMetricsDestinations.json", false, expectedErrorMap)
}
func TestJmxConfig(t *testing.T) {
checkIfSchemaValidateAsExpected(t, "../../translator/config/sampleSchema/validContainerInsightsJmx.json", true, map[string]int{})
expectedErrorMap := map[string]int{}
expectedErrorMap["required"] = 1
//checkIfSchemaValidateAsExpected(t, "../../translator/config/sampleSchema/invalidContainerInsightsJmx.json", false, expectedErrorMap)
}

// Validate all sampleConfig files schema
func TestSampleConfigSchema(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion extension/agenthealth/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestLoadConfig(t *testing.T) {
},
}
for _, testCase := range testCases {
conf, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml"))
conf, err := confmaptest.LoadConf(filepath.Join("testdata", "ContainerInsightsJmxConfig.yaml"))
require.NoError(t, err)
cfg := NewFactory().CreateDefaultConfig()
sub, err := conf.Sub(testCase.id.String())
Expand Down
2 changes: 1 addition & 1 deletion processor/rollupprocessor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestLoadConfig(t *testing.T) {
},
}
for _, testCase := range testCases {
conf, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml"))
conf, err := confmaptest.LoadConf(filepath.Join("testdata", "ContainerInsightsJmxConfig.yaml"))
require.NoError(t, err)
cfg := NewFactory().CreateDefaultConfig()
sub, err := conf.Sub(testCase.id.String())
Expand Down
14 changes: 14 additions & 0 deletions translator/config/sampleSchema/invalidContainerInsightsJmx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"agent": {
"region": "us-west-2"
},
"logs": {
"metrics_collected": {
"emf": {
},
"kubernete": {
}
},
"force_flush_interval": 5
}
}
16 changes: 16 additions & 0 deletions translator/config/sampleSchema/validContainerInsightsJmx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"agent": {
"region": "us-west-2"
},
"logs": {
"metrics_collected": {
"emf": {
},
"kubernetes": {
"cluster_name": "jvmCluster",
"namespace":"siprmp-jmx"
}
},
"force_flush_interval": 5
}
}
26 changes: 26 additions & 0 deletions translator/tocwconfig/sampleConfig/container_insights_jmx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[agent]
collection_jitter = "0s"
debug = true
flush_interval = "1s"
flush_jitter = "0s"
hostname = ""
interval = "60s"
logfile = ""
logtarget = "lumberjack"
metric_batch_size = 1000
metric_buffer_limit = 10000
omit_hostname = false
precision = ""
quiet = false
round_interval = false

[outputs]

[[outputs.cloudwatch]]

[[outputs.cloudwatchlogs]]
force_flush_interval = "5s"
log_stream_name = "bcd0745edc19"
mode = "EC2"
region = "us-west-2"
region_type = "ACJ"
41 changes: 41 additions & 0 deletions translator/tocwconfig/sampleConfig/container_insights_jmx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"agent": {
"debug": true
},
"logs": {
"metrics_collected": {
"emf": { },
"kubernetes": {
"cluster_name": "TestCluster",
"jmx_container_insights": true
}
}
},
"metrics": {
"metrics_collected": {
"jmx": {
"jvm": {
"measurement": [
"jvm.classes.loaded",
"jvm.memory.pool.used",
"jvm.operating.system.total.swap.space.size",
"jvm.operating.system.system.cpu.load",
"jvm.operating.system.process.cpu.load",
"jvm.operating.system.free.swap.space.size",
"jvm.operating.system.total.physical.memory.size",
"jvm.operating.system.free.physical.memory.size",
"jvm.operating.system.open.file.descriptor.count",
"jvm.operating.system.available.processors",
"jvm.threads.count",
"jvm.memory.heap.used",
"jvm.memory.nonheap.init",
"jvm.threads.daemon"
]
}
}
},
"metrics_destinations": {
"cloudwatch": { }
}
}
}
Loading
Loading