Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backend): tempo cloud connection string #3515

Merged
merged 3 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion server/tracedb/connection/port_linting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 4 additions & 0 deletions server/tracedb/datasource/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a url like this:

tempo-us-central1.grafana.net:443

The parsing method returns

http://tempo-us-central1.grafana.net:443

Which breaks the getTraceById logic.


client := &http.Client{
Transport: &http.Transport{
TLSClientConfig: getTlsConfig(config.TLS),
Expand Down
2 changes: 1 addition & 1 deletion server/tracedb/tempodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

func tempoDefaultPorts() []string {
return []string{"9095", ""}
return []string{"9095", "443", "80", ""}
}

type tempoTraceDB struct {
Expand Down