cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

help with Conditions in workflow

Kishore
Visitor

Hi,

We need to run a json flow only if the Davis problem parameters has particular entity tags like [Kubernetes]version where there are multiple attributes present in entity tags .Can you help in extracting this? below is a sample param object.

{
"event.id": "111111111",
"timestamp": "2023-10-01T15:26:08.427000000Z",
"display_id": "P-113232142",
"event.kind": "DAVIS_PROBLEM",
"event.name": "testing",
"entity_tags": [
"[Kubernetes]version:xxxxxxxxxx",
"[Kubernetes]kube-monkey/identifier:app",
"[Kubernetes]kube-monkey/enabled:enabled",
"Market:GROUP",
"[Kubernetes]version:6346347547547",
"[Kubernetes]type_manifest:customer"]
}

 

4 REPLIES 4

Kishore
Visitor

Below is a screenshot after executing the condition. Though the trigger has required tag, the flow is discarded saying the condition doesnt match. Please help!!

Kishore_0-1696320857158.png

 

jdidierpichat
Visitor

Hey @Kishore  did you find the solution ? I got the same problem on my side 😥

ChristopherHejl
Dynatrace Advisor
Dynatrace Advisor

The entity_tags property is an array/list. Therefore the string compare will always result in false.
However you can check if a value is in an array by using the "in" operator like the following example:

the event for example like so:

{ ...
"entity_tags": [
    "[Environment]DT_RELEASE_PRODUCT:easytrade",
    "[Environment]DT_RELEASE_VERSION:1.1.1",
    "[Kubernetes]namespace:easytrade-live-debugger",
    "k8s-namespace:easytrade-live-debugger"
  ],
  "event.category": ...
}

then this would match as a condition:

{{ "[Environment]DT_RELEASE_PRODUCT:easytrade" in event()["entity_tags"] }}

ChristopherHejl_1-1741789098145.png ChristopherHejl_0-1741789059804.png

 

Note: this makes sense if you only want a task to run for events which contain the tag and other tasks in other/all cases. If you want the whole workflow to run only for events containing this tag, this should go in the event filter in the first place. Tags are part of the filter UI

ChristopherHejl_2-1741789320186.png

 

 

jdidierpichat
Visitor

ty @ChristopherHejl 

you made my day ! 

I wasn't aware about the operator "in" to match value in an array. Kudo to you ! 

Featured Posts