Documentation ¶
Index ¶
- type Config
- type Serializer
- func NewCarbon2Serializer(carbon2format string) (Serializer, error)
- func NewCirconusSerializer(timestampUnits time.Duration) (Serializer, error)
- func NewGraphiteSerializer(prefix, template string, tagSupport bool, separator string, templates []string) (Serializer, error)
- func NewJSONSerializer(timestampUnits time.Duration) (Serializer, error)
- func NewNowSerializer() (Serializer, error)
- func NewPrometheusSerializer(config *Config) (Serializer, error)
- func NewSerializer(config *Config) (Serializer, error)
- func NewSplunkmetricSerializer(splunkmetricHecRouting bool, splunkmetricMultimetric bool) (Serializer, error)
- type SerializerOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Dataformat can be one of the serializer types listed in NewSerializer. DataFormat string `toml:"data_format"` // Carbon2 metric format. Carbon2Format string `toml:"carbon2_format"` // Support tags in graphite protocol GraphiteTagSupport bool `toml:"graphite_tag_support"` // Character for separating metric name and field for Graphite tags GraphiteSeparator string `toml:"graphite_separator"` // Prefix to add to all measurements, only supports Graphite Prefix string `toml:"prefix"` // Template for converting internal metrics into Graphite // only supports Graphite Template string `toml:"template"` // Templates same Template, but multiple Templates []string `toml:"templates"` // Timestamp units to use for JSON formatted output TimestampUnits time.Duration `toml:"timestamp_units"` // Include HEC routing fields for splunkmetric output HecRouting bool `toml:"hec_routing"` // Enable Splunk MultiMetric output (Splunk 8.0+) SplunkmetricMultiMetric bool `toml:"splunkmetric_multi_metric"` // Include the metric timestamp on each sample. PrometheusExportTimestamp bool `toml:"prometheus_export_timestamp"` // Sort prometheus metric families and metric samples. Useful for // debugging. PrometheusSortMetrics bool `toml:"prometheus_sort_metrics"` // Output string fields as metric labels; when false string fields are // discarded. PrometheusStringAsLabel bool `toml:"prometheus_string_as_label"` }
Config is a struct that covers the data types needed for all serializer types, and can be used to instantiate _any_ of the serializers.
type Serializer ¶
type Serializer interface { // Serialize takes a single internal metric and turns it into a byte buffer. // separate metrics should be separated by a newline, and there should be // a newline at the end of the buffer. // // New plugins should use SerializeBatch instead to allow for non-line // delimited metrics. Serialize(metric cua.Metric) ([]byte, error) // SerializeBatch takes an array of internal metrics and serializes it into // a byte buffer. This method is not required to be suitable for use with // line oriented framing. SerializeBatch(metrics []cua.Metric) ([]byte, error) }
Serializer is an interface defining functions that a serializer plugin must satisfy.
Implementations of this interface should be reentrant but are not required to be thread-safe.
func NewCarbon2Serializer ¶
func NewCarbon2Serializer(carbon2format string) (Serializer, error)
func NewCirconusSerializer ¶ added in v0.0.32
func NewCirconusSerializer(timestampUnits time.Duration) (Serializer, error)
func NewGraphiteSerializer ¶
func NewJSONSerializer ¶ added in v0.0.12
func NewJSONSerializer(timestampUnits time.Duration) (Serializer, error)
func NewNowSerializer ¶
func NewNowSerializer() (Serializer, error)
func NewPrometheusSerializer ¶
func NewPrometheusSerializer(config *Config) (Serializer, error)
func NewSerializer ¶
func NewSerializer(config *Config) (Serializer, error)
NewSerializer a Serializer interface based on the given config.
func NewSplunkmetricSerializer ¶
func NewSplunkmetricSerializer(splunkmetricHecRouting bool, splunkmetricMultimetric bool) (Serializer, error)
type SerializerOutput ¶
type SerializerOutput interface { // SetSerializer sets the serializer function for the interface. SetSerializer(serializer Serializer) }
SerializerOutput is an interface for output plugins that are able to serialize internal metrics into arbitrary data formats.
Click to show internal directories.
Click to hide internal directories.