Open Bug 1651813 Opened 6 years ago Updated 26 days ago

Use searchfox for crash callstack source links instead of mercurial

Categories

(Socorro :: Webapp, enhancement, P2)

enhancement

Tracking

(Not tracked)

People

(Reporter: ktaeleman, Unassigned)

References

Details

It would be nice if crash callstacks could show a link to searchfox instead of the mercurial depot.

Use case:
When analyzing crashes, we often look up the code and have to manually search for the code in searchfox to identify:

  • potential reasons for the crash (often requires navigating around in the code)
  • who changed code recently
  • who has contributed to the sourcecode

These are not easy to identify using the mercurial depot site.

I don't know searchfox enough to know how to figure out what the link scheme should be. Can you provide examples of source links using searchfox?

Flags: needinfo?(ktaeleman)

@Kats: I think you mentioned that some translation was required in case we want to look up the file at a specific changeset. Could you give some insight here?

Flags: needinfo?(ktaeleman) → needinfo?(kats)

Here is an example URL: https://searchfox.org/mozilla-central/rev/19c23d725f27d0989e4a60f36d64004cebb39736/gfx/layers/apz/src/APZCTreeManager.cpp#82

The hash is the git hash of the change from gecko-dev/cinnabar but if you only have the mercurial hash we could hook up an equivalent /hgrev/<hg-hash> URL endpoint. The bit after the hash is the path and line number of the file in mozilla-central. Searchfox also indexes mozilla-beta, mozilla-release and a few ESR branches (see the "Repositories indexed" list at https://searchfox.org/) and the URLs work similarly.

Flags: needinfo?(kats)

I can't spend time on this any time soon. My suggestion is for someone else to prototype this with a Firefox addon. If you need me to make changes to the HTML to make that easier, I can probably do that.

If someone wants to try making changes to Socorro to have both an hg and a searchfox link, I'd be game for reviewing those changes. The code is kind of tangled and hard-coded and all over the place, but the thing that's generate the hg link is roughly here:

https://github.com/mozilla-services/socorro/blob/c91f7b37c0ad53bc67a0824742169d177d962334/webapp-django/crashstats/crashstats/utils.py#L323-L335

Priority: -- → P5

(In reply to Kartikaya Gupta (email:kats@mozilla.staktrace.com) from comment #3)

but if you only have the mercurial hash we could hook up an equivalent /hgrev/<hg-hash> URL endpoint.

This was done in bug 1669776.


One idea would be to change settings/base.py from this:

    "hg": {
        "hg.mozilla.org": (
            "https://hg.mozilla.org/%(repo)s/file/%(revision)s/%(file)s#l%(line)s"
        )
    },

to this:

    "hg": {
        "hg.mozilla.org": (
            "https://searchfox.org/%(repo)s/hgrev/%(revision)s/%(file)s#%(line)s"
        )
    },

This would work for mozilla-central. For crashes from other branches, e.g. integration/autoland, searchfox does not have the code, and this would generate URLs that 404.
So maybe the vcs_mappings structure needs to be extended to allow for per-repo URLs, not just per-server URLs.

For example:

    "hg": {
        "hg.mozilla.org/mozilla-central": (
            "https://searchfox.org/mozilla-central/hgrev/%(revision)s/%(file)s#%(line)s"
        ),
        "hg.mozilla.org": (
            "https://hg.mozilla.org/%(repo)s/file/%(revision)s/%(file)s#l%(line)s"
        )
    },

and then instead of

link = vcs_mappings[vcstype][server]

you'd do

server_link = vcs_mappings[vcstype][server]
# See if there is a more specific "server/repo" link format.
server_repo_key = "%s/%s" % (server, repo)
link = vcs_mappings[vcstype].get(server_repo_key, server_link)
Depends on: 1669776

I like this idea. Plus we could support multiple urls.

Making it a P2 to do at some point.

Priority: P5 → P2
Duplicate of this bug: 1808567
See Also: → 2060967
You need to log in before you can comment on or make changes to this bug.