Skip to content

Commit

Permalink
Publish the self-reported runner public IP (#94)
Browse files Browse the repository at this point in the history
The remote address as reported by `r.RemoteAddr` is not useful because
it's the ingress internal address. This change now uses the
self-reported public IP address from the runner.
  • Loading branch information
lhchavez authored Oct 2, 2022
1 parent eb26673 commit f958eed
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cmd/omegaup-grader/runner_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"os"
"regexp"
"strconv"
"strings"
"time"

"github.com/omegaup/quark/common"
Expand Down Expand Up @@ -190,9 +189,9 @@ func registerRunnerHandlers(
// Add the runner to the list of known runners.
m, ok := ctx.Metrics.(*prometheusMetrics)
if ok {
colon := strings.LastIndex(r.RemoteAddr, ":")
if colon != -1 {
m.RunnerObserve(r.RemoteAddr[:colon] + ":6060")
remoteAddr := r.Header.Get("OmegaUp-Runner-PublicIP")
if remoteAddr != "" {
m.RunnerObserve(remoteAddr + ":6060")
}
}

Expand Down

0 comments on commit f958eed

Please sign in to comment.