Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/pkg/usagestats/seed.go

33 lines
862 B

package usagestats
import (
"time"
jsoniter "github.com/json-iterator/go"
prom "github.com/prometheus/prometheus/web/api/v1"
)
type ClusterSeed struct {
UID string `json:"UID"`
CreatedAt time.Time `json:"created_at"`
prom.PrometheusVersion `json:"version"`
}
var JSONCodec = jsonCodec{}
type jsonCodec struct{}
// todo we need to use the default codec for the rest of the code
// currently crashing because the in-memory kvstore use a singleton.
func (jsonCodec) Decode(data []byte) (interface{}, error) {
var seed ClusterSeed
if err := jsoniter.ConfigFastest.Unmarshal(data, &seed); err != nil {
return nil, err
}
return &seed, nil
}
func (jsonCodec) Encode(obj interface{}) ([]byte, error) {
return jsoniter.ConfigFastest.Marshal(obj)
}
func (jsonCodec) CodecID() string { return "usagestats.jsonCodec" }