diff --git a/lib/otelmiddleware/headers.go b/lib/otelmiddleware/headers.go index 508ba3d..d07d25b 100644 --- a/lib/otelmiddleware/headers.go +++ b/lib/otelmiddleware/headers.go @@ -31,7 +31,7 @@ func TraceIDWithGCPURLs(gcpProjectID string) func(next http.Handler) http.Handle if traceID != "" { res.Header().Set(headerKeyID, traceID) res.Header().Set(headerKeyURL, getGCPTraceURL(gcpProjectID, traceID)) - res.Header().Set(headerKeyLogsURL, getGCPTraceLogsURL(gcpProjectID, traceID, time.Now())) + res.Header().Set(headerKeyLogsURL, GetGCPTraceLogsURL(gcpProjectID, traceID, time.Now())) } next.ServeHTTP(res, req) diff --git a/lib/otelmiddleware/util.go b/lib/otelmiddleware/util.go index d28b3a2..b4bb5ee 100644 --- a/lib/otelmiddleware/util.go +++ b/lib/otelmiddleware/util.go @@ -36,7 +36,7 @@ func getGCPTraceURL(gcpProjectID, traceID string) string { return fmt.Sprintf("%s/traces/list?%s", gcpBaseURL, params.Encode()) } -func getGCPTraceLogsURL(gcpProjectID, traceID string, refTime time.Time) string { +func GetGCPTraceLogsURL(gcpProjectID, traceID string, refTime time.Time) string { tracePath := getGCPTracePath(gcpProjectID, traceID) query := fmt.Sprintf("(trace=\"%s\" OR labels.\"appengine.googleapis.com/trace_id\"=\"%s\")", tracePath, traceID) timeRange := fmt.Sprintf("%s/%s--PT15M", refTime.Format(time.RFC3339), refTime.Format(time.RFC3339))