-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Alternative implementation of XML parser #8121
Conversation
I think I would like to combine functionality from both. Of course, if you approve of it. |
It looks like the test timed out because it didn’t return any information for 10 minutes. |
Friends, @ssoroka, @reimda, anyone? :( As I wrote earlier, now, to work with XML, I have made a wrapper for the parser and work with it as with an external processor, but not everything is as good with it as I would like.
The reason is clear, but the point is that we have to work with such large metrics. We are looking forward to the news. |
Taking this opportunity, I want to share a solution that we use to break down a metric that contains the result of parsing an array in an array into separate metrics:
[[processors.strings]]
order = 1
namepass = [ "measurement" ]
[[processors.strings.trim_prefix]]
field_key = "*"
prefix = "NODE_"
[[processors.strings.trim_prefix]]
tag_key = "*"
prefix = "NODE_"
[[processors.starlark]]
order = 4
namepass = [ "measurement" ]
source = '''
def apply(metric):
ids = []
for v in metric.fields.keys():
id = v.split("_")[0]
if id.isdigit() and id not in ids:
ids.append(id)
if len(ids) > 0:
metrics = []
for id in ids:
m = deepcopy(metric)
for k, v in m.fields.items():
if k.startswith("%s_" % (id)):
new_field = k.replace("%s_" % (id), "")
m.fields[new_field] = v
m.fields.pop(k, None)
metrics.append(m)
return metrics
else:
return metric
'''
|
Linked - #6968 |
XML Input Issue #1758 |
@ssoroka ah, never mind. I'll adjust to the accepted implementation. |
@M0rdecay we're going to work on getting it merged soon. I do want to give you a chance to provide your feedback on the other PR. If there's anything you would like to see added, please add a comment to the other PR. feel free to do a full review and bring up any cases you want to see supported right away. Thanks for your work here! I appreciate it. |
Required for all PRs:
@ssoroka, @srebhan, please take a look.
This is a slightly different implementation of the parser from PR #7460.
This version is closer to the json parser.
This parser, on the one hand, is less flexible than other proposed solutions, on the other hand, due to naming similar to that used in the json parser, it does not lose data if the names of nodes or attributes are repeated.
I would like to know your opinion.