Commit 30acd879 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

doc: gauges doc wip

parent 9013a58e
Loading
Loading
Loading
Loading
+1 −24
Original line number Diff line number Diff line
@@ -14,30 +14,7 @@ require "redcarpet"
require 'digest/md5'

def gfm(text)
  return text
  # Extract pre blocks
  extractions = {}
  text.gsub!(%r{<pre>.*?</pre>}m) do |match|
    md5 = Digest::MD5.hexdigest(match)
    extractions[md5] = match
    "{gfm-extraction-#{md5}}"
  end

  # prevent foo_bar_baz from ending up with an italic word in the middle
  text.gsub!(/(^(?! {4}|\t)\w+_\w+_\w[\w_]*)/) do |x|
    x.gsub('_', '\_') if x.split('').sort.to_s[0..1] == '__'
  end

  # in very clear cases, let newlines become <br /> tags
  text.gsub!(/^[\w\<][^\n]*\n+/) do |x|
    x =~ /\n{2}/ ? x : (x.strip!; x << "  \n")
  end

  # Insert pre block extractions
  text.gsub!(/\{gfm-extraction-([0-9a-f]{32})\}/) do
    "\n\n" + extractions[$1]
  end

  text.gsub!(/`([^`]+)`/, '<code>\1</code>')
  text
end

+6 −3
Original line number Diff line number Diff line
@@ -5,15 +5,18 @@ sitemap:

  fnordmetric_ui:
    -
      title: "Getting started"
      title: "Getting Started"
      url: "/ui_index"

  fnordmetric_classic:
    -
      title: "Getting started"
      title: "Getting Started"
      url: "/classic_index"
    -
      title: "Gauges"
      url: "/classic_gauges"

  fnordmetric_enterprise:
    -
      title: "Getting started"
      title: "Getting Started"
      url: "/ui_index"
+57 −0
Original line number Diff line number Diff line
Gauges
------

The basic concept in FnordMetric is called a "gauge". A Gauge is a primitive data store for a numerical value over
time. A gauge has two dimensions: Value und Time. Gauges can be used in different modes like sum,
average, max/min, etcetara.


### Create gauges on the fly

The easiest way to submit data to FnordMetric are zero-config gauges. These
are very similar to counters in Statsd: you don't have to create the gauges
upfront, they are automatically created as you send events. These events have
to follow a strict schema:
<hr class="space" />

Example: _Increment the gauge `sales-per-second` by 4, gauge resolution is 1 second._

    { "_type": "_incr", "value": 4, "gauge": "sales-per-second", "flush_interval": 1 }

Example: _Sample average request time (this sample: 42ms), gauge resolution is 10 seconds._

    { "_type": "_avg", "value": 42, "gauge": "avg-request-time", "flush_interval": 10 }


Valid keys for these events are:

<table>
  <tr>
    <th><b>_type</b> <i>(mandatory)</i></th>
    <td>
      the operation to perform

      <p>allowed values are `_incr`, `_decr` and `_set` to
      increment, decrement and set counters and `_avg`, `_min`, `_max` to sample
      average, minimum or maximum values.</p>
    </td>
  </tr>
  <tr>
    <th><b>gauge</b> <i>(mandatory)</i></th>
    <td>
      name of the gauge. if it does not exist it will be created.
    </td>
  </tr>
  <tr>
    <th><b>flush_interval</b> <i>(mandatory)</i></th>
    <td>
      interval in which the value of this gauge is persisted. this is basically the
      gauge's resolution.
    </td>
  </tr>
</table>
<br />

### Create gauges by hand

FnordMetric also offers an api to create these gauges by hand.
+55 −2
Original line number Diff line number Diff line
@@ -151,8 +151,8 @@ hr {
}

#navigation ul li {
  font-size: 12px;
  line-height:23px;
  font-size: 14px;
  line-height:26px;
}

#navigation ul li a {
@@ -209,3 +209,56 @@ hr {
#documentation a:hover {
  text-decoration: underline;
}

code {
  padding: 2px 5px;
  font-family: "Monaco", monospace;
  background-color: #f8f8f8;
  border: 1px solid #cacaca;
  border-radius: 3px;
  text-shadow: 0 1px 0 #fff;
  overflow: auto;
  font-size:12px;
}

pre code {
  padding: 10px 15px;
}

pre {
  margin-bottom: 25px;
}

hr.space {
  border: none;
  margin: 0;
  padding: 0;
}

table {
  border-collapse: collapse;
}

table td, table th {
  padding: 6px 13px;
  border: 1px solid #ccc;
}

table th {
  font-weight: 600;
  color: #333;
}

table th i {
  font-weight: 400;
  font-size: 12px;
}

table tr:nth-child(2) {
  background-color: #f8f8f8;
}

table td p {
  margin-bottom: 0;
  padding-bottom: 0;
}