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

Use static 404 for unsupported signalfx-forwarder paths #1731

Merged
merged 1 commit into from
Apr 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions pkg/monitors/forwarder/forwarder.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,14 @@ func setupHandler(ctx context.Context, router *mux.Router, chainType string, sin
}

func notFoundHandler(w http.ResponseWriter, r *http.Request) {
errMsg := fmt.Sprintf("Datapoint or span request received on invalid path '%s'. "+
"You should send to the same path that you would on the Smart Gateway.", r.URL.Path)
logger.ThrottledError(errMsg)
_, _ = w.Write([]byte(errMsg + "\n"))
errMsg := "Datapoint or span request received on invalid path"
logger.ThrottledError(fmt.Sprintf("%s: %s", errMsg, r.URL.Path))

errMsg = fmt.Sprintf(
"%s. Supported paths: /v2/datapoint, %s, %s, and %s.\n", errMsg,
signalfx.DefaultTracePathV1, signalfx.ZipkinTracePathV1, signalfx.ZipkinTracePathV2,
)

w.WriteHeader(404)
_, _ = w.Write([]byte(errMsg))
}