eventing icon indicating copy to clipboard operation
eventing copied to clipboard

`kn.eventing.dispatch.duration` metric does not record the response status

Open Cali0707 opened this issue 5 months ago • 6 comments

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

Cali0707 avatar Jul 24 '25 13:07 Cali0707

Hey @Cali0707 . Can I work on this one? I have contributed to knative before

EraKin575 avatar Aug 06 '25 17:08 EraKin575

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

Cali0707 avatar Aug 06 '25 18:08 Cali0707

sure thing @Cali0707 , is there any timeline for this?

EraKin575 avatar Aug 06 '25 20:08 EraKin575

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?

EraKin575 avatar Aug 07 '25 19:08 EraKin575

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.

github-actions[bot] avatar Nov 06 '25 01:11 github-actions[bot]

/lifecycle frozen

dprotaso avatar Nov 17 '25 15:11 dprotaso