m3

package
v3.4.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: MIT Imports: 17 Imported by: 61

Documentation

Index

Constants

View Source
const (
	// ServiceTag is the name of the M3 service tag.
	ServiceTag = "service"
	// EnvTag is the name of the M3 env tag.
	EnvTag = "env"
	// HostTag is the name of the M3 host tag.
	HostTag = "host"
	// DefaultMaxQueueSize is the default M3 reporter queue size.
	DefaultMaxQueueSize = 4096
	// DefaultMaxPacketSize is the default M3 reporter max packet size.
	DefaultMaxPacketSize = int32(1440)
	// DefaultHistogramBucketIDName is the default histogram bucket ID tag name
	DefaultHistogramBucketIDName = "bucketid"
	// DefaultHistogramBucketName is the default histogram bucket name tag name
	DefaultHistogramBucketName = "bucket"
	// DefaultHistogramBucketTagPrecision is the default
	// precision to use when formatting the metric tag
	// with the histogram bucket bound values.
	DefaultHistogramBucketTagPrecision = uint(6)
)

Variables

View Source
var (
	// DefaultSanitizerOpts are the options for the default M3 sanitizer.
	DefaultSanitizerOpts = tally.SanitizeOptions{
		NameCharacters: tally.ValidCharacters{
			Ranges:     tally.AlphanumericRange,
			Characters: tally.UnderscoreDashDotCharacters,
		},
		KeyCharacters: tally.ValidCharacters{
			Ranges:     tally.AlphanumericRange,
			Characters: tally.UnderscoreDashCharacters,
		},
		ValueCharacters: tally.ValidCharacters{
			Ranges:     tally.AlphanumericRange,
			Characters: tally.UnderscoreDashDotCharacters,
		},
		ReplacementCharacter: tally.DefaultReplacementCharacter,
	}
)

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	// HostPort is the host and port of the M3 server.
	HostPort string `yaml:"hostPort" validate:"nonzero"`

	// HostPorts are the host and port of the M3 server.
	HostPorts []string `yaml:"hostPorts"`

	// Service is the service tag to that this client emits.
	Service string `yaml:"service" validate:"nonzero"`

	// Env is the env tag to use that this client emits.
	Env string `yaml:"env" validate:"nonzero"`

	// CommonTags are tags that are common for all metrics this client emits.
	CommonTags map[string]string `yaml:"tags" `

	// Queue is the maximum metric queue size of client.
	Queue int `yaml:"queue"`

	// PacketSize is the maximum packet size for a batch of metrics.
	PacketSize int32 `yaml:"packetSize"`

	// IncludeHost is whether or not to include host tag.
	IncludeHost bool `yaml:"includeHost"`

	// HistogramBucketTagPrecision is precision to use when formatting the metric tag
	// with the histogram bucket bound values.
	HistogramBucketTagPrecision uint `yaml:"histogramBucketTagPrecision"`
}

Configuration is a configuration for a M3 reporter.

func (Configuration) NewReporter

func (c Configuration) NewReporter() (Reporter, error)

NewReporter creates a new M3 reporter from this configuration.

type Options

type Options struct {
	HostPorts                   []string
	Service                     string
	Env                         string
	CommonTags                  map[string]string
	IncludeHost                 bool
	Protocol                    Protocol
	MaxQueueSize                int
	MaxPacketSizeBytes          int32
	HistogramBucketIDName       string
	HistogramBucketName         string
	HistogramBucketTagPrecision uint
}

Options is a set of options for the M3 reporter.

type Protocol

type Protocol int

Protocol describes a M3 thrift transport protocol.

const (
	Compact Protocol = iota
	Binary
)

Compact and Binary represent the compact and binary thrift protocols respectively.

type Reporter

type Reporter interface {
	tally.CachedStatsReporter
	io.Closer
}

Reporter is an M3 reporter.

func NewReporter

func NewReporter(opts Options) (Reporter, error)

NewReporter creates a new M3 reporter.

Directories

Path Synopsis
thrift
v1
v2

Jump to

Keyboard shortcuts

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