graphite

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 9 Imported by: 0

README

Graphite

The Graphite data format is translated from internal Metrics using either the template pattern or tag support method. You can select between the two methods using the graphite_tag_support option. When set, the tag support method is used, otherwise the Template Pattern is used.

Configuration
[[outputs.file]]
  ## Files to write to, "stdout" is a specially handled file.
  files = ["stdout", "/tmp/metrics.out"]

  ## Data format to output.
  ## Each data format has its own unique set of configuration options, read
  ## more about them here:
  ## https://github.com/circonus-labs/circonus-unified-agent/blob/master/docs/DATA_FORMATS_OUTPUT.md
  data_format = "graphite"

  ## Prefix added to each graphite bucket
  prefix = "circonus"
  ## Graphite template pattern
  template = "host.tags.measurement.field"

  ## Graphite templates patterns
  ## 1. Template for cpu
  ## 2. Template for disk*
  ## 3. Default template
  # templates = [
  #  "cpu tags.measurement.host.field",
  #  "disk* measurement.field",
  #  "host.measurement.tags.field"
  #]

  ## Support Graphite tags, recommended to enable when using Graphite 1.1 or later.
  # graphite_tag_support = false
  ## Character for separating metric name and field for Graphite tags
  # graphite_separator = "."
graphite_tag_support

When the graphite_tag_support option is enabled, the template pattern is not used. Instead, tags are encoded using Graphite tag support added in Graphite 1.1. The metric_path is a combination of the optional prefix option, measurement name, and field name.

The tag name is reserved by Graphite, any conflicting tags and will be encoded as _name.

Example Conversion:

cpu,cpu=cpu-total,dc=us-east-1,host=tars usage_idle=98.09,usage_user=0.89 1455320660004257758
=>
cpu.usage_user;cpu=cpu-total;dc=us-east-1;host=tars 0.89 1455320690
cpu.usage_idle;cpu=cpu-total;dc=us-east-1;host=tars 98.09 1455320690

With set option graphite_separator to "_"

cpu,cpu=cpu-total,dc=us-east-1,host=tars usage_idle=98.09,usage_user=0.89 1455320660004257758
=>
cpu_usage_user;cpu=cpu-total;dc=us-east-1;host=tars 0.89 1455320690
cpu_usage_idle;cpu=cpu-total;dc=us-east-1;host=tars 98.09 1455320690

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InsertField

func InsertField(bucket, fieldName string) string

InsertField takes the bucket string from SerializeBucketName and replaces the FIELDNAME portion. If fieldName == "value", it will simply delete the FIELDNAME portion.

func SerializeBucketName

func SerializeBucketName(
	measurement string,
	tags map[string]string,
	template string,
	prefix string,
) string

SerializeBucketName will take the given measurement name and tags and produce a graphite bucket. It will use the GraphiteSerializer.Template to generate this, or DEFAULT_TEMPLATE.

NOTE: SerializeBucketName replaces the "field" portion of the template with FIELDNAME. It is up to the user to replace this. This is so that SerializeBucketName can be called just once per measurement, rather than once per field. See GraphiteSerializer.InsertField() function.

func SerializeBucketNameWithTags

func SerializeBucketNameWithTags(
	measurement string,
	tags map[string]string,
	prefix string,
	separator string,
	field string,
) string

SerializeBucketNameWithTags will take the given measurement name and tags and produce a graphite bucket. It will use the Graphite11Serializer. http://graphite.readthedocs.io/en/latest/tags.html

Types

type Serializer added in v0.0.12

type Serializer struct {
	Prefix     string
	Template   string
	TagSupport bool
	Separator  string
	Templates  []*Template
}

func (*Serializer) Serialize added in v0.0.12

func (s *Serializer) Serialize(metric cua.Metric) ([]byte, error)

func (*Serializer) SerializeBatch added in v0.0.12

func (s *Serializer) SerializeBatch(metrics []cua.Metric) ([]byte, error)

type Template added in v0.0.12

type Template struct {
	Filter filter.Filter
	Value  string
}

func InitGraphiteTemplates

func InitGraphiteTemplates(templates []string) ([]*Template, string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL