From dc5f6095adaab62aaf91cd3f69408615f0341536 Mon Sep 17 00:00:00 2001 From: Oscar Reyes Date: Thu, 11 Jan 2024 09:19:52 -0600 Subject: [PATCH] fix(backend): tempo cloud connection string (#3515) * fix(backend): tempo cloud connection string * adding suggested change --- server/tracedb/connection/port_linting.go | 12 +++++++++++- server/tracedb/datasource/http.go | 4 ++++ server/tracedb/tempodb.go | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/server/tracedb/connection/port_linting.go b/server/tracedb/connection/port_linting.go index 70a8563ef2..a7c2fc632b 100644 --- a/server/tracedb/connection/port_linting.go +++ b/server/tracedb/connection/port_linting.go @@ -88,5 +88,15 @@ func parsePort(url string) string { return "" } - return regexGroups[1] + port := regexGroups[1] + + if port == "1" { + if strings.Contains(url, "http") { + return "80" + } else { + return "443" + } + } + + return port } diff --git a/server/tracedb/datasource/http.go b/server/tracedb/datasource/http.go index 0315018af4..aa0cf676a7 100644 --- a/server/tracedb/datasource/http.go +++ b/server/tracedb/datasource/http.go @@ -27,6 +27,10 @@ type HttpClient struct { func NewHttpClient(name string, config *datastore.HttpClientConfig, callback HttpCallback) DataSource { endpoint, _ := urlx.Parse(config.Url) + if endpoint.Port() == "443" { + endpoint.Scheme = "https" + } + client := &http.Client{ Transport: &http.Transport{ TLSClientConfig: getTlsConfig(config.TLS), diff --git a/server/tracedb/tempodb.go b/server/tracedb/tempodb.go index f017536f89..e33acf04a0 100644 --- a/server/tracedb/tempodb.go +++ b/server/tracedb/tempodb.go @@ -23,7 +23,7 @@ import ( ) func tempoDefaultPorts() []string { - return []string{"9095", ""} + return []string{"9095", "443", "80", ""} } type tempoTraceDB struct {