The tstorage time-series package for Go

Someone pointed this out recently:

The author has a nice writeup:

This is very interesting to me as I’ve been looking for an embedded time series store for SIOT.

Since I’ve also been pondering the point data format in SIOT, I was very interested in the data types used in the this database. The below is from the tstorage-server wrapper that allows the Db to be used by multiple processes.

message TimeSeriesDatum {
    string metric = 1;
    repeated Label labels = 2;
    double value = 3;
    google.protobuf.Timestamp timestamp = 4;
}

From the Go API itself, we find the same thing:

type Row struct {
	// The unique name of metric.
	// This field must be set.
	Metric string
	// An optional key-value properties to further detailed identification.
	Labels []Label
	// This field must be set.
	DataPoint
}

type DataPoint struct {
	// The actual value. This field must be set.
	Value float64
	// Unix timestamp.
	Timestamp int64
}

type Label struct {
	Name  string
	Value string
}

The search API is simple:

type Reader interface {
	// Select gives back a list of data points that matches a set of the given metric and
	// labels within the given start-end range. Keep in mind that start is inclusive, end is exclusive,
	// and both must be Unix timestamp. ErrNoDataPoints will be returned if no data points found.
	Select(metric string, labels []Label, start, end int64) (points []*DataPoint, err error)
}

I’m guessing there is currently no indexing of labels (like InfluxDB tags).

Overall, looks like a very interesting project.