mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:21:50 +00:00
This PR adds an initializer function that will be called from the svcmain package through the call to tracer.Init. The reasoning behind this is that it's very easy to accidentally use a package that uses conf internally from a service like Cody Gateway, Appliance, Migrator, or other MSP services and just because we don't have any config source for the trace ID should not let the process stall entirely. To make it absolutely clear that a dependency is safe to use from a conf perspective, this change indicates that well by dropping the dependency on it entirely and making it another packages concern to pass this type down. Test plan: All tests for Sourcegraph are still passing. --------- Co-authored-by: Robert Lin <robert@bobheadxi.dev>
17 lines
382 B
Go
17 lines
382 B
Go
package trace
|
|
|
|
// URL returns a trace URL for the given trace ID using the configured trace URL
|
|
// renderer. See trace.Init for more information.
|
|
func URL(traceID string) string {
|
|
if traceID == "" {
|
|
return ""
|
|
}
|
|
urlRendererMu.Lock()
|
|
defer urlRendererMu.Unlock()
|
|
if urlRenderer == nil {
|
|
return "<internal/trace.urlRenderer not configured>"
|
|
}
|
|
|
|
return urlRenderer(traceID)
|
|
}
|