Skip to content

internal/graph: escape tag names in dot nodelets - #1054

Open
reginaldalfret wants to merge 1 commit into
google:mainfrom
reginaldalfret:fix/escape-nodelet-tag-names
Open

reginaldalfret wants to merge 1 commit into
google:mainfrom
reginaldalfret:fix/escape-nodelet-tag-names

Conversation

@reginaldalfret

Copy link
Copy Markdown

Sample tag names can contain quotes, backslashes, or other characters that require escaping when emitted as string literals in DOT format (e.g. structured keys or custom application tags). Previously, .Name was interpolated directly into the nodelet DOT statement without escapeForDot(t.Name), causing Graphviz parsing errors when rendering the profile graph.

This PR wraps .Name in escapeForDot in �ddNodelets and
umericNodelets within internal/graph/dotgraph.go, and adds regression test coverage in internal/graph/dotgraph_test.go.

Fixes #769

Sample tag names may contain quotes, backslashes, or newlines (for example,
structured database keys or raw string tags). When generating DOT nodelets,
the unescaped tag names broke Graphviz syntax.

Escape tag names with escapeForDot in addNodelets and numericNodelets,
and add a regression test.

Fixes google#769

Signed-off-by: reginaldalfret <reginaldalfret@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quotes in CPU profile tags not escaped properly

1 participant