New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React UI: Implement missing TSDB head stats section #7876
Conversation
0686224
to
9b7fdbc
Compare
9b7fdbc
to
0ea7f8d
Compare
Hey @juliusv I'd appreciate a review whenever you get a chance. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Sorry, I'm a bit behind on everything, but finally got around to studying this closer!
Looks mainly great, modulo a couple of comments.
docs/querying/api.md
Outdated
@@ -892,6 +892,10 @@ The following endpoint returns various cardinality statistics about the Promethe | |||
``` | |||
GET /api/v1/status/tsdb | |||
``` | |||
- **numSeries**: This provides the number of series in the tsdb. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When mentioned as a normal word, I'd say let's keep TSDB capitalized.
docs/querying/api.md
Outdated
@@ -892,6 +892,10 @@ The following endpoint returns various cardinality statistics about the Promethe | |||
``` | |||
GET /api/v1/status/tsdb | |||
``` | |||
- **numSeries**: This provides the number of series in the tsdb. | |||
- **chunkCount**: This provides the number of chunks in the tsdb. | |||
- **minTime**: This provides the current minimum time in the tsdb. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about mentioning the unit (milliseconds)? So "time" -> "timestamp in milliseconds".
docs/querying/api.md
Outdated
@@ -892,6 +892,10 @@ The following endpoint returns various cardinality statistics about the Promethe | |||
``` | |||
GET /api/v1/status/tsdb | |||
``` | |||
- **numSeries**: This provides the number of series in the tsdb. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since all these stats are not for the full TSDB, but just for the head block, we should clarify that in the docs here.
I'm also thinking we should make it clear in the field names themselves. Either wrap them all in a headStats: {...}
object or prefix them all with head
?
docs/querying/api.md
Outdated
@@ -902,6 +906,10 @@ $ curl http://localhost:9090/api/v1/status/tsdb | |||
{ | |||
"status": "success", | |||
"data": { | |||
"numSeries": 508, | |||
"chunkCount": 937, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what to do about these two fields, as they are also reported by /api/v1/status/runtimeinfo
already (see https://prometheus.demo.do.prometheus.io/api/v1/status/runtimeinfo), and exposing the same stats in two different endpoints seems like suboptimal API design.
Probably they shouldn't be part of runtimeinfo
nowadays, but just part of the new tsdb
stats.
How about removing them from the existing runtimeinfo
stats, as the docs for that endpoint above don't even mention those fields (among other missing ones), and there's a notice saying that fields are allowed to change between Prometheus versions.
return ( | ||
<div> | ||
<h2>TSDB Status</h2> | ||
<h3 className="p-2">Head Stats</h3> | ||
<Table bordered size="sm" striped> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All other tables are embedded in a className="p-2"
div, causing them to have some padding around them, but this one doesn't, so it stands out more to the sides. Could you make it consistent?
Awesome! Thanks for the review! I will address these things in the next couple of days. |
ab42fc2
to
6a73b96
Compare
Signed-off-by: Dustin Hooten <dhooten@splunk.com>
6a73b96
to
9a2112d
Compare
@juliusv I think I was able to address all of your comments. Please let me know if there's anything else I should update. Thanks! |
if *mF.Name == "prometheus_tsdb_head_chunks" { | ||
m := *mF.Metric[0] | ||
if m.Gauge != nil { | ||
chunkCount = int64(m.Gauge.GetValue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a break
after this to discontinue the loop?
b91ef57
to
7e9725c
Compare
👍 Looks good now, thanks again :) |
Great! Thanks for the thorough review! |
This PR implements the missing TSDB head stats section in the React UI.
It exposes the following fields in the
/api/v1/status/tsdb
to make them available in the UI:numSeries
chunkCount
minTime
maxTime
It provides functionality comparable to that of #7544 (the string formatting is slightly different).
Closes #7546