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

Global layer skip paths #19

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
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
18 changes: 18 additions & 0 deletions example/client/make_skip_paths_requests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

for i in {1..1000}
do
# curl localhost:54444/fake/fsf
# curl localhost:54444/combination/2
echo -e "\n/__stats/"
curl localhost:54444/__stats/
echo -e "\n/__health"
curl localhost:54444/__health
echo -e "\n/__echo/"
curl localhost:54444/__echo/
# uncomment this to see real 404 not found error codes
# echo -e "\n/this_does_not_exist/"
# curl localhost:54444/this_does_not_exist/
echo -e "\n----\n"
sleep 1
done
7 changes: 7 additions & 0 deletions http/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ type trackingHandler struct {
metrics *metricsHTTP
traces *tracesHTTP
reportHeaders bool
config state.Config
}

func (h *trackingHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
if r.URL != nil && h.config.SkipEndpoint(r.URL.Path) {
h.next.ServeHTTP(rw, r)
return
}

t := newTracking()
t.ctx = r.Context()
if h.prop != nil {
Expand Down Expand Up @@ -84,5 +90,6 @@ func NewTrackingHandler(next http.Handler) http.Handler {
metrics: m,
traces: t,
reportHeaders: gCfg.ReportHeaders,
config: otelCfg,
}
}
Loading