package module
Version: v0.0.0-...-ee9019f Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2018 License: BSD-3-Clause Imports: 1 Imported by: 0


agentmon: Secret Dyno Metrics Agent Mon

agent mon


The agentmon application reads language metrics from a Prometheus or a StatsD source, then translates and aggregates the metrics data to a format expected by the language metrics sink. It posts the data to the language metrics sink located at A typical use case would be to add agentmon to a buildpack and set an environment variable HEROKU_METRICS_URL to<dyno id>. agentmon will read the language metrics sink URL from the environment variable when it starts and use it to post language metrics.

For more about what agentmon actually does, and its modes of operation, see design.


usage: agentmon [flags] sink-URL 
  -backlog int
        Size of pending measurement buffer (default 1000)
        debug mode is more verbose
  -interval int
        Sink flush interval in seconds (default 20)
  -prom-interval int
        Prometheus poll interval in seconds (default 5)
  -prom-url string
        Prometheus URL
  -statsd-addr string
        UDP address for statsd listener
        print version string


Run Tests
make test 
make install 
make build 
Create Release Package
make release 

(c) 2017, Heroku, Inc. See LICENSE for details.




This section is empty.


View Source
var VERSION = "0.0.1"

VERSION is link time populated based on the current git tag.


This section is empty.


type Measurement

type Measurement struct {
	// Name is the metric to contribute to.
	Name string

	// Timestamp at which the measurement was taken.
	Timestamp time.Time

	// Type of the metric we wish to amend.
	Type MetricType

	// Value is the amount by which we will amend the metric.
	// For Gauges, the amendment might be "replace".
	Value float64

	// SampleRate that this measurement was taken at.
	// For most applications, this should be set to 1.0
	SampleRate float32

	// Modifier allows gauges to be treated differently
	// A value of "-" subtracts Value from the metric's previous value.
	// A value of "+" adds Value to metric's previous value.  An empty
	// value replaces the metric's value with Value.
	Modifier string

Measurement is a point in time value that is used to amend a metric.

type MetricSet

type MetricSet struct {
	Counters map[string]float64 `json:"counters,omitempty"`
	Gauges   map[string]float64 `json:"gauges,omitempty"`
	// contains filtered or unexported fields

MetricSet provides a container for a set of metrics, and encodes the rules for how metrics are updated given a Measurement.

func NewMetricSet

func NewMetricSet(parent *MetricSet) *MetricSet

NewMetricSet constructs a MetricSet which can be used to turn Measurements into metrics, that can be reported via a reporter.

If a parent is given, it is expected to be the previously reported MetricSet, in order to capture the change in metrics, for both DerivedCounters, and modified Guages.

func (*MetricSet) Len

func (ms *MetricSet) Len() int

Len returns the cardinality of this set.

func (*MetricSet) Snapshot

func (ms *MetricSet) Snapshot() *MetricSet

Snapshot returns a copy of the MetricSet, removing the reference to the MetricSet's parent.

func (*MetricSet) Update

func (ms *MetricSet) Update(m *Measurement)

Update applies a Measurement to the MetricSet depending on its Type.

In cases where a Measurement for a Metric has a different Type than was previously updated, a new Metric with that type will be created.

type MetricType

type MetricType int

MetricType represents the type of metric, Measurements will result in.

const (
	// Counter represents a positive change in value for a flush interval.
	Counter MetricType = iota

	// DerivedCounter represents a monotonically increasing counter value that
	// is not supposed to be reset by the source.

	// Gauge represents the value right now.

	// Timer is currently unused, but exists for statsd parsing purposes.


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL