Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introducing chi middleware for warehouse #4010

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions warehouse/api/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
ierrors "github.com/rudderlabs/rudder-server/warehouse/internal/errors"
lf "github.com/rudderlabs/rudder-server/warehouse/logfield"

"github.com/rudderlabs/rudder-go-kit/chiware"
"github.com/rudderlabs/rudder-go-kit/config"
kithttputil "github.com/rudderlabs/rudder-go-kit/httputil"
"github.com/rudderlabs/rudder-go-kit/logger"
Expand Down Expand Up @@ -127,6 +128,9 @@ func NewApi(

func (a *Api) Start(ctx context.Context) error {
srvMux := chi.NewRouter()
srvMux.Use(
chiware.StatMiddleware(ctx, srvMux, a.statsFactory, "warehouse"),
Copy link
Collaborator

@fracasula fracasula Oct 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2nd argument doesn't seem to be used internally, @atzoum can we remove it from the kit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @fracasula . Middleware doesn't need to have access to the router.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)

if mode.IsStandAlone(a.mode) {
srvMux.Get("/health", a.healthHandler)
Expand Down
Loading