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

Add a tsdbutil command to analyse churn etc. #478

Merged
merged 1 commit into from
Dec 28, 2018
Merged

Conversation

brian-brazil
Copy link
Contributor

This reports the cardinality of each label,
the total number of label pairs,
and how much series worth of time is "uncovered"
by series data. Which is basically how much churn there is.

Still needs UI work, but the core is there.

cmd/tsdb/main.go Outdated Show resolved Hide resolved
@brian-brazil
Copy link
Contributor Author

I've added a bit more to this, and tidied it up.

cmd/tsdb/main.go Outdated Show resolved Hide resolved
cmd/tsdb/main.go Outdated Show resolved Hide resolved
cmd/tsdb/main.go Outdated Show resolved Hide resolved
cmd/tsdb/main.go Outdated Show resolved Hide resolved
cmd/tsdb/main.go Outdated Show resolved Hide resolved
cmd/tsdb/main.go Outdated Show resolved Hide resolved
cmd/tsdb/main.go Outdated Show resolved Hide resolved
@brian-brazil
Copy link
Contributor Author

All done.

Copy link
Contributor

@codesome codesome left a comment

Choose a reason for hiding this comment

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

Nits

cmd/tsdb/main.go Show resolved Hide resolved
cmd/tsdb/main.go Outdated Show resolved Hide resolved
@@ -383,3 +409,129 @@ func getFormatedTime(timestamp int64, humanReadable *bool) string {
}
return strconv.FormatInt(timestamp, 10)
}

func analyzeBlock(b *tsdb.Block, limit int) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have single line comment at the beginning of each subsection of the code about what it is trying to calculate (in addition to Printf at the ends)? (makes the code easier to follow)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure that'd help much tbh

Copy link
Contributor

@krasi-georgiev krasi-georgiev left a comment

Choose a reason for hiding this comment

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

@brian-brazil The code doesn't account for deleted data in the tombstone file, isn't this important?

cmd/tsdb/main.go Outdated Show resolved Hide resolved
cmd/tsdb/main.go Outdated Show resolved Hide resolved
@brian-brazil
Copy link
Contributor Author

I think that's everything addresses.

@krasi-georgiev
Copy link
Contributor

@brian-brazil The code doesn't account for deleted data in the tombstone file, isn't this important?

@krasi-georgiev
Copy link
Contributor

maybe also add an entry in the changelog file so that this is also included in the Prometheus changelog and the other maintainers/users know about it and start using it.

@brian-brazil
Copy link
Contributor Author

The code doesn't account for deleted data in the tombstone file, isn't this important?

Not really, as long as the data is in the index it's going to slow things down and use up RAM.

This reports the cardinality of each label,
the total number of label pairs,
and how much series worth of time is "uncovered"
by series data. Which is basically how much churn there is.

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
@krasi-georgiev
Copy link
Contributor

LGTM

@brian-brazil brian-brazil merged commit 915d7cf into master Dec 28, 2018
@brian-brazil brian-brazil deleted the analyze branch December 28, 2018 17:06
radeklesniewski pushed a commit to SabreOSS/tsdb that referenced this pull request Jan 18, 2019
This reports the cardinality of each label,
the total number of label pairs,
and how much series worth of time is "uncovered"
by series data. Which is basically how much churn there is.

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
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.

4 participants