-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Symfony Command "sh" shell_exec error spans #3127
Comments
So, if I understand it right, the goal is to specifically not trace that specific span, right?
Untested - it should prevent the span from being created at all during that function. Something along these lines should suppress the span creation. This is a bit hacky though and I agree that there should be a better mechanism to selectively suppress spans from integrations. Thinking that possibly disabling the integration via ini should temporarily pause the spans from that integration (and resume once re-enabled again). |
@bwoebi Yes that's right. We only want to get rid of that specific span. I can give that a try. I also thought about disabling the integration. If possible, we would like to keep the exec integration, to have visibility into the useful things it tracks. |
hook_method will also work, I'm mostly using install_hook to stuff the hook id into the $data property to remove_hook it afterwards. But suppressCall is specific to install_hook. |
Yes that makes sense. I'll try it that way |
Bug report
We experience the same issue as described in #2589.
But I cannot reopen that bug, so I'm creating a new one.
We have error spans with
operation=command_execution
andresource=sh
in our Symfony Command traces. These would be no issue, if we could just remove them with a sampling rate of 0 using tracer sampling rules. But that does not work, because we use theDD_APM_FEATURES=error_rare_sample_tracer_drop
setting (Docs).If I understand the documentation correctly, we would loose errors of traces that are removed by our custom dd-trace sampling rules if we disable the
error_rare_sample_tracer_drop
setting:So we cannot remove these
sh
traces at the moment.I had a look if we can remove these
sh
spans manually. But as I understand, this is not possible. I'm not 100% sure though.One thing I saw was the
\dd_untrace('shell_exec');
function, but as I understand, this will just remove registered hooks. The code that adds thesh
traces (ExecIntegration::init()) however, adds a hook that manually creates a span. So I'm not sure if usingdd_untrace()
would work.Creating a posthook around
shell_exec
using\DDTrace\hook_method()
and just removing all the error metadata from thesh
span also does not work I think. I don't see a way how we could gain access to the span created by theExecIntegration
hook.Here's some pseudocode of these thoughts:
Example sampling rule config (from
php --ri=ddtrace; php --ri=datadog-profiling
):The code that runs the
stty 2> /dev/null
shell command is the following: https://github.com/symfony/console/blob/e51498ea18570c062e7df29d05a7003585b19b88/Terminal.php#L131This code is triggered when a Symfony Command runs.
We are using Symfony 5.4, so would be great if a fix would also cover that version if it is somehow tied to Symfony.
PHP version
8.2.27
Tracer or profiler version
0.99.1
Installed extensions
Output of
phpinfo()
Upgrading from
No response
The text was updated successfully, but these errors were encountered: