Skip to content

trace: Support overriding step duration using a field #352

@dashpole

Description

@dashpole

Is your feature request related to a problem?/Why is this needed

While implementing aggregated trace events for streaming in kubernetes/kubernetes#138873, we found it would be helpful to be able to explicitly pass the duration to the trace library: kubernetes/kubernetes#138873 (comment)

Describe the solution you'd like in detail

When the duration key is provided to trace.Step(), omit it from the printed fields, and instead use its value for the step duration.

Instead of:

Trace[195300817]:  ---"Compress" size:131088,count:1,duration:3.5321ms,parallel:true 0ms (20:36:57.082)]

After

Trace[195300817]:  ---"Compress" size:131088,count:1,parallel:true 3.5321ms (20:36:57.082)]

Describe alternatives you've considered

  • Just leave it as-is. The 0ms might be confusing for readers.
  • Support explicitly passing the duration as a parameter to Step() (probably using a new function)

@serathius @richabanker

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