Skip to content

Meter rates: docs state units/second, while code uses units/microsecond #74

@Trigary

Description

@Trigary

The Thrift API's meter_array_set_rates, meter_set_rates, and meter_get_rates methods all state (in their documentation) that the meter rates are specified in units/second (where units is bytes or packets). But the actual implementations work with units/microsecond.

For example, meter_array_set_rates passes the specified rate value to the BmMeterRateConfig class, which specifies that it works with units_per_micros.

I do not know whether this bug also exists in the P4Runtime API.

In my opinion, a public API dealing with units/second is preferred, and the implementation should be responsible for converting the rates to/from units/microsecond. But fixing this bug by changing the implementation would be a breaking change, potentially breaking existing code that depends on this library. Changing the documentation would also fix this issue and it would not be a breaking change, but I believe the end result would be less favorable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions