24 Jun 2022 08:19 AM - last edited on 19 Oct 2022 03:00 PM by MaciejNeumann
Dear Dynatrace Team
I would like to Custom event alert via code
Which have requirement :
1. Metric : builtin:service.keyRequest.response.time
2. All request is key request
3. percentile : 95
4. But need to exclude only one request(i cannot move key request from this request because will use this request to dashboard)
Code for custom :
builtin:service.keyRequest.response.time:splitBy("dt.entity.service_method"):percentile(95):auto:sort(value(percentile(95),descending))
(Which this code will all service is key request to custom alert)
Question
1. Please provide condition code for move only one request from this custom alert
such as entityName.notequals(~"/api/service/ceee~")
Thank you.
Solved! Go to Solution.
24 Jun 2022 08:28 AM - edited 24 Jun 2022 08:31 PM
As I understand your question, you need to alert on all key requests response time 95h percentile except a single one. In this case, you need to solve it in a different way and using only include methods.
For example by using entityName.in("name1","name2") and specifying the requests or by tagging the services by a tag and using that tag in your filter or use the negate criterion as @mgome advises.
Also - are you really sure you need to have such an alert for all key requests in your environment?
24 Jun 2022 08:37 AM
Thank you for you reply.
Also - are you really sure you need to have such an alert for all key requests in your environment?
= Yes
for solution as you provided :
1. using entityName.in("name1","name2") and specifying the requests.
= i have many request to select for custom alert which i think that would be better if can move single request. Have condition code to move only one request?
2. by tagging the services by a tag and using that tag in your filter.
= Can i use code for move single request use tag ? Please provide condition code.
Thank you.
24 Jun 2022 05:11 PM
Negation is handled by wrapping in "not".
https://www.dynatrace.com/support/help/shortlink/api-entities-v2-selector#negate-criterion
Try wrapping entityName like this:
not(entityName.equals(~"/api/service/ceee~"))