Graphite template related functions

Graphite template parsing functions per InfluxDB’s Graphite service template syntax

exception influxgraph.templates.InvalidTemplateError

Raised on Graphite template configuration validation errors

exception influxgraph.templates.TemplateMatchError

Raised on errors matching template with path

class influxgraph.templates.TemplateFilter(pattern)

Filter metric paths on template pattern


Check if path matches template pattern

Parameters:path (str) – Graphite path to check
Return type:bool

Go through split sub-paths and pattern’s sub-paths and check if pattern matches all sub-paths

Parameters:split_path (list(str)) – Graphite metric path split on separator
influxgraph.templates.apply_template(metric_path_parts, template, default_tags, separator='.')

Apply template to metric path parts and return measurements, tags and field

Raises:mod:TemplateMatchError on error matching template
influxgraph.templates.get_series_with_tags(paths, all_fields, graphite_templates, separator='.')

Get list of metric paths from list of InfluxDB series with tags and configured graphite templates if any.

Without graphite template configuration tags are dropped and only the series name is used.

Perform heap sort on iterable

Parameters:iterable – Iterable with (index, value) tuple entries to sort

on index value. index must be integer, value can be anything :type iterable: tupleiterator

influxgraph.templates.parse_influxdb_graphite_templates(templates, separator='.')

Parse InfluxDB template configuration and return parsed templates

  • templates (list(str)) – Template patterns to parse. Format is [filter] <template> [tag1=value1,tag2=value2]
  • separator (str) – (Optional) Separator to use when storing greedy matched columns

InvalidTemplateError on invalid template format used in any

template pattern