Skip to content

chore: use HumanizeDuration from prometheus/common#14202

Merged
machine424 merged 3 commits intoprometheus:mainfrom
freak12techno:use-humanize-duration-from-common
Jun 10, 2024
Merged

chore: use HumanizeDuration from prometheus/common#14202
machine424 merged 3 commits intoprometheus:mainfrom
freak12techno:use-humanize-duration-from-common

Conversation

@freak12techno
Copy link
Contributor

Fixes #14198.

Removed the implementation of HumanizeDuration, which I moved to prometheus/common in another PR to reuse it in Alertmanager as well.

Signed-off-by: Sergey <freak12techno@gmail.com>
Signed-off-by: Sergey <freak12techno@gmail.com>
@freak12techno
Copy link
Contributor Author

@machine424 can you review or ask somebody to do so? not sure who to ping here

Copy link
Member

@machine424 machine424 left a comment

Choose a reason for hiding this comment

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

Thanks.
Now that we have convertToFloat in commons as well, maybe we could expose it and use it here as well.

@freak12techno
Copy link
Contributor Author

@machine424 unfortunately convertToFloat isn't exported: https://github.com/prometheus/common/pull/627/files#diff-c8c3e840ed35e815552e86f6ef5b464d17ed5b61fe947b9c634a454c886db9a3R23
Do you think we should export it and remove it from here as well? If yes, I suggest doing it in another PR, as it'll require a PR on prometheus/common first and a version bump.

On your other comment, fixed it as well, can you review it once more?

@freak12techno freak12techno requested a review from machine424 June 4, 2024 10:48
Copy link
Member

@machine424 machine424 left a comment

Choose a reason for hiding this comment

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

Yes, after exposing/exporting it of course. It was just an idea.
Thanks again.

@freak12techno
Copy link
Contributor Author

Just to clarify, the idea seems nice. Maybe even better approach would be to remove the need of having to use convertToFloat internally in prometheus by moving all the functions that use it to common as well (given that convertToFloat isn't used outside of template funcs as far I as can see)?

What do you think? @machine424

@machine424
Copy link
Member

Just to clarify, the idea seems nice. Maybe even better approach would be to remove the need of having to use convertToFloat internally in prometheus by moving all the functions that use it to common as well (given that convertToFloat isn't used outside of template funcs as far I as can see)?

I'd only move to commons, the utils that are to be used in other repos and that we are willing to share.
I know they don't change a lot, but if we can avoid having to bump commons to make a change in an util that's only used by prometheus, it'd be great.
I proposed that for convertToFloat because it's already defined in prometheus and in commons currently.

@freak12techno
Copy link
Contributor Author

@machine424 also agree, but given that ConvertToFloat isn't used outside of templates, it's rather a helper than a template function and it kinda makes sense to move it to helpers folder or something like that (and then reuse it in both prometheus and alertmanager repos). What do you think?

@freak12techno
Copy link
Contributor Author

@machine424 can we get this merged or is there something else to do here?

@machine424
Copy link
Member

If @gotjosh, as he reviewed the commons PR, has no remarks, I'll merge.

Copy link
Member

@gotjosh gotjosh left a comment

Choose a reason for hiding this comment

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

LGTM

@machine424 machine424 merged commit 5a5a6f0 into prometheus:main Jun 10, 2024
@freak12techno freak12techno deleted the use-humanize-duration-from-common branch June 10, 2024 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use humanizeDuration from prometheus/common

3 participants