Skip to content

Commit

Permalink
add X-Session-ID header
Browse files Browse the repository at this point in the history
  • Loading branch information
vintikzzz committed Jul 23, 2021
1 parent d5516b3 commit 6448c3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion services/job_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,6 @@ func (s *JobLocation) invoke() (*Location, error) {
Value: s.cfg.UseSnapshot,
},
{

Name: "SNAPSHOT_START_THRESHOLD",
Value: fmt.Sprintf("%f", s.cfg.SnapshotStartThreshold),
},
Expand Down
6 changes: 6 additions & 0 deletions services/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ func (s *Web) proxyHTTP(w http.ResponseWriter, r *http.Request, src *Source, log
domain = d
}

sessionID := ""
if sid, ok := claims["sessionID"].(string); ok {
sessionID = sid
}

promHTTPProxyRequestCurrent.WithLabelValues(string(source), src.GetEdgeName()).Inc()
defer func() {
promHTTPProxyRequestDuration.WithLabelValues(string(source), src.GetEdgeName(), strconv.Itoa(wi.GroupedStatusCode())).Observe(time.Since(wi.start).Seconds())
Expand Down Expand Up @@ -235,6 +240,7 @@ func (s *Web) proxyHTTP(w http.ResponseWriter, r *http.Request, src *Source, log
"X-Token": src.Token,
"X-Api-Key": apiKey,
"X-Client": clientName,
"X-Session-ID": sessionID,
}
rate, ok := claims["rate"].(string)
if ok {
Expand Down

0 comments on commit 6448c3b

Please sign in to comment.