Skip to content
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

Add support for timestamp metrics with seconds precision #558

Merged
merged 2 commits into from
Sep 29, 2023

Conversation

trvrnrth
Copy link
Contributor

@trvrnrth trvrnrth commented Sep 12, 2022

This is useful for exporting oplog metrics in order to calculate the oplog window as the difference between mongodb_ss_oplog_latestOptime and mongodb_ss_oplog_earliestOptime

PMM-6927

  • Links to other linked pull requests (optional).

  • Tests passed.
  • Fix conflicts with target branch.
  • Update jira ticket description if needed.
  • Attach screenshots/console output to confirm new behavior to jira ticket, if applicable.

Once all checks pass and the code is ready for review, please add pmm-review-exporters team as the reviewer. That would assign people from the review team automatically. Report any issues on our Forum or Discord.

@trvrnrth trvrnrth marked this pull request as ready for review September 12, 2022 18:43
@trvrnrth trvrnrth requested a review from a team as a code owner September 12, 2022 18:43
@trvrnrth trvrnrth requested review from percona-csalguero and tshcherban and removed request for a team September 12, 2022 18:43
@ShashankSinha252
Copy link
Contributor

@trvrnrth Please rebase so we can go ahead.

@trvrnrth trvrnrth force-pushed the timestamp-support branch 2 times, most recently from 68785e7 to 04058d9 Compare September 29, 2022 13:15
@trvrnrth
Copy link
Contributor Author

trvrnrth commented Oct 3, 2022

@trvrnrth Please rebase so we can go ahead.

I've re-based a couple of times to keep up with master, however it looks like the last test workflow run timed out. I'm not able to retry it, but it does not appear related to the changes here or recently merged to master.

@@ -209,7 +209,9 @@ func asFloat64(value interface{}) (*float64, error) {
f = v
case primitive.DateTime:
f = float64(v)
case primitive.A, primitive.ObjectID, primitive.Timestamp, primitive.Binary, string, []uint8, time.Time:
case primitive.Timestamp:
f = float64(v.T)
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 use time.Unix() or time.UnixMilli() or any of those functions to make it more clear?

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 guess you could do f = float64(time.Unix(v.T, 0).Unix()) but I'm not sure that makes it clearer!

@Sancretor
Copy link

Hi ! 👋
Any news regarding this PR ?
I have the very same need to monitor replication headroom.

@trvrnrth
Copy link
Contributor Author

@percona-csalguero @ShashankSinha252 @tshcherban Do you need me to do anything to faciliate getting this merged?

@denisok
Copy link
Contributor

denisok commented May 31, 2023

@rnovikovP please check it out

This is useful for exporting oplog metrics in order to calculate the
oplog window as the difference between mongodb_ss_oplog_latestOptime
and mongodb_ss_oplog_earliestOptime
@trvrnrth
Copy link
Contributor Author

@denisok @rnovikovP I've rebased to keep this PR up to date. Is this something that could be looked at?

@denisok
Copy link
Contributor

denisok commented Sep 29, 2023

@BupycHuk please check it out

@BupycHuk BupycHuk merged commit 4cbba0f into percona:main Sep 29, 2023
4 of 8 checks passed
@trvrnrth trvrnrth deleted the timestamp-support branch September 29, 2023 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants