diff --git a/browsertests/testdata/testfixture.js b/browsertests/testdata/testfixture.js index 960866cf..ad31d05f 100644 --- a/browsertests/testdata/testfixture.js +++ b/browsertests/testdata/testfixture.js @@ -1,6 +1,6 @@ // TestFixture records log messages and errors in an array that will // be returned to Go code. Each element in the result array is either -// an array of the form ["LOG", ...]", or ["ERROR", ...]. +// an array of the form ["LOG", ...], or ["ERROR", ...]. class TestFixture { constructor() { this.context = ""; // Added to front of all log and error messages. 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) + } +} diff --git a/profile/profile.go b/profile/profile.go index 0983656c..f47a2439 100644 --- a/profile/profile.go +++ b/profile/profile.go @@ -849,7 +849,7 @@ func (p *Profile) HasFileLines() bool { // Unsymbolizable returns true if a mapping points to a binary for which // locations can't be symbolized in principle, at least now. Examples are -// "[vdso]", [vsyscall]" and some others, see the code. +// "[vdso]", "[vsyscall]" and some others, see the code. func (m *Mapping) Unsymbolizable() bool { name := filepath.Base(m.File) return strings.HasPrefix(name, "[") || strings.HasPrefix(name, "linux-vdso") || strings.HasPrefix(m.File, "/dev/dri/") || m.File == "//anon"