Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
doodoocoder
prometheus
提交
64c7932e
P
prometheus
项目概览
doodoocoder
/
prometheus
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
prometheus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
64c7932e
编写于
9月 21, 2017
作者:
F
Fabian Reinartz
提交者:
GitHub
9月 21, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3202 from prometheus/beta5
*: release v2.0.0-beta.5
上级
249d69b5
c2166d48
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
63 addition
and
39 deletion
+63
-39
CHANGELOG.md
CHANGELOG.md
+10
-10
VERSION
VERSION
+1
-1
vendor/github.com/prometheus/tsdb/compact.go
vendor/github.com/prometheus/tsdb/compact.go
+1
-1
vendor/github.com/prometheus/tsdb/head.go
vendor/github.com/prometheus/tsdb/head.go
+12
-8
vendor/github.com/prometheus/tsdb/postings.go
vendor/github.com/prometheus/tsdb/postings.go
+26
-3
vendor/github.com/prometheus/tsdb/wal.go
vendor/github.com/prometheus/tsdb/wal.go
+6
-9
vendor/vendor.json
vendor/vendor.json
+7
-7
未找到文件。
CHANGELOG.md
浏览文件 @
64c7932e
## v2.0.0-beta.
4 / 2017-09-14
## v2.0.0-beta.
5 / 2017-09-21
This release includes numerous changes to the new storage layer. The main changes are:
*
[CHANGES] Single, compacted write ahead log
*
[CHANGES] Single in-memory block with garbage collection
*
[ENHANCEMENTS] Cache series dropped via
`metric_relabel_configs`
*
[ENHANCEMENTS] Pool byte buffers for scraping
*
[BUGFIX] Remove deadlock on startup when restoring WAL
*
[BUGFIX] Fix semantical races resulting in invalid persisted files
*
[BUGFIX] Correctly read back WAL in certain edge cases
*
[BUGFIX] Prevent crashes caused by changing metric representations in target's /metrics
*
[ENHANCEMENT] Overall memory usage reduction
*
[ENHANCEMENT] Serve debugging endpoints while TSDB is loading
*
[ENHANCEMENT] Healthy endpoint correctly reflects liveness during startup
*
[ENHANCEMENT] Switch to consistent usage of go-kit/log
Overall the changes achieve a baseline reduction in memory consumption and reduce
peak memory usage by 30-40% compared to the 2.0.0-beta.2 release.
This release requires a clean storage directory and is not compatible with files
created by previous beta releases.
This release may have issues with files written by previous beta releases.
## 1.7.1 / 2017-06-12
...
...
VERSION
浏览文件 @
64c7932e
2.0.0-beta.
4
2.0.0-beta.
5
vendor/github.com/prometheus/tsdb/compact.go
浏览文件 @
64c7932e
...
...
@@ -457,7 +457,7 @@ func (c *LeveledCompactor) populateBlock(blocks []BlockReader, meta *BlockMeta,
indexr
:=
b
.
Index
()
all
,
err
:=
indexr
.
Postings
(
""
,
""
)
all
,
err
:=
indexr
.
Postings
(
allPostingsKey
.
Name
,
allPostingsKey
.
Value
)
if
err
!=
nil
{
return
err
}
...
...
vendor/github.com/prometheus/tsdb/head.go
浏览文件 @
64c7932e
...
...
@@ -190,6 +190,10 @@ func (h *Head) ReadWAL() error {
r
:=
h
.
wal
.
Reader
()
mint
:=
h
.
MinTime
()
// Track number of samples that referenced a series we don't know about
// for error reporting.
var
unknownRefs
int
seriesFunc
:=
func
(
series
[]
RefSeries
)
error
{
for
_
,
s
:=
range
series
{
h
.
getOrCreateWithID
(
s
.
Ref
,
s
.
Labels
.
Hash
(),
s
.
Labels
)
...
...
@@ -207,7 +211,7 @@ func (h *Head) ReadWAL() error {
}
ms
:=
h
.
series
.
getByID
(
s
.
Ref
)
if
ms
==
nil
{
h
.
logger
.
Log
(
"msg"
,
"unknown series reference in WAL"
,
"ref"
,
s
.
Ref
)
unknownRefs
++
continue
}
_
,
chunkCreated
:=
ms
.
append
(
s
.
T
,
s
.
V
)
...
...
@@ -230,6 +234,10 @@ func (h *Head) ReadWAL() error {
return
nil
}
if
unknownRefs
>
0
{
h
.
logger
.
Log
(
"msg"
,
"unknown series references in WAL samples"
,
"count"
,
unknownRefs
)
}
if
err
:=
r
.
Read
(
seriesFunc
,
samplesFunc
,
deletesFunc
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"consume WAL"
)
}
...
...
@@ -267,12 +275,10 @@ func (h *Head) Truncate(mint int64) error {
start
=
time
.
Now
()
p
,
err
:=
h
.
indexRange
(
mint
,
math
.
MaxInt64
)
.
Postings
(
""
,
""
)
if
err
!=
nil
{
return
err
keep
:=
func
(
id
uint64
)
bool
{
return
h
.
series
.
getByID
(
id
)
!=
nil
}
if
err
:=
h
.
wal
.
Truncate
(
mint
,
p
);
err
==
nil
{
if
err
:=
h
.
wal
.
Truncate
(
mint
,
keep
);
err
==
nil
{
h
.
logger
.
Log
(
"msg"
,
"WAL truncation completed"
,
"duration"
,
time
.
Since
(
start
))
}
else
{
h
.
logger
.
Log
(
"msg"
,
"WAL truncation failed"
,
"err"
,
err
,
"duration"
,
time
.
Since
(
start
))
...
...
@@ -1038,8 +1044,6 @@ func (s *stripeSeries) getOrSet(hash uint64, series *memSeries) (*memSeries, boo
return
prev
,
false
}
s
.
hashes
[
i
]
.
set
(
hash
,
series
)
s
.
hashes
[
i
][
hash
]
=
append
(
s
.
hashes
[
i
][
hash
],
series
)
s
.
locks
[
i
]
.
Unlock
()
i
=
series
.
ref
&
stripeMask
...
...
vendor/github.com/prometheus/tsdb/postings.go
浏览文件 @
64c7932e
...
...
@@ -45,7 +45,7 @@ func (p *memPostings) get(name, value string) Postings {
return
newListPostings
(
l
)
}
var
all
Label
=
labels
.
Label
{}
var
all
PostingsKey
=
labels
.
Label
{}
// add adds a document to the index. The caller has to ensure that no
// term argument appears twice.
...
...
@@ -53,13 +53,36 @@ func (p *memPostings) add(id uint64, lset labels.Labels) {
p
.
mtx
.
Lock
()
for
_
,
l
:=
range
lset
{
p
.
m
[
l
]
=
append
(
p
.
m
[
l
],
id
)
p
.
addFor
(
id
,
l
)
}
p
.
m
[
allLabel
]
=
append
(
p
.
m
[
allLabel
],
id
)
p
.
addFor
(
id
,
allPostingsKey
)
p
.
mtx
.
Unlock
()
}
func
(
p
*
memPostings
)
addFor
(
id
uint64
,
l
labels
.
Label
)
{
list
:=
append
(
p
.
m
[
l
],
id
)
p
.
m
[
l
]
=
list
// There is no guarantee that no higher ID was inserted before as they may
// be generated independently before adding them to postings.
// We repair order violations on insert. The invariant is that the first n-1
// items in the list are already sorted.
for
i
:=
len
(
list
)
-
1
;
i
>=
1
;
i
--
{
if
list
[
i
]
>=
list
[
i
-
1
]
{
break
}
list
[
i
],
list
[
i
-
1
]
=
list
[
i
-
1
],
list
[
i
]
}
}
func
expandPostings
(
p
Postings
)
(
res
[]
uint64
,
err
error
)
{
for
p
.
Next
()
{
res
=
append
(
res
,
p
.
At
())
}
return
res
,
p
.
Err
()
}
// Postings provides iterative access over a postings list.
type
Postings
interface
{
// Next advances the iterator and returns true if another value was found.
...
...
vendor/github.com/prometheus/tsdb/wal.go
浏览文件 @
64c7932e
...
...
@@ -71,7 +71,7 @@ type WAL interface {
LogSeries
([]
RefSeries
)
error
LogSamples
([]
RefSample
)
error
LogDeletes
([]
Stone
)
error
Truncate
(
int64
,
Postings
)
error
Truncate
(
mint
int64
,
keep
func
(
uint64
)
bool
)
error
Close
()
error
}
...
...
@@ -87,7 +87,7 @@ func (w nopWAL) Reader() WALReader { return w }
func
(
nopWAL
)
LogSeries
([]
RefSeries
)
error
{
return
nil
}
func
(
nopWAL
)
LogSamples
([]
RefSample
)
error
{
return
nil
}
func
(
nopWAL
)
LogDeletes
([]
Stone
)
error
{
return
nil
}
func
(
nopWAL
)
Truncate
(
int64
,
Postings
)
error
{
return
nil
}
func
(
nopWAL
)
Truncate
(
int64
,
func
(
uint64
)
bool
)
error
{
return
nil
}
func
(
nopWAL
)
Close
()
error
{
return
nil
}
// WALReader reads entries from a WAL.
...
...
@@ -272,8 +272,9 @@ func (w *SegmentWAL) putBuffer(b *encbuf) {
w
.
buffers
.
Put
(
b
)
}
// Truncate deletes the values prior to mint and the series entries not in p.
func
(
w
*
SegmentWAL
)
Truncate
(
mint
int64
,
p
Postings
)
error
{
// Truncate deletes the values prior to mint and the series which the keep function
// does not indiciate to preserve.
func
(
w
*
SegmentWAL
)
Truncate
(
mint
int64
,
keep
func
(
uint64
)
bool
)
error
{
// The last segment is always active.
if
len
(
w
.
files
)
<
2
{
return
nil
...
...
@@ -314,7 +315,6 @@ func (w *SegmentWAL) Truncate(mint int64, p Postings) error {
activeSeries
=
[]
RefSeries
{}
)
Loop
:
for
r
.
next
()
{
rt
,
flag
,
byt
:=
r
.
at
()
...
...
@@ -328,10 +328,7 @@ Loop:
activeSeries
=
activeSeries
[
:
0
]
for
_
,
s
:=
range
series
{
if
!
p
.
Seek
(
s
.
Ref
)
{
break
Loop
}
if
p
.
At
()
==
s
.
Ref
{
if
keep
(
s
.
Ref
)
{
activeSeries
=
append
(
activeSeries
,
s
)
}
}
...
...
vendor/vendor.json
浏览文件 @
64c7932e
...
...
@@ -871,22 +871,22 @@
"revisionTime"
:
"2016-04-11T19:08:41Z"
},
{
"checksumSHA1"
:
"
B5ndMoK8lqgFJ8xUZ/0V4zCpUw0
="
,
"checksumSHA1"
:
"
evkeOdR0mTFS7yyREas6oa1QvHY
="
,
"path"
:
"github.com/prometheus/tsdb"
,
"revision"
:
"
162a48e4f2c6e486a0ebf61cf9cea73a8023ef0a
"
,
"revisionTime"
:
"2017-09-
19T08:20:19
Z"
"revision"
:
"
69f105f4f9478e929ef2a7d7553a7558b1de5c84
"
,
"revisionTime"
:
"2017-09-
21T12:57:51
Z"
},
{
"checksumSHA1"
:
"Gua979gmISm4cJP/fR2hL8m5To8="
,
"path"
:
"github.com/prometheus/tsdb/chunks"
,
"revision"
:
"
162a48e4f2c6e486a0ebf61cf9cea73a8023ef0a
"
,
"revisionTime"
:
"2017-09-
19T08:20:19
Z"
"revision"
:
"
69f105f4f9478e929ef2a7d7553a7558b1de5c84
"
,
"revisionTime"
:
"2017-09-
21T12:57:51
Z"
},
{
"checksumSHA1"
:
"zhmlvc322RH1L3l9DaA9d/HVVWs="
,
"path"
:
"github.com/prometheus/tsdb/labels"
,
"revision"
:
"
162a48e4f2c6e486a0ebf61cf9cea73a8023ef0a
"
,
"revisionTime"
:
"2017-09-
19T08:20:19
Z"
"revision"
:
"
69f105f4f9478e929ef2a7d7553a7558b1de5c84
"
,
"revisionTime"
:
"2017-09-
21T12:57:51
Z"
},
{
"checksumSHA1"
:
"5SYLEhADhdBVZAGPVHWggQl7H8k="
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录