Support customizing controller's StatsReporter through injection-gen
admission webhook supports to customize StatsReporter via context: https://github.com/knative/pkg/blob/a877090f011ffdff7227c436d9553d7ca4699bc1/webhook/context.go#L25-L39
But controller constructor (NewImpl) which generated via injection-gen doesn't: https://github.com/knative/pkg/blob/a877090f011ffdff7227c436d9553d7ca4699bc1/codegen/cmd/injection-gen/generators/reconciler/reconciler_controller.go#L277
it would be helpful to allow customizing this one.
Hey what kind of customizations were you looking to do? I'm currently looking at this as part of migrating to OpenCensus => OTel
Hi @dprotaso when developing admission webhooks, it's possible to inject StatsReporter, but for reconciler, it's not.
it should be much helpful that if StatsReporter can be passed via knative.dev/pkg/controller.Options (or it can be other structured) to NewReconciler function as other options are. So it's about metrics part, but it is not that related to Otel I guess? But happy to hear knative/pkg is migrating to Otel :)
I made sample changes to explain my intention here: https://github.com/jeongukjae/pkg/commit/db9612ad2def246a593c4462cf37e8c80a08c808
I think my upcoming changes will cover what you want. I'm changing it so the framework always records metrics and we instead toggle the exporter. So when metrics exporting is off we'll use the Otel noop.MeterProvider.
Given that I think it's best to remove the stats reporter completely.
If you want to see some early code take a look here: https://github.com/dprotaso/pkg/commit/d9e60ea084fd76f85e953a81022458286de57427
Proposal is here: https://docs.google.com/document/d/1QQ_ubc0RjeZbRHdN4rQR85Z7RZfTSjz4GoKsE0dZ2Z0/edit?pli=1&tab=t.0
@dprotaso nice! I like this change!
Closing this out - OTel changes have landed in knative.dev/pkg