Add root-level cluster_name and standardize collection_interval for OpenTelemetry features#2189
Add root-level cluster_name and standardize collection_interval for OpenTelemetry features#2189Paamicky wants to merge 9 commits into
Conversation
| transform/set_cluster_name: | ||
| error_mode: ignore | ||
| flatten_data: false | ||
| log_statements: | ||
| - context: resource | ||
| error_mode: ignore | ||
| statements: | ||
| - set(resource.attributes["k8s.cluster.name"], "TestCluster") | ||
| metric_statements: [] | ||
| trace_statements: [] |
There was a problem hiding this comment.
Shouldn't this have resource statements for each of the resource types? I see the same processor is being used in metric pipelines as well.
There was a problem hiding this comment.
Fixed. otlp logs now uses its own processor (transform/set_cluster_name_logs) so it doesn't overwrite the metric_statements used by the metrics pipelines
There was a problem hiding this comment.
Can't they share a single transform processor?
There was a problem hiding this comment.
Fixed. set_cluster_name now registers with both metric_statements and log_statements in a single processor. Pipelines will use statements relevant to its signal.
WithTraceResourceStatements is not yet supported in the transform processor.
// Traces are not handled: WithTraceResourceStatements is not yet supported.
// Traces sent via OTLP on EKS should include k8s.cluster.name from the SDK.
This will need a separate PR if we want to add it.
…OpenTelemetry features
…OpenTelemetry features
fa8f4e5 to
23cab82
Compare
23cab82 to
59cea26
Compare
|
|
||
| // GetCollectionInterval returns the collection interval for an OpenTelemetry feature. | ||
| // It checks the feature-specific collection_interval field. Default is 30s. | ||
| func GetCollectionInterval(conf *confmap.Conf, featureKey string) time.Duration { |
There was a problem hiding this comment.
This does the exact same thing as GetOrDefaultDuration
There was a problem hiding this comment.
yeah removed to use the already existing function: GetOrDefaultDuration
|
|
||
| // GetOtelClusterName returns the cluster name for OpenTelemetry-based features. | ||
| // It reads exclusively from opentelemetry::cluster_name. | ||
| func GetOtelClusterName(conf *confmap.Conf) string { |
There was a problem hiding this comment.
I don't think we need a separate function for this.
There was a problem hiding this comment.
removed the function wrapper and defined inline at each call site.
| } | ||
|
|
||
| // DefaultCollectionInterval is the default collection interval for OpenTelemetry-based features. | ||
| const DefaultCollectionInterval = 30 * time.Second |
There was a problem hiding this comment.
Don't define this here. It doesn't apply to all cases of collection interval. It's only for the opentelemetry pipelines.
There was a problem hiding this comment.
Moved to a local constant in each package that uses it.
d7d65ea to
23ade6b
Compare
Description of the issue
The OpenTelemetry config section had two inconsistencies: cluster_name was required per-component, forcing customers to repeat the same cluster value for every feature, and the collection interval field name differed across features (metrics_collection_interval vs collection_interval). This has been updated to use the newer version
collection_interval.Description of changes
cluster_name: Moved toopentelemetry.cluster_name. A single value now applies to all features (Container Insights, Prometheus, Host Metrics, OTLP). Container Insights and Prometheus require it; Host Metrics and OTLP apply it when present.collection_interval: All OpenTelemetry features now use collection_interval with a 30-second default. Host Metrics renamed frommetrics_collection_interval. Database Insights retains its own hardcoded intervals.cluster_namefield and standardizedcollection_intervalacross features.CWAGENT_ROLEenvironmentvariable naming.
Tests
GetOtelClusterNameverifies root-level reads, env var is not used as fallback, empty config returns emptyLicense
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.