Skip to content

Commit

Permalink
Return 204 on other prometheus endpoints, but don't do anything
Browse files Browse the repository at this point in the history
  • Loading branch information
tedpearson committed Oct 5, 2023
1 parent 0b44ae0 commit c258ad3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ func MakeForecasters(enabled []string, cacheDir string, vcKey string) map[string

// todo
// grafana dashboards
// change from locationAdhoc/locationTxt to just location
// add "save" tag, which determines if it should be added to locations.
// make influx forwarded token and our required auth token allowed to be different
// update readme
// allow http server functionality to be turned off if desired, by not including a port to listen on or something
// also allow proxy to be turned off
// possible to implement precip sums? +probability?
6 changes: 5 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ type Server struct {

// Start starts the prometheus endpoint.
func (s *Server) Start(port int64) {
http.Handle("/", s)
// don't 404 on other prometheus endpoints
http.HandleFunc("/api/v1/", func(writer http.ResponseWriter, request *http.Request) {
writer.WriteHeader(204)
})
http.Handle("/api/v1/query_range", s)
err := http.ListenAndServe(fmt.Sprintf(":%d", port), nil)
if err != nil {
panic(err)
Expand Down

0 comments on commit c258ad3

Please sign in to comment.