What is the best practice for using durations in OPAL?¶
Use durations when applicable¶
Time is a first order property on the Observability Cloud. For legacy reasons, you may see definitions which surface duration as a number.
This representation is outdated. Use a duration
type instead, which can be inferred when you subtract one time column from another.
Using a duration
type will allow the UI to render a better visualization and pretty-print the value.
Bad OPAL:
make_col duration_seconds:float64(end_time - start_time) / int64(duration_sec(1))
Good OPAL:
make_col duration:end_time-start_time