devops

package
v0.0.0-...-ffc6c44 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MachineRackChoicesPerDatacenter = 100
	MachineServiceChoices           = 20
	MachineServiceVersionChoices    = 2
)

Count of choices for auto-generated tag values:

View Source
const NHostSims = 9
View Source
const OneTerabyte = 1 << 40

Variables

View Source
var (
	CPUByteString      = []byte("cpu")       // heap optimization
	CPUTotalByteString = []byte("cpu-total") // heap optimization
)
View Source
var (
	DiskByteString        = []byte("disk") // heap optimization
	TotalByteString       = []byte("total")
	FreeByteString        = []byte("free")
	UsedByteString        = []byte("used")
	UsedPercentByteString = []byte("used_percent")
	INodesTotalByteString = []byte("inodes_total")
	INodesFreeByteString  = []byte("inodes_free")
	INodesUsedByteString  = []byte("inodes_used")

	DiskTags = [][]byte{
		[]byte("path"),
		[]byte("fstype"),
	}
	DiskFSTypeChoices = [][]byte{
		[]byte("ext3"),
		[]byte("ext4"),
		[]byte("btrfs"),
	}
)
View Source
var (
	DiskIOByteString = []byte("diskio") // heap optimization
	SerialByteString = []byte("serial")

	DiskIOFields = []LabeledDistributionMaker{
		{[]byte("reads"), func() Distribution { return MWD(ND(50, 1), 0) }},
		{[]byte("writes"), func() Distribution { return MWD(ND(50, 1), 0) }},
		{[]byte("read_bytes"), func() Distribution { return MWD(ND(100, 1), 0) }},
		{[]byte("write_bytes"), func() Distribution { return MWD(ND(100, 1), 0) }},
		{[]byte("read_time"), func() Distribution { return MWD(ND(5, 1), 0) }},
		{[]byte("write_time"), func() Distribution { return MWD(ND(5, 1), 0) }},
		{[]byte("io_time"), func() Distribution { return MWD(ND(5, 1), 0) }},
	}
)
View Source
var (
	MachineTeamChoices = [][]byte{
		[]byte("SF"),
		[]byte("NYC"),
		[]byte("LON"),
		[]byte("CHI"),
	}
	MachineOSChoices = [][]byte{
		[]byte("Ubuntu16.10"),
		[]byte("Ubuntu16.04LTS"),
		[]byte("Ubuntu15.10"),
	}
	MachineArchChoices = [][]byte{
		[]byte("x64"),
		[]byte("x86"),
	}
	MachineServiceEnvironmentChoices = [][]byte{
		[]byte("production"),
		[]byte("staging"),
		[]byte("test"),
	}
)
View Source
var (
	// The duration of a log epoch.
	EpochDuration = 10 * time.Second

	// Tag fields common to all hosts:
	MachineTagKeys = [][]byte{
		[]byte("hostname"),
		[]byte("region"),
		[]byte("datacenter"),
		[]byte("rack"),
		[]byte("os"),
		[]byte("arch"),
		[]byte("team"),
		[]byte("service"),
		[]byte("service_version"),
		[]byte("service_environment"),
	}
)
View Source
var (
	KernelByteString   = []byte("kernel") // heap optimization
	BootTimeByteString = []byte("boot_time")
	KernelFields       = []LabeledDistributionMaker{
		{[]byte("interrupts"), func() Distribution { return MWD(ND(5, 1), 0) }},
		{[]byte("context_switches"), func() Distribution { return MWD(ND(5, 1), 0) }},
		{[]byte("processes_forked"), func() Distribution { return MWD(ND(5, 1), 0) }},
		{[]byte("disk_pages_in"), func() Distribution { return MWD(ND(5, 1), 0) }},
		{[]byte("disk_pages_out"), func() Distribution { return MWD(ND(5, 1), 0) }},
	}
)
View Source
var (
	MemoryByteString = []byte("mem") // heap optimization

	// Choices for modeling a host's memory capacity.
	MemoryMaxBytesChoices = []int64{8 << 30, 12 << 30, 16 << 30}

	// Field keys for 'mem' points.
	MemoryFieldKeys = [][]byte{
		[]byte("total"),
		[]byte("available"),
		[]byte("used"),
		[]byte("free"),
		[]byte("cached"),
		[]byte("buffered"),
		[]byte("used_percent"),
		[]byte("available_percent"),
		[]byte("buffered_percent"),
	}
)
View Source
var (
	NetByteString = []byte("net") // heap optimization
	NetTags       = [][]byte{
		[]byte("interface"),
	}

	NetFields = []LabeledDistributionMaker{
		{[]byte("bytes_sent"), func() Distribution { return MWD(ND(50, 1), 0) }},
		{[]byte("bytes_recv"), func() Distribution { return MWD(ND(50, 1), 0) }},
		{[]byte("packets_sent"), func() Distribution { return MWD(ND(50, 1), 0) }},
		{[]byte("packets_recv"), func() Distribution { return MWD(ND(50, 1), 0) }},
		{[]byte("err_in"), func() Distribution { return MWD(ND(5, 1), 0) }},
		{[]byte("err_out"), func() Distribution { return MWD(ND(5, 1), 0) }},
		{[]byte("drop_in"), func() Distribution { return MWD(ND(5, 1), 0) }},
		{[]byte("drop_out"), func() Distribution { return MWD(ND(5, 1), 0) }},
	}
)
View Source
var (
	NginxByteString = []byte("nginx") // heap optimization

	NginxTags = [][]byte{
		[]byte("port"),
		[]byte("server"),
	}

	NginxFields = []LabeledDistributionMaker{
		{[]byte("accepts"), func() Distribution { return MWD(ND(5, 1), 0) }},
		{[]byte("active"), func() Distribution { return CWD(ND(5, 1), 0, 100, 0) }},
		{[]byte("handled"), func() Distribution { return MWD(ND(5, 1), 0) }},
		{[]byte("reading"), func() Distribution { return CWD(ND(5, 1), 0, 100, 0) }},
		{[]byte("requests"), func() Distribution { return MWD(ND(5, 1), 0) }},
		{[]byte("waiting"), func() Distribution { return CWD(ND(5, 1), 0, 100, 0) }},
		{[]byte("writing"), func() Distribution { return CWD(ND(5, 1), 0, 100, 0) }},
	}
)
View Source
var (
	PostgresqlByteString = []byte("postgresl") // heap optimization
	PostgresqlFields     = []LabeledDistributionMaker{
		{[]byte("numbackends"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("xact_commit"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("xact_rollback"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("blks_read"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("blks_hit"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("tup_returned"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("tup_fetched"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("tup_inserted"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("tup_updated"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("tup_deleted"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("conflicts"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("temp_files"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("temp_bytes"), func() Distribution { return CWD(ND(1024, 1), 0, 1024*1024*1024, 0) }},
		{[]byte("deadlocks"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("blk_read_time"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("blk_write_time"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
	}
)
View Source
var (
	RedisByteString = []byte("redis") // heap optimization

	RedisUptime = []byte("uptime_in_seconds")

	SixteenGB = float64(16 * 1024 * 1024 * 1024)

	RedisTags = [][]byte{
		[]byte("port"),
		[]byte("server"),
	}

	RedisFields = []LabeledDistributionMaker{
		{[]byte("total_connections_received"), func() Distribution { return MWD(ND(5, 1), 0) }},
		{[]byte("expired_keys"), func() Distribution { return MWD(ND(50, 1), 0) }},
		{[]byte("evicted_keys"), func() Distribution { return MWD(ND(50, 1), 0) }},
		{[]byte("keyspace_hits"), func() Distribution { return MWD(ND(50, 1), 0) }},
		{[]byte("keyspace_misses"), func() Distribution { return MWD(ND(50, 1), 0) }},

		{[]byte("instantaneous_ops_per_sec"), func() Distribution { return WD(ND(1, 1), 0) }},
		{[]byte("instantaneous_input_kbps"), func() Distribution { return WD(ND(1, 1), 0) }},
		{[]byte("instantaneous_output_kbps"), func() Distribution { return WD(ND(1, 1), 0) }},
		{[]byte("connected_clients"), func() Distribution { return CWD(ND(50, 1), 0, 10000, 0) }},
		{[]byte("used_memory"), func() Distribution { return CWD(ND(50, 1), 0, SixteenGB, SixteenGB/2) }},
		{[]byte("used_memory_rss"), func() Distribution { return CWD(ND(50, 1), 0, SixteenGB, SixteenGB/2) }},
		{[]byte("used_memory_peak"), func() Distribution { return CWD(ND(50, 1), 0, SixteenGB, SixteenGB/2) }},
		{[]byte("used_memory_lua"), func() Distribution { return CWD(ND(50, 1), 0, SixteenGB, SixteenGB/2) }},
		{[]byte("rdb_changes_since_last_save"), func() Distribution { return CWD(ND(50, 1), 0, 10000, 0) }},

		{[]byte("sync_full"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("sync_partial_ok"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("sync_partial_err"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("pubsub_channels"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("pubsub_patterns"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("latest_fork_usec"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("connected_slaves"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("master_repl_offset"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("repl_backlog_active"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("repl_backlog_size"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("repl_backlog_histlen"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("mem_fragmentation_ratio"), func() Distribution { return CWD(ND(5, 1), 0, 100, 0) }},
		{[]byte("used_cpu_sys"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("used_cpu_user"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("used_cpu_sys_children"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
		{[]byte("used_cpu_user_children"), func() Distribution { return CWD(ND(5, 1), 0, 1000, 0) }},
	}
)
View Source
var (
	// Field keys for 'cpu' points.
	CPUFieldKeys = [][]byte{
		[]byte("usage_user"),
		[]byte("usage_system"),
		[]byte("usage_idle"),
		[]byte("usage_nice"),
		[]byte("usage_iowait"),
		[]byte("usage_irq"),
		[]byte("usage_softirq"),
		[]byte("usage_steal"),
		[]byte("usage_guest"),
		[]byte("usage_guest_nice"),
	}
)
View Source
var (
	// Choices of regions and their datacenters.
	Regions = []Region{
		{
			[]byte("us-east-1"), [][]byte{
				[]byte("us-east-1a"),
				[]byte("us-east-1b"),
				[]byte("us-east-1c"),
				[]byte("us-east-1e"),
			},
		},
		{
			[]byte("us-west-1"), [][]byte{
				[]byte("us-west-1a"),
				[]byte("us-west-1b"),
			},
		},
		{
			[]byte("us-west-2"), [][]byte{
				[]byte("us-west-2a"),
				[]byte("us-west-2b"),
				[]byte("us-west-2c"),
			},
		},
		{
			[]byte("eu-west-1"), [][]byte{
				[]byte("eu-west-1a"),
				[]byte("eu-west-1b"),
				[]byte("eu-west-1c"),
			},
		},
		{
			[]byte("eu-central-1"), [][]byte{
				[]byte("eu-central-1a"),
				[]byte("eu-central-1b"),
			},
		},
		{
			[]byte("ap-southeast-1"), [][]byte{
				[]byte("ap-southeast-1a"),
				[]byte("ap-southeast-1b"),
			},
		},
		{
			[]byte("ap-southeast-2"), [][]byte{
				[]byte("ap-southeast-2a"),
				[]byte("ap-southeast-2b"),
			},
		},
		{
			[]byte("ap-northeast-1"), [][]byte{
				[]byte("ap-northeast-1a"),
				[]byte("ap-northeast-1c"),
			},
		},
		{
			[]byte("sa-east-1"), [][]byte{
				[]byte("sa-east-1a"),
				[]byte("sa-east-1b"),
				[]byte("sa-east-1c"),
			},
		},
	}
)

Functions

func NewHostMeasurements

func NewHostMeasurements(start time.Time) []SimulatedMeasurement

Types

type CPUMeasurement

type CPUMeasurement struct {
	// contains filtered or unexported fields
}

func NewCPUMeasurement

func NewCPUMeasurement(start time.Time) *CPUMeasurement

func (*CPUMeasurement) Tick

func (m *CPUMeasurement) Tick(d time.Duration)

func (*CPUMeasurement) ToPoint

func (m *CPUMeasurement) ToPoint(p *Point) bool

type DevopsSimulator

type DevopsSimulator struct {
	// contains filtered or unexported fields
}

A DevopsSimulator generates data similar to telemetry from Telegraf. It fulfills the Simulator interface.

func (*DevopsSimulator) Finished

func (g *DevopsSimulator) Finished() bool

func (*DevopsSimulator) Next

func (d *DevopsSimulator) Next(p *Point)

Next advances a Point to the next state in the generator.

func (*DevopsSimulator) SeenPoints

func (g *DevopsSimulator) SeenPoints() int64

func (*DevopsSimulator) SeenValues

func (g *DevopsSimulator) SeenValues() int64

func (*DevopsSimulator) Total

func (g *DevopsSimulator) Total() int64

type DevopsSimulatorConfig

type DevopsSimulatorConfig struct {
	Start time.Time
	End   time.Time

	HostCount  int64
	HostOffset int64
}

Type DevopsSimulatorConfig is used to create a DevopsSimulator.

func (*DevopsSimulatorConfig) ToSimulator

func (d *DevopsSimulatorConfig) ToSimulator() *DevopsSimulator

type DiskIOMeasurement

type DiskIOMeasurement struct {
	// contains filtered or unexported fields
}

func NewDiskIOMeasurement

func NewDiskIOMeasurement(start time.Time) *DiskIOMeasurement

func (*DiskIOMeasurement) Tick

func (m *DiskIOMeasurement) Tick(d time.Duration)

func (*DiskIOMeasurement) ToPoint

func (m *DiskIOMeasurement) ToPoint(p *Point) bool

type DiskMeasurement

type DiskMeasurement struct {
	// contains filtered or unexported fields
}

func NewDiskMeasurement

func NewDiskMeasurement(start time.Time, sda int) *DiskMeasurement

func (*DiskMeasurement) Tick

func (m *DiskMeasurement) Tick(d time.Duration)

func (*DiskMeasurement) ToPoint

func (m *DiskMeasurement) ToPoint(p *Point) bool

type Host

type Host struct {
	SimulatedMeasurements []SimulatedMeasurement

	// These are all assigned once, at Host creation:
	Name, Region, Datacenter, Rack, OS, Arch          []byte
	Team, Service, ServiceVersion, ServiceEnvironment []byte
}

Type Host models a machine being monitored by Telegraf.

func NewHost

func NewHost(i int, offset int, start time.Time) Host

func (*Host) TickAll

func (h *Host) TickAll(d time.Duration)

TickAll advances all Distributions of a Host.

type KernelMeasurement

type KernelMeasurement struct {
	// contains filtered or unexported fields
}

func NewKernelMeasurement

func NewKernelMeasurement(start time.Time) *KernelMeasurement

func (*KernelMeasurement) Tick

func (m *KernelMeasurement) Tick(d time.Duration)

func (*KernelMeasurement) ToPoint

func (m *KernelMeasurement) ToPoint(p *Point) bool

type LabeledDistributionMaker

type LabeledDistributionMaker struct {
	Label             []byte
	DistributionMaker func() Distribution
}

type MemMeasurement

type MemMeasurement struct {
	// contains filtered or unexported fields
}

func NewMemMeasurement

func NewMemMeasurement(start time.Time) *MemMeasurement

func (*MemMeasurement) Tick

func (m *MemMeasurement) Tick(d time.Duration)

func (*MemMeasurement) ToPoint

func (m *MemMeasurement) ToPoint(p *Point) bool

type NetMeasurement

type NetMeasurement struct {
	// contains filtered or unexported fields
}

func NewNetMeasurement

func NewNetMeasurement(start time.Time) *NetMeasurement

func (*NetMeasurement) Tick

func (m *NetMeasurement) Tick(d time.Duration)

func (*NetMeasurement) ToPoint

func (m *NetMeasurement) ToPoint(p *Point) bool

type NginxMeasurement

type NginxMeasurement struct {
	// contains filtered or unexported fields
}

func NewNginxMeasurement

func NewNginxMeasurement(start time.Time) *NginxMeasurement

func (*NginxMeasurement) Tick

func (m *NginxMeasurement) Tick(d time.Duration)

func (*NginxMeasurement) ToPoint

func (m *NginxMeasurement) ToPoint(p *Point) bool

type PostgresqlMeasurement

type PostgresqlMeasurement struct {
	// contains filtered or unexported fields
}

func NewPostgresqlMeasurement

func NewPostgresqlMeasurement(start time.Time) *PostgresqlMeasurement

func (*PostgresqlMeasurement) Tick

func (m *PostgresqlMeasurement) Tick(d time.Duration)

func (*PostgresqlMeasurement) ToPoint

func (m *PostgresqlMeasurement) ToPoint(p *Point) bool

type RedisMeasurement

type RedisMeasurement struct {
	// contains filtered or unexported fields
}

func NewRedisMeasurement

func NewRedisMeasurement(start time.Time) *RedisMeasurement

func (*RedisMeasurement) Tick

func (m *RedisMeasurement) Tick(d time.Duration)

func (*RedisMeasurement) ToPoint

func (m *RedisMeasurement) ToPoint(p *Point) bool

type Region

type Region struct {
	Name        []byte
	Datacenters [][]byte
}

Jump to

Keyboard shortcuts

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