-
Notifications
You must be signed in to change notification settings - Fork 592
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
feat(metrics): add cdc consume lag metrics #13877
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #13877 +/- ##
==========================================
- Coverage 68.34% 68.33% -0.01%
==========================================
Files 1528 1528
Lines 263303 263313 +10
==========================================
- Hits 179947 179936 -11
- Misses 83356 83377 +21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Rest LGTM. Thanks for the PR!
long sourceTsMs = | ||
sourceStruct == null | ||
? System.currentTimeMillis() | ||
: sourceStruct.getInt64("ts_ms"); |
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.
dumb question: Is ts_ms
guaranteed to be a utc based timestamp?
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 yes, since timestamp
in mysql and pg is stored as UTC.
@@ -114,13 +115,19 @@ var record = event.value(); | |||
committer.markProcessed(event); | |||
continue; | |||
} | |||
// get upstream event time from the "source" field | |||
var sourceStruct = ((Struct) record.value()).getStruct("source"); |
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.
Will there be any difference in payload.source.ts_ms
and payload.ts_ms
for direct cdc?
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.
payload.ts_ms
is the time at which the connector processed the event, that is process time of the connector.
let opts = histogram_opts!( | ||
"source_cdc_event_lag_duration_milliseconds", | ||
"source_cdc_lag_latency", | ||
exponential_buckets(1.0, 2.0, 20).unwrap(), // max 1048s |
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.
nits: the max will be 1*(2^(20-1)) ~= 524s
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 for pointing out.
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
The
payload.source.ts_ms
in debezium message reflects the timestamp for when the change was made in the database. We use this timestamp to calculate the lag latency from the perspective of source executor.https://debezium.io/documentation/reference/stable/connectors/mysql.html#mysql-create-events
close #13440
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.