Skip to content

Is there any specific reason to not expose now property in the metric options struct? #1354

Open
@myarjunar

Description

@myarjunar

In one of my unit tests, I am comparing the equality of MetricFamily objects, which include a Counter type metric. Prior to the v1.17.0 release, the CreatedTimestamp field did not include a timestamp value at the time of creation. However, with this recent release, the CreatedTimestamp is automatically populated with the current timestamp at the time of metric creation.

I also noticed that the metric options include a now property. Based on the description in the code, it appears that this property is used for testing purposes internally within the package. I would like to suggest making the now property public in the library. This would provide users like me with the ability to mock the now function, enabling us to conduct comprehensive testing externally.

Would love to hear your opinion on this or if there is indeed a specific reason not to do it that way. Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions