Skip to content

feat(debug): add more metrics in ThreadDebugState#2282

Open
alexandre-daubois wants to merge 1 commit intophp:mainfrom
alexandre-daubois:observability
Open

feat(debug): add more metrics in ThreadDebugState#2282
alexandre-daubois wants to merge 1 commit intophp:mainfrom
alexandre-daubois:observability

Conversation

@alexandre-daubois
Copy link
Member

I'm working on an observability tool and exposing those metrics would be useful. For each thread, it exposes the current URI being processed, the method, the request start date, the request count and the memory usage.

@dunglas
Copy link
Member

dunglas commented Mar 14, 2026

Could we measure the performance cost of this? Maybe should this feature be put behind a flag?

@henderkes
Copy link
Contributor

Did I just spend 10 hours attempting to figure out why my other branch segfaults on 8.2 debian images and it's not actually related to my branch in the end?

Certainly seems like it...

@alexandre-daubois
Copy link
Member Author

Could we measure the performance cost of this? Maybe should this feature be put behind a flag?

I'll do benchmarks soon and we'll be able to see from there!

@alexandre-daubois
Copy link
Member Author

This is the impact, on already existing benchmark:

  • HelloWorld:
    • main: 32.14us
    • branch: 33.17us
    • Delta: ~1us
  • Echo:
    • main: 29.07us
    • branch: 29.02us
    • Delta: None
  • ** ServerSuperGlobal**:
    • main: 62.15us
    • branch: 63.12us
    • Delta: ~1us
  • ** UncommonHeaders**:
    • main: 59.20
    • branch: 60.12
    • Delta: ~1us

Also, 0 additional allocation is recorded on the hot path. The impact is negligible and the metrics newly exposed would really help better monitor how things are going while processing requests.

@henderkes
Copy link
Contributor

Also, 0 additional allocation is recorded on the hot path. The impact is negligible and the metrics newly exposed would really help better monitor how things are going while processing requests.

Sounds reasonable to me.

Out of curiosity, does anybody know of a per-route monitoring solution that exposes metrics like number of requests, php request duration, etc.? Much like Sentry, Datadog or Tideways, but without all the low-level insights?

Or perhaps that's a good candidate for a go php extension to hook into the runtime, gather the data, hand it to Go and add it to the prometheus metrics?

@alexandre-daubois
Copy link
Member Author

Not that I'm aware of, but an extension for this purpose could indeed be a good idea

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.

3 participants