Skip to content

Add root-level cluster_name and standardize collection_interval for OpenTelemetry features - #2189

Merged
jefchien merged 10 commits into
mainfrom
zeus-V2-json-configs
Jul 20, 2026
Merged

Add root-level cluster_name and standardize collection_interval for OpenTelemetry features#2189
jefchien merged 10 commits into
mainfrom
zeus-V2-json-configs

Conversation

@Paamicky

@Paamicky Paamicky commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description of the issue

The OpenTelemetry config section was inconsistent: cluster_name had to be set separately on each feature, and the collection interval field was named differently across features (metrics_collection_interval vs collection_interval).

Description of changes

  • Single root-level cluster_name: Moved to opentelemetry.cluster_name so one value applies to all features (Container Insights, Prometheus, Host Metrics, OTLP) instead of being repeated per component. Container Insights requires it; the others apply it when present.
  • Standardized collection_interval: All OpenTelemetry features now use collection_interval (Host Metrics was renamed from metrics_collection_interval). Database Insights keeps its own intervals.
  • cluster_name validation moved to the schema: The per-feature Go regex checks were removed in favor of a single pattern in schema.json, validated before translation.
  • mode → role: Renamed the Container Insights field to align with the CWAGENT_ROLE environment variable.
  • Schema updated to reflect the new root-level cluster_name, standardized collection_interval, and role field.

