Skip to content

Commit

Permalink
Use static 404 for unsupported signalfx-forwarder paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Fitzpatrick committed Apr 22, 2021
1 parent 90e959e commit b0ac5e4
Showing 1 changed file with 10 additions and 4 deletions.
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))
}

0 comments on commit b0ac5e4

Please sign in to comment.