Skip to content

Add an option to specify a unit for the zero value in the SpanPrinter #192

@azerupi

Description

@azerupi

For my use case I'm pretty printing spans rounded up to the minute. However when a zero span is printed it shows up in seconds instead and the only way that I see to influence that is to mark a unit as fractional.

In an ideal scenario a rounded span could propagate its lower limit to the printer to avoid having to repeat the lower bound multiple times. But I understand that this would require to store the information in the span to handle the zero case, which is probably not desirable.

There could be a method to the printer to specify the zero value unit. But this could potentially lead to mismatches between the rounded span's lowest unit and the zero value unit and it would also require the user to specify the lowest unit twice, once for the rounding and once for the printer.

Maybe a method could be added to the printer to apply the rounding to the span and print it. That would allow the zero value to be printed in the same unit as the rounding.

What are your thoughts on this? Are there better solutions for this use case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions