`kn.eventing.dispatch.duration` metric does not record the response status
Describe the bug
The kn.eventing.dispatch.duration OTel metric does not have any labels associated with the response status.
Expected behavior
The kn.eventing.dispatch.duration OTel metric has labels associated with the response status
To Reproduce Observe the metrics collected
Knative release version 1.19
Additional context Add any other context about the problem here such as proposed priority
Hey @Cali0707 . Can I work on this one? I have contributed to knative before
Hey @EraKin575 that would be great! For this issue, I would recommend starting by implementing something similar to https://github.com/knative/eventing/blob/02861b7ff6f6ccdb987e87972906637f259ac4da/pkg/observability/newcontext.go#L74
Specifically, it could be a function called WithResponseStatusLabels, and then we can work on tracking down all the places we record the metric and calling this in the appropriate places
/assign @EraKin575
sure thing @Cali0707 , is there any timeline for this?
Since http.ResponseWriter doesn’t expose the status code directly, I wanted to implemented a statusCode variable within each HTTP handler to keep track of it explicitly. This lets us pass the status code as a string into the responseLabels function, which simplifies label generation for otel metrics/logging. @Cali0707 whats your thoughts on this?
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.
/lifecycle frozen