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

Calculated service metrics to capture request name containing regex


Hello, team!


I try to create a calculated service metric. It must capture request like: /projects/{projectId}/files/**

For example: projects/platform_features/files/help/

When I create a metric, I use the condition "request name contains regex /project\/.*\/files/.*[a-zA-Z0-9]" - this condition doesn't work, because in metric there is "no data", but I see these requests in MDA.

I tried to use another regex: /project/[a-zA-Z0-9]*/files/.*[a-zA-Z0-9] - but Dynatrace show me the message "Greedy or lazy character classes are not allowed, please use a possessive quantifier instead."

And I tried the third variant: /project/[a-zA-Z0-9]/files/.*[a-zA-Z0-9] - Dynatrace doesn't show me an error, but when I try check this regex in - it's an "invalid expression".


Could you help me?


Hi @Fisher,

2 things with Your regexes -

  • 1st You forgetting to escape special char "/" which should always be "\/" - even thou some engines accept unescaped "/" is highly recommended to do so. Every one You posted here have this issue in one or more places
  • 2nd don't use .*[set] as way out of greedy/lazy/possessive as it won't work and will cause mess.

I Believe You were looking for:



Small tip for future with regexes 🙂

  • +,*          is greedy - takes as much as possible - You don't want that (mostly)
  • ++, *+    is possessive - takes as much as needed - You usually want that (with rules and filtering)
  • +?, *?     is lazy - takes as few as needed - You might want that (with capturing)

Thank you, Michal.

But it doesn't work(

I still can't see data in this calculated metric

DynaMight Champion
DynaMight Champion

Hello from Nightmare... 




Romanenkov Alex





Colleagues,  thanks for help!

But trouble was so easy - I missed letter "s" in word project 

I'm sorry!

Hi @Fisher thank you for sharing what the solution happened to be! Even though it was a typo, it started a discussion that I think many people will find useful! 

The only constant is change. Finding ways for great things to happen!

Featured Posts