dig icon indicating copy to clipboard operation
dig copied to clipboard

feat: add function runtime to dig.CallbackInfo

Open tchung1118 opened this issue 8 months ago • 1 comments

This change adds runtime of the associated constructor or decorator to dig.CallbackInfo.

For example, users can access the runtime of a particular constructor by:

c := dig.New()
c.Provide(NewFoo, dig.WithProviderCallback(func(ci dig.CallbackInfo) {
    if ci.Error == nil {
        fmt.Printf("constructor %q finished running in %v", ci.Name, ci.Runtime)
    }
}))

This change is a prerequisite for adding https://github.com/uber-go/fx/issues/1213 to report runtime of constructors in Run events.

tchung1118 avatar Jun 27 '24 19:06 tchung1118