TUN-4811: Publish quick tunnels' hostname in /metrics under userHostname for backwards-compatibility

This commit is contained in:
Nuno Diegues
2021-07-28 09:27:05 +01:00
parent 67a3be5b7a
commit 0924549efd
3 changed files with 33 additions and 1 deletions

View File

@@ -111,6 +111,13 @@ func (o *Observer) sendConnectedEvent(connIndex uint8, location string) {
func (o *Observer) sendURL(url string) {
o.sendEvent(Event{EventType: SetURL, URL: url})
if !strings.HasPrefix(url, "https://") {
// We add https:// in the prefix for backwards compatibility as we used to do that with the old free tunnels
// and some tools (like `wrangler tail`) are regexp-ing for that specifically.
url = "https://" + url
}
o.metrics.userHostnamesCounts.WithLabelValues(url).Inc()
}
func (o *Observer) SendReconnect(connIndex uint8) {