Hi,
I would like to create a table with tags to an entity, for example, “dt.entity.sql:com_dynatrace_extension_sql-oracle_host”.
fetch `dt.entity.sql:com_dynatrace_extension_sql-oracle_host`
| fieldsAdd tags
Before query shows all tags combined as “field1:value,field2:value”… Those value are not ordered and not all rows contains same values.
Any option to adding those tags as as new fields/columns?
Best regards
Hi @AntonPineiro ,
“| expand tags” will not help here ? but this will add as rows.
Hi,
Not because I would like them as columns. It means, from this:
| entity.name |
id |
tags |
| x1 |
id1 |
field1:value, field2:value |
| x2 |
id2 |
field1:value, field3:value |
To:
| entity.name |
id |
tags |
field1 |
field2 |
field3 |
| x1 |
id1 |
field1:value, field2:value |
value |
value |
null |
| x2 |
id2 |
field1:value, field3:value |
value |
null |
value |
Best regards
Hi @AntonPineiro
May be you can try something like this ?
data record(entity.name = "x1", id = "id1", tags = array("field1:A","field2:C")),
record(entity.name = "x2", id = "id2", tags = array("field1:B","field3:D"))
| expand tags
| parse tags, "ld:key ':' ld:tag_value"
| fieldsAdd key,tag_value
| summarize { Key_value=collectArray(array(toString(key),tag_value)) }, by: {entity.name}
| fieldsAdd Key_value=toString(Key_value)
| parse Key_value, "'[' KVP{ '[' DQS:key ', ' DQS:value ']' ', '?}:key ']'"
| fieldsFlatten key
you will get a result like this, but not sure this will help you
Regards,
Akhil Jayendran
Hi,
This is a super awesome answer!! :money_mouth_face:
Thank you so much!
Best regards