-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[processor/k8sattributes] Deprecate and remove FieldExtractConfig.Regex config option #25128
Comments
This seems to place a requirement for a collector build to include the transform processor to match this behavior. Is introducing the requirement of a separate processor the best choice for all users? Or should the k8sattr processor be able to do this in isolation? I think this could turn into a more meta question for the collector community. How do we decide that a dependency on another component is the correct choice? For example for the tail sampling processor, there's a soft (hard?) dependency on the group by trace processor. I don't even know if the group by tail sampling processor example is correct. That relationship may just be a "best practice" per say. The tail sampling processor has it's own |
This one is a pretty straightforward separation of concerns. Parsing of an attribute value has nothing to do with k8s. So it should not be part of this processor. It was added a long time ago as extra functionality before we had any option to parse attribute values. Now we have the transform processor, which includes this particular feature. So we are not putting any dependency on another component, we are just removing functionality that doesn't belong to k8s attributes processor. Please let me know if it makes sense. |
It may become less performant after this change, but I believe it's more important to keep a particular purpose for each component and avoid bloating and overcomplicating them with features that don't fit them. Happy to hear other opinions from @open-telemetry/collector-contrib-approvers |
I agree. |
if the proposal gets accepted, can pick up the work |
I agree. Holding to separation of concerns is a good idea. As for performance, we can benchmark it, but the transformprocessor is quite performant. We should not remove this feature from the processor, though, until the equivalent feature exists in the transformprocessor. It cannot currently extract new attributes using regex, we need to add the functionality via a new OTTL function. |
@TylerHelmuth k8sattributes:
extract:
annotations:
- tag_name: git.sha
key: kubernetes.io/change-cause
regex: GIT_SHA=(?P<value>\w+) should be replaceable with k8sattributes:
extract:
annotations:
- tag_name: git.sha
key: kubernetes.io/change-cause
transform:
metric_statements:
- context: resource
statements:
- delete(attributes["git.sha"]) where attributes["git.sha"] != nil and not IsMatch(attributes["git.sha"], "GIT_SHA=\w+")
- replace_pattern(attributes["git.sha"], "GIT_SHA=(\w+)", "$1") where attributes["git.sha"] != nil But if we had k8sattributes:
extract:
annotations:
- tag_name: k8s.change_cause
key: kubernetes.io/change-cause
transform:
metric_statements:
- context: resource
statements:
- extract(attributes, attributes["k8s.change_cause"], "GIT_SHA=(?P<git.sha>\w+)") where attributes["k8s.change_cause"] != nil
- delete(attributes["k8s.change_cause"]) where attributes["k8s.change_cause"] != nil Is this what you're thinking of? |
@dmitryax I forgot k8sattributes:
extract:
annotations:
- tag_name: git.sha
key: kubernetes.io/change-cause
transform:
metric_statements:
- context: resource
statements:
- delete(attributes["git.sha"]) where not IsMatch(attributes["git.sha"], "GIT_SHA=\w+")
- replace_pattern(attributes["git.sha"], "GIT_SHA=(\w+)", "$1") I see why it is so convenient to do the extraction within the k8sattributesprocessor - if you leave it for the transformprocessor then you have to explicitly check whether or not the attribute should be deleted. If we add an extract function we could add an optional param to help with this: k8sattributes:
extract:
annotations:
- tag_name: k8s.change_cause
key: kubernetes.io/change-cause
transform:
metric_statements:
- context: resource
statements:
- extract(attributes, attributes["k8s.change_cause"], "GIT_SHA=(?P<git.sha>\w+)", deleteOriginal=true) |
@TylerHelmuth LGTM. We should introduce that function before working on this issue to have simpler migration guidelines. Please see #25834 and edit it if necessary |
@dmitryax after working on #24599 for a bit I realized the existing extraction logic allows grabbing all the annotations/labels, which is really useful for users who want to grab everything. I believe the options we've discussed so far will remove that capability. I don't want to lose that feature, so if we move forward with removing |
We don't lose that feature with this proposal. I'm not asking to remove |
I just found and fixed a typo in the issue description which likely brought the confusion |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Hi, I would like to work on this issue cc @evan-bradley |
This comment was marked as resolved.
This comment was marked as resolved.
…ption (#33411) **Link to tracking Issue:** #25128 --------- Signed-off-by: odubajDT <ondrej.dubaj@dynatrace.com> Co-authored-by: Curtis Robert <crobert@splunk.com> Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com> Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>
The above comment was wrong as the scenario wasn't affected by the removal of the |
Is that now fixed by #33411? @TylerHelmuth can we close this issue? |
@ChrsMark do we still need to remove the deprecated code? |
@TylerHelmuth checking the PR I understand the deprecation happened in @odubajDT could you verify what's the status here? |
The gate is still in Alpha state, I would suggest moving it to Beta, wait 2 versions and then move it to stable (remove the deprecated code completely). I can open a PR to move it to Beta |
@bogdandrutu should we keep this open until the deprecated code is entirely removed based on the above comment? |
The configuration interface of the k8sattributes receiver is over-complicated. This is an attempt to simplify it a bit.
FieldExtractConfig
haveKeyRegex
andRegex
options, which is pretty confusing. TheRegex
config option doesn't seem to be very important. I can be easily replaced with a transform processor withreplace_pattern
andreplace_match
functions. Therefore, I suggest:FieldExtractConfig.Regex
option with instructions on how to replace it with the transform processorThe text was updated successfully, but these errors were encountered: