Skip to content

Expand strings nodes in graph#18

Open
zzet wants to merge 1 commit intomainfrom
extend_strings_nodes_coversage
Open

Expand strings nodes in graph#18
zzet wants to merge 1 commit intomainfrom
extend_strings_nodes_coversage

Conversation

@zzet
Copy link
Copy Markdown
Owner

@zzet zzet commented May 6, 2026

Per-repo index for string literals that cross an API boundary — Datadog/dogstatsd metric names, errors.New / fmt.Errorf messages, and raw HTTP route paths. Each extractor emits a KindString node and an EdgeEmits from the enclosing function; applyRepoPrefix stamps the repo slug so two repos emitting the same metric stay distinct.

Go extractor whitelist:

  • metric: Increment, Decrement, Count, Gauge, Histogram, Distribution, Timing, TimeInMilliseconds, Event, ServiceCheck (statsd / dogstatsd shape; Set/Inc/Add deliberately excluded as too generic).
  • error_msg: errors.New, fmt.Errorf, xerrors.New, xerrors.Errorf.
  • route: Handle / HandleFunc / Get / Post / Put / Delete / Patch / Options / Head / Connect / Trace, gated on a path-likeness check so cache.Get("user:42") doesn't fall in. Accepts net/http 1.22+ pattern syntax ("GET /foo").

New analyzer analyze kind=string_emitters groups by (context, value) with context and name-substring filters; supports JSON, GCX1 wire format, and compact-text outputs. Long values (>200 chars) get a 16-char SHA1 suffix in the node ID; short ones keep the literal text for direct grep.

Per-repo index for string literals that cross an API boundary —
Datadog/dogstatsd metric names, errors.New / fmt.Errorf messages,
and raw HTTP route paths. Each extractor emits a KindString node
and an EdgeEmits from the enclosing function; applyRepoPrefix
stamps the repo slug so two repos emitting the same metric stay
distinct.

Go extractor whitelist:
- metric: Increment, Decrement, Count, Gauge, Histogram,
  Distribution, Timing, TimeInMilliseconds, Event, ServiceCheck
  (statsd / dogstatsd shape; Set/Inc/Add deliberately excluded
  as too generic).
- error_msg: errors.New, fmt.Errorf, xerrors.New, xerrors.Errorf.
- route: Handle / HandleFunc / Get / Post / Put / Delete / Patch /
  Options / Head / Connect / Trace, gated on a path-likeness check
  so cache.Get("user:42") doesn't fall in. Accepts net/http 1.22+
  pattern syntax ("GET /foo").

New analyzer `analyze kind=string_emitters` groups by
(context, value) with context and name-substring filters; supports
JSON, GCX1 wire format, and compact-text outputs. Long values
(>200 chars) get a 16-char SHA1 suffix in the node ID; short ones
keep the literal text for direct grep.
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.

1 participant