-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[ENH]: add metric for total # of uncompacted log records #2696
Conversation
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
@@ -85,9 +79,14 @@ k8s_yaml([ | |||
|
|||
# Extra stuff to make debugging and testing easier | |||
k8s_yaml([ | |||
'k8s/test/namespace.yaml', |
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.
resources in ks_yaml(...)
take global precedence over anything else defined in the Tiltfile
, so I moved namespace creation here so that it's available for these resources
(creation of the new configmaps was erroring in CI, but not locally for some reason)
992e68d
to
1850693
Compare
go/database/log/queries/queries.sql
Outdated
@@ -33,3 +33,6 @@ INSERT INTO collection (id, record_enumeration_offset_position, record_compactio | |||
|
|||
-- name: PurgeRecords :exec | |||
DELETE FROM record_log r using collection c where r.collection_id = c.id and r.offset <= c.record_compaction_offset_position; | |||
|
|||
-- name: GetTotalUncompactedRecordsCount :one | |||
SELECT SUM(record_enumeration_offset_position - record_compaction_offset_position) AS total_uncompacted_depth FROM collection; |
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.
Is there any concern of this query being slow / hogging too much of the node? Maybe we could consider this to move to a read replica if so (in future), since it would be OK with data log.
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 think it should be ok for now, takes 5-7ms to execute. But good to keep in mind.
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.
Makes sense to me, I think we should just use the same leader fwiw
Description of changes
Adds a new metric, emitted by the log service, that describes the total number of uncompacted log records. Here's what it looks like during
test_sanity.py
:In service of this, I also added several resources to the local Tilt stack: the OpenTelemetry collector, Prometheus, and Grafana. These help debug and explore metrics as Jaeger unfortunately only does traces. All the containers are fairly lightweight and add about 200MB of memory consumption. I'm open to punting adding these local observability containers, but I think they will be useful when we start sampling traces and likely adding additional metrics to make up for the lost granularity.
Alternatives:
collection_id
: would have liked to do this, but requires some careful consideration to avoid emitting 1 event per collection every 10s (or whatever interval we choose). OpenTelemetry supports instruments that only transmit a delta at each collection interval, so I think this should be possible.Test plan
How are these changes tested?
Confirmed new metric works with Grafana.
Documentation Changes
Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs repository?
n/a