File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,10 +54,7 @@ func (c *client) ForceFlush(ctx context.Context) (lastErr error) {
5454
5555// TraceURL returns the trace URL for the span.
5656func (c * client ) TraceURL (span trace.Span ) string {
57- return fmt .Sprintf (
58- "%s://%s/traces/%s" ,
59- c .dsn .Scheme , c .dsn .AppHost (), span .SpanContext ().TraceID (),
60- )
57+ return fmt .Sprintf ("%s/traces/%s" , c .dsn .AppAddr (), span .SpanContext ().TraceID ())
6158}
6259
6360// ReportError reports an error as a span event creating a dummy span if necessary.
Original file line number Diff line number Diff line change @@ -20,15 +20,15 @@ func (dsn *DSN) String() string {
2020 return dsn .original
2121}
2222
23- func (dsn * DSN ) AppHost () string {
23+ func (dsn * DSN ) AppAddr () string {
2424 if dsn .Host == "uptrace.dev" {
25- return "app.uptrace.dev"
25+ return "https:// app.uptrace.dev"
2626 }
2727 host , _ , err := net .SplitHostPort (dsn .Host )
2828 if err != nil {
2929 return dsn .Host
3030 }
31- return net .JoinHostPort (host , "15678 " )
31+ return dsn . Scheme + "://" + net .JoinHostPort (host , "14318 " )
3232}
3333
3434func (dsn * DSN ) OTLPHost () string {
Original file line number Diff line number Diff line change @@ -24,4 +24,14 @@ func TestParseDSN(t *testing.T) {
2424 require .NoError (t , err )
2525 require .Equal (t , test .otlp , dsn .OTLPHost ())
2626 }
27+
28+ dsn , err := uptrace .ParseDSN ("http://localhost:14317" )
29+ require .NoError (t , err )
30+ require .Equal (t , "localhost:14317" , dsn .OTLPHost ())
31+ require .Equal (t , "http://localhost:14318" , dsn .AppAddr ())
32+
33+ dsn , err = uptrace .ParseDSN ("https://key@uptrace.dev/project_id" )
34+ require .NoError (t , err )
35+ require .Equal (t , "otlp.uptrace.dev:4317" , dsn .OTLPHost ())
36+ require .Equal (t , "https://app.uptrace.dev" , dsn .AppAddr ())
2737}
You can’t perform that action at this time.
0 commit comments