Commit Graph

79 Commits

Author SHA1 Message Date
Toby Lawrence 94785a8765
metrics: bump to 0.10.2 2019-06-11 21:47:26 -04:00
Toby Lawrence fc5d487520
metrics: fix a lil docs glitch 2019-06-11 21:45:04 -04:00
Toby Lawrence 35b4db8cbf
metrics: update docs for facade usage 2019-06-11 21:38:05 -04:00
Toby Lawrence 1de4343fc5
Add metrics-facade crate to provide global macros. (#20)
Add support for a `log`-esque crate that can provide globally-installed metrics collection and ingest via basic macros.
2019-06-11 11:54:27 -04:00
Toby Lawrence 357af843d2
Add `Debug` to `Configuration`. 2019-06-04 17:31:34 -04:00
Toby Lawrence 21f2b937c3
Update tests and make sure we don't double clear the new bucket. 2019-06-04 16:29:36 -04:00
Toby Lawrence 275be9ddf0
Rework upkeep in AtomicWindowedHistogram.
We've reworked upkeep a bit to avoid any datapoint loss during upkeep,
and to make it a bit easier to grok and follow along with.  We also
added a better "gauntlet" test to atempt to hit with with multiple
writers and eke out any glaring issues, as well as a bench test for it.
2019-06-03 17:13:42 -04:00
Toby Lawrence 0a3e8bbff6
Fix up all the review nits. 2019-06-01 15:55:28 -04:00
Toby Lawrence 1559dd4fc6 Need to uptick the version of metrics. 2019-05-29 23:07:14 -04:00
Toby Lawrence 9f1bcb5226 Entirely remove the event loop and switch to pure atomics.
Originally, metrics (and `hotmic` before it was converted) was based on
an event loop that centered around `mio`'s `Poll` interface with a
custom channel to read and write metrics to.  That model required a
dedicated thread to run to poll for writes, and ingest them, managing
the internal data structures in turn.

Eventually, I rewrote that portion to be based on `crossbeam-channel`
but we still depended on a background thread to pop samples off the
channel and process them.

Instead, we've rewritten the core of metrics to be based purely on
atomics, with the caveat that we still do have a background thread.

Instead of a single channel that metrics are funneled into, each
underlying metric becomes a single-track codepath: each metric is backed
by an atomic structure which means we can pass handles to that storage
as far as the callers themselves, eliminating the need to funnel metrics
into the "core" where they all contend for processing.

Counters are gauges are now, effectively, wrapped atomic integers, which
means we can process over 100 million counter/gauge updates per core.
Histograms are based on a brand-new atomic "bucket" that allows for
fast, unbounded writes and the ability to snapshot at any time.

The end result is that we can process a mixed workload (counter, gauge,
and histogram) at sample rates of up to 30 million samples per second
per core, with p999 ingest latencies of in the low hundreds of
nanoseconds.  Taking snapshots also now avoids stalling the event loop
and driving up tail latencies for ingest, and writers can proceed with
no interruption.

There is still a background thread that is part of quanta's new "recent"
time support, which allows a background thread to incrementally update a
shared global time, which can be accessed more quickly than grabbing the
time directly.  For our purposes, only histograms need the time to
perform the window upkeep inherent to the sliding windows we use, and
the time they need can be far less precise than what quanta is capable
of.  This background thread is spawned automatically when creating a
receiver, and drops when the receiver goes away.  By default, it updates
20 times a second performing an operation which itself takes less than
100ns, so all in all, this background thread should be imperceptible,
performance-wise, on all systems*.

On top of all of this, we've embraced the natural pattern of defining
metrics individually at the variable/field level, and added supported
for proxy types, which can be acquired from a sink and embedded as
  fields within your existing types, which lets you directly update
  metrics with the ease of accessing a field in an object.  Sinks still
  have the ability to have metrics pushed directly into them, but this
  just opens up more possibilities.

* - famous last words
2019-05-29 23:07:14 -04:00
Toby Lawrence 3a0aceab68
Copy workspace README to the metrics crate. 2019-05-29 18:42:19 -04:00
Toby Lawrence 52ade1201b
bump metrics-exporters-http to 0.1.0 2019-05-05 20:43:19 -04:00
Toby Lawrence 75a38b7bd8
Drop copyright bit from LICENSE because it duplicates COPYRIGHT. 2019-05-01 13:51:18 -04:00
Toby Lawrence cd03b1e613
Bump metrics to 0.9.1 2019-05-01 11:47:17 -04:00
Toby Lawrence 8b7088d0d9
Bump metrics-core to 0.3.0 2019-04-30 09:04:15 -04:00
Toby Lawrence 7063b552fc
Add documentation to the exporters/recorders facade modules. 2019-04-30 09:04:03 -04:00
Toby Lawrence f699b5ad04
Merge pull request #8 from metrics-rs/tobz/facade-modules
Add snapshot traits and expose exporters/recorders from metrics.
2019-04-29 22:17:29 -04:00
Toby Lawrence 1ebfc9cf49
Fixing up PR feedback. 2019-04-29 22:16:48 -04:00
Toby Lawrence fe6a12330d
Simplify core trait names + add associated type constraints. 2019-04-26 14:20:40 -04:00
Toby Lawrence 55d1708e10
Add snapshot traits and expose exporters/recorders from metrics.
We now expose all exporters and recorders via facade modules in the
metrics crate, called metrics::exporters and metrics::recorders,
respectively.  This means that the metrics crate itself has these are
optional dependencies, which are included by the default set of
features, and so can be turned off by consumers.

To curtail the issue of cyclical dependencies, we've also introduced
three new traits: MetricsSnapshot, SnapshotProvider, and
AsyncSnapshotProvider.

These traits let us represent metrics::Controller and
metrics::data::snapshot::Snapshot in the exporter, allowing us to get
around the cyclical dependency but also expose more flexibility and
modularity.
2019-04-25 12:59:37 -04:00
Toby Lawrence 5e3540e823
Small UI tweak to the CoC. 2019-04-24 08:09:13 -04:00
Toby Lawrence cb290bfc1f
Add back the license attribution to Brian Martin for tic. 2019-04-24 08:08:04 -04:00
Toby Lawrence c073b2d417
Fix up the CoC and make it consistent + add license. 2019-04-24 08:06:48 -04:00
Toby Lawrence 73a3eb988f tweaks to metrics/ 2019-04-23 14:48:33 -04:00
Toby Lawrence 74062e58c1 bump metrics-core to 0.2.0 2019-04-23 14:39:47 -04:00
Toby Lawrence d405cdeaf2 Clean up the benchmark a little bit. 2019-04-05 11:39:30 -04:00
Toby Lawrence a2769cd65e
one final name change for the road :) 2019-04-03 00:32:45 -04:00
Toby Lawrence 6b9818b005
A lot of documentation and syntax cleanups. 2019-04-03 00:30:24 -04:00
Toby Lawrence c58d1fe8c0
working commit of hotmic->metrics, with API changes to support metrics-core 2019-03-28 21:04:08 -04:00