ansrivas / fiberprometheus

prometheus middleware for Fiber

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error responses are not handled

marniks7 opened this issue · comments

Hi there,
Here is an official error handling guide for fiber. It propose to return all errors to Fiber
https://docs.gofiber.io/guide/error-handling
Example:

app.Get("/", func(c *fiber.Ctx) error {
    // 503 Service Unavailable
    return fiber.ErrServiceUnavailable
})

In this case such errors will be skipped from catching by middleware.go due to the code below

	if err := ctx.Next(); err != nil {
		return err
	}

AR: error cases will be skipped from metrics
ER: error cases should be a part of metrics

Hey @marniks7 thanks for pointing this out. I was slightly confused with the implementation so opened an issue gofiber/fiber#1685
Seems, it's handled slightly differently in fiber as compared to other frameworks.

I will try to tackle this in the next few days, but in case you'd like to contribute, please feel free to open a PR.

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days.

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days.

This issue was closed because it has been stalled for 10 days with no activity.