dig
dig copied to clipboard
feat: add function runtime to dig.CallbackInfo
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.