Skip to content

USDT: normalize names for STATE_ENTER#13346

Merged
moonchen merged 1 commit into
apache:masterfrom
moonchen:usdt-state-enter-names
Jun 29, 2026
Merged

USDT: normalize names for STATE_ENTER#13346
moonchen merged 1 commit into
apache:masterfrom
moonchen:usdt-state-enter-names

Conversation

@moonchen

Copy link
Copy Markdown
Contributor

STATE_ENTER passed &HttpSM::<state> straight through as the USDT probe
name, so the probes were emitted with names like:

&HttpSM::state_read_client_request_header
&HttpSM::tunnel_handler_post

The & and :: characters are illegal in USDT probe names — bpftrace
and perf treat : as the provider/name field separator and reject &
— so these ~41 probes could not be attached by name at all.

This passes the bare handler name from each call site and prepends the
prefix inside the macro, producing valid names that share a common
wildcard:

state_enter_state_read_client_request_header
state_enter_tunnel_handler_post
bpftrace -e 'usdt:.../traffic_server:trafficserver:state_enter_* {
    printf("sm=%d %s\n", arg0, probe); }'

It also fixes a &HttpSM : typo (STATE_ENTER for state_cache_open_write)
that had collapsed one probe to a bare &HttpSM. The debug log is
unchanged in meaning ([state_read_client_request_header, EVENT]).

The broken names were introduced by #11769; this is independent of the
in-flight USDT work in #13344.

Copilot AI review requested due to automatic review settings June 29, 2026 03:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes ATS USDT probe naming for STATE_ENTER in HttpSM so probe names no longer contain illegal characters (&, ::) and can be attached by tools like bpftrace/perf.

Changes:

  • Update the STATE_ENTER macro to emit probes with a state_enter_ prefix and a normalized handler/state token.
  • Update all STATE_ENTER call sites in HttpSM.cc to pass the bare handler/state name (and fix the &HttpSM : typo at state_cache_open_write).

Comment thread src/proxy/http/HttpSM.cc Outdated
@moonchen moonchen self-assigned this Jun 29, 2026
@moonchen moonchen added ATS Probe Our SystemTap ATS probes Bug labels Jun 29, 2026
@moonchen moonchen added this to the 11.0.0 milestone Jun 29, 2026
STATE_ENTER passed `&HttpSM::<state>` straight through as the USDT
probe name, so probes were emitted as e.g.
`&HttpSM::state_read_client_request_header`. The `&` and `::`
characters are illegal in USDT probe names: bpftrace and perf treat
`:` as the provider/name field separator and reject `&`, so these
probes could not be attached by name.

Pass the bare handler name from each call site and add the prefix in
the macro, producing valid names like
`state_enter_state_read_client_request_header` that share a common
`state_enter_*` wildcard. Also fixes a `&HttpSM :` typo that had
collapsed one probe to a bare `&HttpSM`, and a call site that passed
the wrong label (`tunnel_handler_plugin_client` from
`tunnel_handler_plugin_agent`) so the probe name matches its handler.
@moonchen moonchen force-pushed the usdt-state-enter-names branch from db3f0ca to af4b9d2 Compare June 29, 2026 03:37
@moonchen moonchen merged commit 8ef5747 into apache:master Jun 29, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this to For v10.2.0 in ATS v10.2.x Jun 29, 2026
@github-project-automation github-project-automation Bot moved this to For v10.1.1 in ATS v10.1.x Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ATS Probe Our SystemTap ATS probes Bug

Projects

Status: For v10.1.1
Status: For v10.2.0

Development

Successfully merging this pull request may close these issues.

3 participants