diff --git a/internal/report/report.go b/internal/report/report.go index 7035e231..5ab0da65 100644 --- a/internal/report/report.go +++ b/internal/report/report.go @@ -1169,6 +1169,9 @@ func ProfileLabels(rpt *Report) []string { if o.SampleType != "" { label = append(label, "Type: "+o.SampleType) } + if url := prof.DocURL; url != "" { + label = append(label, "Doc: "+url) + } if prof.TimeNanos != 0 { const layout = "Jan 2, 2006 at 3:04pm (MST)" label = append(label, "Time: "+time.Unix(0, prof.TimeNanos).Format(layout)) diff --git a/internal/report/report_test.go b/internal/report/report_test.go index 08ce9da1..845c3690 100644 --- a/internal/report/report_test.go +++ b/internal/report/report_test.go @@ -16,6 +16,7 @@ package report import ( "bytes" + "fmt" "os" "path/filepath" "regexp" @@ -576,3 +577,21 @@ func TestDocURL(t *testing.T) { }) } } + +func TestDocURLInLabels(t *testing.T) { + const url = "http://example.com/pprof-help" + profile := testProfile.Copy() + profile.DocURL = url + rpt := New(profile, &Options{ + OutputFormat: Text, + Symbol: regexp.MustCompile(`.`), + TrimPath: "/some/path", + SampleValue: func(v []int64) int64 { return v[1] }, + SampleUnit: testProfile.SampleType[1].Unit, + }) + + labels := fmt.Sprintf("%v", ProfileLabels(rpt)) + if !strings.Contains(labels, url) { + t.Errorf("expected URL %q not found in %s", url, labels) + } +}