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): adding empty port as supported for tempo #2704

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
6 changes: 3 additions & 3 deletions server/tracedb/datasource/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"fmt"
"io"
"net/http"
"net/url"
"strings"

"github.com/goware/urlx"
"github.com/kubeshop/tracetest/server/model"
"github.com/kubeshop/tracetest/server/tracedb/connection"
"github.com/kubeshop/tracetest/server/tracedb/datastoreresource"
Expand All @@ -25,7 +25,7 @@ type HttpClient struct {
}

func NewHttpClient(name string, config *datastoreresource.HttpClientConfig, callback HttpCallback) DataSource {
endpoint, _ := url.Parse(config.Url)
endpoint, _ := urlx.Parse(config.Url)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This fixes an annoying but with the URL lib not setting up the expected values when parsing the url

Copy link
Contributor

Choose a reason for hiding this comment

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

What is the main difference between using url.Parse and urlx.Parse? Is there a way to keep url.Parse?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

What is my concern: https://github.com/goware/urlx is a small library without changes for 2 years and we are using only a portion of its capability.
My thought is that we can transform the url.URL return like this lib does.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm... In that case, we can keep it and mark a tech debt to eliminate this dependency in the future.

client := &http.Client{
Transport: &http.Transport{
TLSClientConfig: getTlsConfig(config.TLS),
Expand Down Expand Up @@ -63,7 +63,7 @@ func (client *HttpClient) GetTraceByID(ctx context.Context, traceID string) (mod
}

func (client *HttpClient) Endpoint() string {
return client.config.Host
return client.config.URL.String()
}

func (client *HttpClient) Connect(ctx context.Context) error {
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", ""}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For http urls like www.grafana.com/traces the port is "not" setup

Ideally, I'd like us to change this logic to allow each integration read the config file and based on the values decide what is the expected list of port instead of having a static list

}

type tempoTraceDB struct {
Expand Down