dd-trace-php
dd-trace-php copied to clipboard
feat(profiling): emit metrics for stack-walking overhead
Description
Currently emits a metric datadog.profiling.php.stack_walk_ns as a histogram. It's gated behind the feature profiling_metrics which is off by default.
This is needed to more accurately track the cost of stack walking.
Also fixes some clippy warnings.
PROF-7576
Readiness checklist
- [ ] Changelog has been added to the release document.
- [ ] Tests added for this feature/bug.
Reviewer checklist
- [x] Appropriate labels assigned.
- [x] Milestone is set.
Benchmarks
Benchmark execution time: 2023-07-06 11:28:44
Comparing candidate commit 4737d98710b65255b4f6df5e7272fabbdc9ac6ff in PR branch levi/profiling-stats with baseline commit 3a37639fed88fc528e60153d42f1a644ccd64f29 in branch master.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 6 metrics, 0 unstable metrics.
It's working 😄 I have two ideas that we should think about before GAing this (so it is not blocking this PR):
- we could maybe move the
dogstatsd.rsto libdatadog - we should measure the impact on sample creation, as currently this is in the hot path
Do we need to turn this on for releases (not release builds, the releases we ship to customers)? My thought was we don't, and this lowers our risk substantially.
I thought the same, that's why I approved it. Additionally I like the idea of somewhen in the future having our profiler sending those kind of data to us, so we would have more insight in how it performs on customer machines.
I also think dogstatsd would be a good fit for a small crate in libdatadog. Can we move it there? :-)
I worry if we put the dogstatsd bits into libdatadog that it may unintentionally get used in prod by libdatadog users. There is a tiny bit of testing but I'm not sure it's production ready. That doesn't matter for this PR, since it's not enabled for our production builds, but users in libdatadog may not realize this.
I do agree it would be nice to have a solid dogstatsd client in libdatadog, though.