ripienaar / graphite-graph-dsl

A small DSL to describe graphite graphs
http://www.devco.net/
Apache License 2.0
167 stars 43 forks source link

Added support for %{var} like placholders in graph url (titles, data etc...) #9

Closed tanelj closed 12 years ago

tanelj commented 12 years ago

Hi!

I have added support for %{var} like placeholders that allows user to use them anywhere in graph url.

Example usage in config file:

placeholders :host => 'myhost', :country => 'uk'
title 'Data for %{host} (%{country})'

field :first,
  :alias => '%{country} max',
  :data  => '%{host}.countries.%{country}.max'

field :second,
  :alias => '%{country} avg',
  :data  => '%{host}.countries.%{country}.avg'

I have plan to implement and use this functionality in GDash to allow system/dashboard wide placeholders. (Eg country based dashboard that accepts country code as url parameter).

tanelj commented 12 years ago

Hi! Here is also a implemented example in GDash using this feature: https://github.com/tanelj/gdash/tree/templates

ripienaar commented 12 years ago

rebased and pushed this commit, thanks and sorry for the delay

ripienaar commented 12 years ago

I ported this in while doing some other backports from gdash, closing

keymon commented 11 years ago

In https://github.com/ripienaar/gdash/pull/74 we discuss that this functionality can be implemented just using normal ruby interpolation #{}. Should we keep this other format?