v0.0.0-...-a19e79c Latest Latest

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

Go to latest
Published: Oct 6, 2015 License: MIT Imports: 11 Imported by: 0



Package database implements all persistent data access for bosun. Internally it runs ledisdb locally, but uses a redis client to access all data. Thus it should be able to migrate to a remote redis instance with minimal effort.



View Source
const Search_All = "__all__"


This section is empty.


func StartLedis

func StartLedis(dataDir string, bind string) (stop func(), err error)

Start in-process ledis server. Data will go in the specified directory and it will bind to the given port. Return value is a function you can call to stop the server.


type Connector

type Connector interface {
	GetConnection() redis.Conn

interface so things can get a raw connection (mostly tests), but still discourage it.

type DataAccess

type DataAccess interface {
	// Insert Metric Metadata. Field must be one of "desc", "rate", or "unit".
	PutMetricMetadata(metric string, field string, value string) error
	// Get Metric Metadata for given metric.
	GetMetricMetadata(metric string) (*MetricMetadata, error)

	PutTagMetadata(tags opentsdb.TagSet, name string, value string, updated time.Time) error
	GetTagMetadata(tags opentsdb.TagSet, name string) ([]*TagMetadata, error)
	DeleteTagMetadata(tags opentsdb.TagSet, name string) error

	Search_AddMetricForTag(tagK, tagV, metric string, time int64) error
	Search_GetMetricsForTag(tagK, tagV string) (map[string]int64, error)

	Search_AddTagKeyForMetric(metric, tagK string, time int64) error
	Search_GetTagKeysForMetric(metric string) (map[string]int64, error)

	Search_AddMetric(metric string, time int64) error
	Search_GetAllMetrics() (map[string]int64, error)

	Search_AddTagValue(metric, tagK, tagV string, time int64) error
	Search_GetTagValues(metric, tagK string) (map[string]int64, error)

	Search_AddMetricTagSet(metric, tagSet string, time int64) error
	Search_GetMetricTagSets(metric string, tags opentsdb.TagSet) (map[string]int64, error)

Core data access interface for everything sched needs

func NewDataAccess

func NewDataAccess(addr string, isRedis bool) DataAccess

Create a new data access object pointed at the specified address. isRedis parameter used to distinguish true redis from ledis in-proc.

type MetricMetadata

type MetricMetadata struct {
	Desc        string `redis:"desc" json:",omitempty"`
	Unit        string `redis:"unit" json:",omitempty"`
	Rate        string `redis:"rate" json:",omitempty"`
	LastTouched int64  `redis:"lastTouched"`

type TagMetadata

type TagMetadata struct {
	Tags        opentsdb.TagSet
	Name        string
	Value       string
	LastTouched int64


Path Synopsis

Jump to

Keyboard shortcuts

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