Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Add a grep function that returns metrics that match a regular expression #151

merged 1 commit into from

3 participants


Shell style globing and exclusion lists aren't always powerful enough.

@whilp whilp referenced this pull request in monitorama/hackathon

Improve search in graphite-web #7


@nightfly19 Can you make that minor change that @SEJeff mentioned? I'd :heart: to merge this in.


Looks good


It occurred to me afterwards that we're missing the UI bits for this. But it needn't hold up this PR imho.


Oops, updated to include the new function in the composer.

@obfuscurity obfuscurity merged commit 1b6fbfc into graphite-project:master

Thanks @nightfly19!

:cake: :sparkles: :heart_eyes_cat: :cherries:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 28, 2013
  1. @nightfly19

    Add a grep function that returns metrics that match a regular expression

    nightfly19 authored
    The opposite behavior of exclude
This page is out of date. Refresh to see the latest.
1  webapp/content/js/composer_widgets.js
@@ -959,6 +959,7 @@ function createFunctionsMenu() {
{text: 'sortByMinima', handler: applyFuncToEach('sortByMinima')},
{text: 'limit', handler: applyFuncToEachWithInput('limit', 'Limit to first ___ of a list of metrics')},
{text: 'Exclude', handler: applyFuncToEachWithInput('exclude', 'Exclude metrics that match a regular expression')}
+ {text: 'Grep', handler: applyFuncToEachWithInput('grep', 'Exclude metrics that don\'t match a regular expression')}
}, {
text: 'Special',
15 webapp/graphite/render/
@@ -2312,6 +2312,21 @@ def exclude(requestContext, seriesList, pattern):
return [s for s in seriesList if not]
+def grep(requestContext, seriesList, pattern):
+ """
+ Takes a metric or a wildcard seriesList, followed by a regular expression
+ in double quotes. Excludes metrics that don't match the regular expression.
+ Example:
+ .. code-block:: none
+ &target=grep(servers*.instance*.threads.busy,"server02")
+ """
+ regex = re.compile(pattern)
+ return [s for s in seriesList if]
def smartSummarize(requestContext, seriesList, intervalString, func='sum', alignToFrom=False):
Smarter experimental version of summarize.
Something went wrong with that request. Please try again.