Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal/graph: Escape tag labels correctly for dot #683

Closed
wants to merge 2 commits into from

Commits on Feb 17, 2022

  1. internal/graph: Escape tag labels correctly for dot

    Fixes syntax errors when trying to render pprof profiles that have
    double quotes in tags. These can be created with Go's pprof labels
    feature, for example with:
    
        pprof.Labels("key", "label \"double quote\"\nline two")
    
    Without this change, trying to render a diagram will fail with:
    
        Error: <stdin>: syntax error in line 5 near 'quote'
    
    The problem is that the double quote ('"') was never escaped in the
    label strings. This required me changing how multiple tags are
    joined. Previously they were joined with the two character `\n`
    sequence, which is a centered newline in dot. This changes it to
    a single character newline "\n", which is then escaped as
    left-justified strings "\l" in dot.
    
    * Add a new graph test for labels.
    * Add a test for joinLabels.
    * Update the tests in driver which converts \n to \l.
    evanj committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    ded1d62 View commit details
    Browse the repository at this point in the history

Commits on Feb 18, 2022

  1. Change escapeForDot to escape everything on to one line.

    This was suggested by code review. This requires a bit of a hack in
    joinLabels, so we have the right combination of escaped and not
    escaped strings.
    evanj committed Feb 18, 2022
    Configuration menu
    Copy the full SHA
    b63906b View commit details
    Browse the repository at this point in the history