Conversation
deployment_name_from_replicaset to k8sattributes processordeployment_name_from_replicaset to k8sattributes processor
Contributor
🔍 Dependency Reviewgithub.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor grafana/opentelemetry-collector-contrib@73458b01ab23 (replace) -> v0.139.0 (upstream)Status: Summary:
Required code updates:
Suggested diffs (matching the changes already in this PR):
--- a/internal/component/otelcol/processor/k8sattributes/types.go
+++ b/internal/component/otelcol/processor/k8sattributes/types.go
@@ -17,15 +17,17 @@ func (args FieldExtractConfig) convert() map[string]interface{} {
}
type ExtractConfig struct {
- Metadata []string `alloy:"metadata,attr,optional"`
- Annotations []FieldExtractConfig `alloy:"annotation,block,optional"`
- Labels []FieldExtractConfig `alloy:"label,block,optional"`
- OtelAnnotations bool `alloy:"otel_annotations,attr,optional"`
+ Metadata []string `alloy:"metadata,attr,optional"`
+ Annotations []FieldExtractConfig `alloy:"annotation,block,optional"`
+ Labels []FieldExtractConfig `alloy:"label,block,optional"`
+ OtelAnnotations bool `alloy:"otel_annotations,attr,optional"`
+ DeploymentNameFromReplicaSet bool `alloy:"deployment_name_from_replicaset,attr,optional"`
}
func (args ExtractConfig) convert() map[string]interface{} {
...
return map[string]interface{}{
- "metadata": args.Metadata,
- "annotations": annotations,
- "labels": labels,
- "otel_annotations": args.OtelAnnotations,
+ "metadata": args.Metadata,
+ "annotations": annotations,
+ "labels": labels,
+ "otel_annotations": args.OtelAnnotations,
+ "deployment_name_from_replicaset": args.DeploymentNameFromReplicaSet,
}
}
--- a/internal/converter/internal/otelcolconvert/converter_k8sattributesprocessor.go
+++ b/internal/converter/internal/otelcolconvert/converter_k8sattributesprocessor.go
@@ -55,10 +55,11 @@ func toK8SAttributesProcessor(state *State, id componentstatus.InstanceID, cfg *
AuthType: string(cfg.AuthType),
Passthrough: cfg.Passthrough,
ExtractConfig: k8sattributes.ExtractConfig{
- Metadata: cfg.Extract.Metadata,
- Annotations: toFilterExtract(cfg.Extract.Annotations),
- Labels: toFilterExtract(cfg.Extract.Labels),
- OtelAnnotations: cfg.Extract.OtelAnnotations,
+ Metadata: cfg.Extract.Metadata,
+ Annotations: toFilterExtract(cfg.Extract.Annotations),
+ Labels: toFilterExtract(cfg.Extract.Labels),
+ OtelAnnotations: cfg.Extract.OtelAnnotations,
+ DeploymentNameFromReplicaSet: cfg.Extract.DeploymentNameFromReplicaSet,
},
Filter: k8sattributes.FilterConfig{
Node: cfg.Filter.Node,
--- a/internal/component/otelcol/processor/k8sattributes/k8sattributes_test.go
+++ b/internal/component/otelcol/processor/k8sattributes/k8sattributes_test.go
@@ -26,6 +26,8 @@ func Test_Extract(t *testing.T) {
"k8s.job.name",
"k8s.node.name",
]
+
+ deployment_name_from_replicaset = true
}
output {
@@ -44,6 +46,8 @@ func Test_Extract(t *testing.T) {
extract := &otelObj.Extract
require.Equal(t, []string{"k8s.namespace.name", "k8s.job.name", "k8s.node.name"}, extract.Metadata)
+
+ require.True(t, extract.DeploymentNameFromReplicaSet)
}Operational considerations:
Evidence:
-// Use Grafana's patched k8sattributesprocessor with support for k8s.io/client-go v0.34.1
-replace github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor => github.com/grafana/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.0.0-20251021125353-73458b01ab23
Notes
|
Contributor
|
💻 Deploy preview available (feat: add missing configuration parameter |
kgeckhart
approved these changes
Jan 6, 2026
Comment on lines
-104
to
-107
| - comment: Use Grafana's patched k8sattributesprocessor with support for k8s.io/client-go v0.34.1 | ||
| dependency: github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor | ||
| replacement: github.com/grafana/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.0.0-20251021125353-73458b01ab23 | ||
|
|
Contributor
There was a problem hiding this comment.
Yay for one less replacement, did this happen because upstream was on a lower version that has since been upgraded?
Contributor
Author
There was a problem hiding this comment.
Yup. Happened ~a couple months ago open-telemetry/opentelemetry-collector-contrib#43890
Contributor
|
💻 Deploy preview deleted (feat: Add missing configuration parameter |
Draft
Merged
3 tasks
dehaansa
added a commit
that referenced
this pull request
Jan 6, 2026
blewis12
pushed a commit
that referenced
this pull request
Jan 7, 2026
…caset` to k8sattributes processor (#5183) Add missing configuration parameter to k8sattributes processor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief description of Pull Request
Add
deployment_name_from_replicasetattribute to k8sattributes processor supporting extraction of deployment name from replica set.Pull Request Details
Issue(s) fixed by this Pull Request
Notes to the Reviewer
PR Checklist