Tests

  • Unit tests for the root-level cluster_name behavior (applied when set, absent when not) and schema validation of invalid names.
  • Updated Container Insights (role), Host Metrics (collection_interval), and Prometheus translator tests.
  • Updated golden files across the affected sample configs.

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Paamicky Paamicky added the ready for testing Indicates this PR is ready for integration tests to run label Jul 9, 2026
@Paamicky
Paamicky marked this pull request as ready for review July 9, 2026 16:17
@Paamicky
Paamicky requested a review from a team as a code owner July 9, 2026 16:17
@Paamicky Paamicky changed the title Add root-level cluster_name and standardize collection_interval for … Add root-level cluster_name and standardize collection_interval for OpenTelemetry features Jul 9, 2026
@Paamicky
Paamicky removed the request for review from a team July 10, 2026 16:54
Comment thread translator/tocwconfig/sampleConfig/opentelemetry/combined_v1_v2_ec2_config.yaml Outdated
@Paamicky
Paamicky force-pushed the zeus-V2-json-configs branch 2 times, most recently from 23cab82 to 59cea26 Compare July 10, 2026 20:25
mitali-salvi
mitali-salvi previously approved these changes Jul 13, 2026
Comment thread translator/translate/otel/common/common.go Outdated
Comment thread translator/translate/otel/common/common.go Outdated
Comment thread translator/translate/otel/common/common.go Outdated
@Paamicky
Paamicky force-pushed the zeus-V2-json-configs branch from d7d65ea to 23ade6b Compare July 14, 2026 20:43
"opentelemetry": map[string]interface{}{
"collect": map[string]interface{}{
"container_insights": map[string]interface{}{
"cluster_name": "test-cluster",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like the cluster_name field is still showing up under container_insights section instead of showing up under opentelemetry/collect section, mind updating this please ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@Paamicky
Paamicky force-pushed the zeus-V2-json-configs branch 2 times, most recently from 5689959 to 65265df Compare July 16, 2026 19:12
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Binary Size Report

linux/amd64

Binary PR vs main (7b0a665) vs v1.300070.0
amazon-cloudwatch-agent 193.2 MB ${\color{red}▲}$ +8.2 KB (+0.0%) ${\color{green}▼}$ 38.1 MB (-16.5%)
amazon-cloudwatch-agent-config-wizard 2.0 MB +0 B ${\color{red}▲}$ +86.0 KB (+4.5%)
config-downloader 2.0 MB +0 B ${\color{red}▲}$ +86.0 KB (+4.5%)
config-translator 2.0 MB +0 B ${\color{red}▲}$ +86.0 KB (+4.5%)
start-amazon-cloudwatch-agent 2.5 MB +0 B ${\color{red}▲}$ +81.9 KB (+3.4%)
workload-discovery 3.0 MB +0 B ${\color{red}▲}$ +86.0 KB (+2.9%)
Total 204.8 MB ${\color{red}▲}$ +8.2 KB (+0.0%) ${\color{green}▼}$ 37.7 MB (-15.5%)
linux/amd64 amazon-cloudwatch-agent (last 9 main commits + this PR)

 235 ┤                                        
     ┤███ ███ ███ ███ ███ ███ ███ ███         
     ┤███ ███ ███ ███ ███ ███ ███ ███         
     ┤███ ███ ███ ███ ███ ███ ███ ███         
     ┤███ ███ ███ ███ ███ ███ ███ ███         
     ┤███ ███ ███ ███ ███ ███ ███ ███         
     ┤███ ███ ███ ███ ███ ███ ███ ███         
     ┤███ ███ ███ ███ ███ ███ ███ ███         
 191 ┤███ ███ ███ ███ ███ ███ ███ ███ ▄▄▄ ▄▄▄ 
 MB  └────────────────────────────────────────
      11fef6f                             PR

Notable changes:

linux/arm64
Binary PR vs main (7b0a665) vs v1.300070.0
amazon-cloudwatch-agent 176.9 MB +0 B ${\color{green}▼}$ 34.5 MB (-16.3%)
amazon-cloudwatch-agent-config-wizard 2.0 MB +0 B ${\color{green}▼}$ 22 B (-0.0%)
config-downloader 2.0 MB +0 B ${\color{green}▼}$ 22 B (-0.0%)
config-translator 2.0 MB +0 B ${\color{green}▼}$ 22 B (-0.0%)
start-amazon-cloudwatch-agent 2.4 MB +0 B ${\color{red}▲}$ +65.5 KB (+2.8%)
workload-discovery 2.9 MB +0 B ${\color{red}▲}$ +65.5 KB (+2.3%)
Total 188.2 MB +0 B ${\color{green}▼}$ 34.4 MB (-15.5%)
windows/amd64
Binary PR vs main (7b0a665) vs v1.300070.0
amazon-cloudwatch-agent.exe 196.0 MB ${\color{red}▲}$ +12.3 KB (+0.0%) ${\color{green}▼}$ 38.2 MB (-16.3%)
amazon-cloudwatch-agent-config-wizard.exe 2.1 MB +0 B ${\color{red}▲}$ +130.6 KB (+6.5%)
config-downloader.exe 2.1 MB +0 B ${\color{red}▲}$ +130.0 KB (+6.5%)
config-translator.exe 2.1 MB +0 B ${\color{red}▲}$ +130.6 KB (+6.5%)
start-amazon-cloudwatch-agent.exe 2.3 MB +0 B ${\color{red}▲}$ +112.1 KB (+5.2%)
workload-discovery.exe 2.9 MB +0 B ${\color{red}▲}$ +91.6 KB (+3.3%)
Total 207.6 MB ${\color{red}▲}$ +12.3 KB (+0.0%) ${\color{green}▼}$ 37.6 MB (-15.3%)
Investigating size changes

Use go-size-analyzer to compare binaries:

GOEXPERIMENT=jsonv2 go install github.com/Zxilly/go-size-analyzer/cmd/gsa@latest
gsa diff --old <baseline-binary> --new <new-binary>

mitali-salvi
mitali-salvi previously approved these changes Jul 17, 2026
Comment thread translator/tocwconfig/sampleConfig/opentelemetry/combined_v1_v2_ec2_config.yaml Outdated
Comment thread translator/translate/otel/common/common.go Outdated
Comment thread translator/translate/otel/pipeline/opentelemetry/otlp/translator.go Outdated
Comment thread translator/config/schema.json Outdated
Comment thread translator/translate/otel/pipeline/opentelemetry/containerinsights/common.go Outdated
Comment thread translator/tocwconfig/tocwconfig_test.go Outdated
@Paamicky
Paamicky force-pushed the zeus-V2-json-configs branch 2 times, most recently from ba39f5f to ec09e03 Compare July 19, 2026 05:04
@Paamicky
Paamicky force-pushed the zeus-V2-json-configs branch from 384e0a9 to 7acb80a Compare July 20, 2026 19:21
@Paamicky
Paamicky force-pushed the zeus-V2-json-configs branch from 115f621 to d1a157e Compare July 20, 2026 19:38
@Paamicky
Paamicky force-pushed the zeus-V2-json-configs branch from d1a157e to f42dcc3 Compare July 20, 2026 20:57
func GetClusterName(conf *confmap.Conf) string {
val, ok := GetString(conf, ConfigKey(LogsKey, MetricsCollectedKey, KubernetesKey, "cluster_name"))
if ok && val != "" {
func GetClusterName(conf *confmap.Conf, key string) string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread translator/config/schema.json Outdated
"cluster_name": {
"description": "The name of the K8s cluster. Applied to all telemetry collected under opentelemetry.",
"type": "string",
"pattern": "^[0-9A-Za-z][A-Za-z0-9\\-_]*$"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

processors.Set(k8sattributesprocessor.NewTranslator(common.OpenTelemetryKey))
}
// Apply root-level cluster name if set
clusterName := common.GetClusterName(conf, common.OtelClusterNameKey)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - this block of code seems to be repeating across the metric, logs and traces pipeline, might be worth moving into a common helper function

@jefchien
jefchien merged commit e6b40ae into main Jul 20, 2026
360 of 417 checks passed
@jefchien
jefchien deleted the zeus-V2-json-configs branch July 20, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for testing Indicates this PR is ready for integration tests to run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants