mirror of https://github.com/prometheus/prometheus
Merge branch 'master' of github.com:fabxc/tsdb
commit
55ee4b5b3b
|
@ -15,7 +15,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// MagicChunks 4 bytes at the head of series file.
|
// MagicChunks is 4 bytes at the head of series file.
|
||||||
MagicChunks = 0x85BD40DD
|
MagicChunks = 0x85BD40DD
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ func NewXORChunk() *XORChunk {
|
||||||
return &XORChunk{b: &bstream{stream: b, count: 0}}
|
return &XORChunk{b: &bstream{stream: b, count: 0}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Encoding returns the encoding type.
|
||||||
func (c *XORChunk) Encoding() Encoding {
|
func (c *XORChunk) Encoding() Encoding {
|
||||||
return EncXOR
|
return EncXOR
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,21 +237,21 @@ func (b *writeBenchmark) startProfiling() {
|
||||||
// Start CPU profiling.
|
// Start CPU profiling.
|
||||||
b.cpuprof, err = os.Create(filepath.Join(b.outPath, "cpu.prof"))
|
b.cpuprof, err = os.Create(filepath.Join(b.outPath, "cpu.prof"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exitWithError(fmt.Errorf("bench: could not create cpu profile: %v\n", err))
|
exitWithError(fmt.Errorf("bench: could not create cpu profile: %v", err))
|
||||||
}
|
}
|
||||||
pprof.StartCPUProfile(b.cpuprof)
|
pprof.StartCPUProfile(b.cpuprof)
|
||||||
|
|
||||||
// Start memory profiling.
|
// Start memory profiling.
|
||||||
b.memprof, err = os.Create(filepath.Join(b.outPath, "mem.prof"))
|
b.memprof, err = os.Create(filepath.Join(b.outPath, "mem.prof"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exitWithError(fmt.Errorf("bench: could not create memory profile: %v\n", err))
|
exitWithError(fmt.Errorf("bench: could not create memory profile: %v", err))
|
||||||
}
|
}
|
||||||
runtime.MemProfileRate = 4096
|
runtime.MemProfileRate = 4096
|
||||||
|
|
||||||
// Start fatal profiling.
|
// Start fatal profiling.
|
||||||
b.blockprof, err = os.Create(filepath.Join(b.outPath, "block.prof"))
|
b.blockprof, err = os.Create(filepath.Join(b.outPath, "block.prof"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exitWithError(fmt.Errorf("bench: could not create block profile: %v\n", err))
|
exitWithError(fmt.Errorf("bench: could not create block profile: %v", err))
|
||||||
}
|
}
|
||||||
runtime.SetBlockProfileRate(1)
|
runtime.SetBlockProfileRate(1)
|
||||||
}
|
}
|
||||||
|
|
2
db.go
2
db.go
|
@ -155,7 +155,7 @@ func Open(dir string, l log.Logger, r prometheus.Registerer, opts *Options) (db
|
||||||
|
|
||||||
if l == nil {
|
if l == nil {
|
||||||
l = log.NewLogfmtLogger(os.Stdout)
|
l = log.NewLogfmtLogger(os.Stdout)
|
||||||
l = log.NewContext(l).With("ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller)
|
l = log.With(l, "ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller)
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts == nil {
|
if opts == nil {
|
||||||
|
|
2
head.go
2
head.go
|
@ -88,7 +88,7 @@ func createHeadBlock(dir string, seq int, l log.Logger, mint, maxt int64) (*head
|
||||||
|
|
||||||
// openHeadBlock creates a new empty head block.
|
// openHeadBlock creates a new empty head block.
|
||||||
func openHeadBlock(dir string, l log.Logger) (*headBlock, error) {
|
func openHeadBlock(dir string, l log.Logger) (*headBlock, error) {
|
||||||
wal, err := OpenWAL(dir, log.NewContext(l).With("component", "wal"), 5*time.Second)
|
wal, err := OpenWAL(dir, log.With(l, "component", "wal"), 5*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,15 @@ type Matcher interface {
|
||||||
Matches(v string) bool
|
Matches(v string) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EqualMatcher matches on equality.
|
||||||
type EqualMatcher struct {
|
type EqualMatcher struct {
|
||||||
name, value string
|
name, value string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Name implements Matcher interface.
|
||||||
func (m *EqualMatcher) Name() string { return m.name }
|
func (m *EqualMatcher) Name() string { return m.name }
|
||||||
|
|
||||||
|
// Matches implements Matcher interface.
|
||||||
func (m *EqualMatcher) Matches(v string) bool { return v == m.value }
|
func (m *EqualMatcher) Matches(v string) bool { return v == m.value }
|
||||||
|
|
||||||
// NewEqualMatcher returns a new matcher matching an exact label value.
|
// NewEqualMatcher returns a new matcher matching an exact label value.
|
||||||
|
|
|
@ -461,7 +461,7 @@ type SeriesIterator interface {
|
||||||
// If there's no value exactly at ts, it advances to the last value
|
// If there's no value exactly at ts, it advances to the last value
|
||||||
// before tt.
|
// before tt.
|
||||||
Seek(t int64) bool
|
Seek(t int64) bool
|
||||||
// Values returns the current timestamp/value pair.
|
// At returns the current timestamp/value pair.
|
||||||
At() (t int64, v float64)
|
At() (t int64, v float64)
|
||||||
// Next advances the iterator by one.
|
// Next advances the iterator by one.
|
||||||
Next() bool
|
Next() bool
|
||||||
|
@ -674,7 +674,7 @@ func (b *BufferedSeriesIterator) Next() bool {
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
// Values returns the current element of the iterator.
|
// At returns the current element of the iterator.
|
||||||
func (b *BufferedSeriesIterator) At() (int64, float64) {
|
func (b *BufferedSeriesIterator) At() (int64, float64) {
|
||||||
return b.it.At()
|
return b.it.At()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue