From 7329e2dc62255e5e7a368d6900dbfce81c49d182 Mon Sep 17 00:00:00 2001 From: Andrej Ocenas Date: Wed, 11 Oct 2023 17:57:01 +0200 Subject: [PATCH] Flamegraph: Fix inefficient regex generating error on some function names (#76377) --- packages/grafana-flamegraph/src/FlameGraph/colors.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/grafana-flamegraph/src/FlameGraph/colors.ts b/packages/grafana-flamegraph/src/FlameGraph/colors.ts index b8b8a472ff8..5e7a5c868e1 100644 --- a/packages/grafana-flamegraph/src/FlameGraph/colors.ts +++ b/packages/grafana-flamegraph/src/FlameGraph/colors.ts @@ -112,9 +112,9 @@ export function getBarColorByDiff( // the language from the backend and use the right regex but right now we just try all of them from most to least // specific. const matchers = [ - ['phpspy', /^(?(.*\/)*)(?.*\.php+)(?.*)$/], - ['pyspy', /^(?(.*\/)*)(?.*\.py+)(?.*)$/], - ['rbspy', /^(?(.*\/)*)(?.*\.rb+)(?.*)$/], + ['phpspy', /^(?([^\/]*\/)*)(?.*\.php+)(?.*)$/], + ['pyspy', /^(?([^\/]*\/)*)(?.*\.py+)(?.*)$/], + ['rbspy', /^(?([^\/]*\/)*)(?.*\.rb+)(?.*)$/], [ 'nodespy', /^(\.\/node_modules\/)?(?[^/]*)(?.*\.?(jsx?|tsx?)?):(?.*):(?.*)$/,