Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Added metric for symbol table size #375

Merged
merged 1 commit into from
Sep 11, 2018

Conversation

codesome
Copy link
Contributor

@codesome codesome commented Sep 8, 2018

Closes #244, Supersedes #272

prometheus_tsdb_symbol_table_size will show the total size of symbol table of persisted blocks.

Signed-off-by: Ganesh Vernekar [email protected]

Signed-off-by: Ganesh Vernekar <[email protected]>
Copy link
Collaborator

@gouthamve gouthamve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 @brian-brazil Do you still want this?

db.mtx.RUnlock()
symTblSize := float64(0)
for _, b := range blocks {
symTblSize += float64(b.GetSymbolTableSize())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid too many conversions, symTblSize := 0 and then return float64(symTblSize)

@@ -138,6 +139,19 @@ func newDBMetrics(db *DB, r prometheus.Registerer) *dbMetrics {
defer db.mtx.RUnlock()
return float64(len(db.blocks))
})
m.symbolTableSize = prometheus.NewGaugeFunc(prometheus.GaugeOpts{
Name: "prometheus_tsdb_symbol_table_size",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See: https://prometheus.io/docs/practices/naming/#metric-names

Should be prometheus_tsdb_symbol_table_size_bytes

@brian-brazil
Copy link
Contributor

Yes, it's a way to spot high cardinality issues.

@gouthamve
Copy link
Collaborator

Note that this is the total bytes. I'm wondering if a histogram would make more sense.

@brian-brazil
Copy link
Contributor

I think the total's fine.

@gouthamve gouthamve merged commit d9129ad into prometheus-junkyard:master Sep 11, 2018
@gouthamve
Copy link
Collaborator

Thanks for the input!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants