Comments (8)
Hi @PROFeNoM ,
i try to list all the pieces from the "outside" to the "inside":
$results = Utils::unwrap([
'foo' => $fooService->getFoo($id),
'bar' => $barService->getBar($id),
'baz' => $bazService->getBaz($id),
]);
inside those service calls:
return $this->client->getAsync('/foo/bar/baz' , $options + ['http_errors' => false,]);
this is how the client is build:
$guzzleClient = new HttpClient([
'base_uri' => $config->get('foo.client.base_uri'),
'auth' => [
$config->get('foo.client.auth.username'),
$config->get('foo.client.auth.password')
],
'verify' => $config->get('foo.client.verify'),
'timeout' => $config->get('foo.client.timeout'),
'allow_redirects' => false,
'handler' => $handlerStack,
'headers' => [
'Accept' => 'application/json',
'Accept-Encoding' => 'gzip, deflate',
'foo-statistics' => $this->getFooHeaderValue($config),
],
]);
and here the handlerstack:
$this->app->singleton(HttpFooHandlerStack::class, static function (Application $app) {
$handlerStack = HttpFooHandlerStack::create($app->make(CurlMultiHandler::class));
$handlerStack->push($app->make(FooErrorHandlingMiddleware::class)->__invoke());
$handlerStack->before('http_errors', $app->make(HttpLoggingMiddleware::class)->__invoke());
return $handlerStack;
});
the middlewares look kind of like this:
public function __invoke(): callable{
return function (callable $handler) {
return function (RequestInterface $request, array $options) use ($handler) {
return $handler($request, $options)->then($this->handleResponse($request));
};
}
;}
private function handleResponse(RequestInterface $request): callable
{
return function (ResponseInterface $response) use ($request) {
...
}
}
and
public function __invoke(){
return function (callable $handler) {
return function (RequestInterface $request, array $options) use ($handler) {
$id = Uuid::uuid4()->toString();
$request = $this->handleRequest($request, $id);
$start = microtime(true);
return $this
->getPromise($request, $options, $handler)
->then(
$this->handleResponse($request, $start, $id),
$this->handleRejection($id)
);
};
};
}
private function getPromise(RequestInterface $request, array $options, callable $next): PromiseInterface
{
return $next($request, $options);
}
private function handleRequest(RequestInterface $request, string $guzzleRequestId): RequestInterface
{
...
}
private function handleResponse(RequestInterface $request, float $start, string $guzzleRequestId)
{
return function (ResponseInterface $response) use ($request, $start, $guzzleRequestId) {
return $response;
};
}
While checking this out i made some more tests and found out, that leaving out the second and third call from the unwrap, the error is gone and the first request will be displayed correctly in the dd ui:
$results = Utils::unwrap([
'foo' => $fooService->getFoo($id),
]);
Hope this helps. Let me know if i can give you more infos.
from dd-trace-php.
i only had 5 minutes but this looks really promising:
thx so far.
from dd-trace-php.
Hi @skranz-codi !
After doing some testing on my side, using guzzle, I may have been able to reproduce your issue:
I'd have what I call "dummy curl_exec
spans", most notably with host-unparsable-host
. I tried some changes in a branch of mine that aims to address some cases.
Could please try out this artifact (CI job)? To use the artifact, you can simply replace the datadog-setup.php link you are using when installing the tracer with the one from the artifact.
from dd-trace-php.
hi @PROFeNoM and thx for the response!
I tried your version, but the issue sadly is still there:
i checked the build pipe and i am quite sure i am now using your version when installing the extension:
One thing I never fully understood: I have to install the extension AND add the dependency via composer ("datadog/dd-trace": "0.96.0"), right? While testing your version i still have the 0.96.0 composer lib installed. Is this ok?
Thx again for your effort!
from dd-trace-php.
Hi @skranz-codi !
Alright, I'll try to reproduce it further. Can I please know how are you making these requests (the essence of the code that is running)? What I was trying was to do some getAsync
and wait for them (as you may see in this draft test file).
If you have this information, I'd be interested to know what status code you expect from these requests (so that I can try to reproduce it with the same type of request).
Thanks
I have to install the extension AND add the dependency via composer ("datadog/dd-trace": "0.96.0"), right? While testing your version i still have the 0.96.0 composer lib installed.
You don't have to. Only the extension is required.
Is this ok?
It shouldn't be a problem; it isn't required for common use cases.
from dd-trace-php.
Hi @skranz-codi!
Thanks for your fantastic description.
This time I've made another artifact (CI Job - Branch) that should cover some additional cases, especially when considering non-erroneous requests (which is your case) 🤞
from dd-trace-php.
Hey @skranz-codi 👋
FYI, the 0.97.0 release was made yesterday, which includes the PR #2460 :)
from dd-trace-php.
hi, i am already testing it and it still looks very good 👍 thx again for the fix!
from dd-trace-php.
Related Issues (20)
- [Bug]: Nested exceptions are not recorded in `Integration::setError()` HOT 2
- [Security] Medium Vulnerability rustix in tag 0.97.0 HOT 2
- [Bug]: ddappsec startup warnings HOT 9
- [Feature] CURL multi exec integration is lacking data in the APM view HOT 7
- [Bug]: PDO/PHPRedis client split by instance inconsistency HOT 1
- [Bug]: Segfault in dd_patched_zend_call_known_function HOT 3
- [Bug]: ddtrace overrides php error log permissions HOT 1
- [Documentation]: OTEL tracing HOT 8
- [Feature] Add JSON body items to http.request
- [Feature] Laravel Livewire 3 Support
- [Bug]: Standalone null Return Type for update_span_duration Causes Phan Parsing to Fail for PHP <8.2 HOT 1
- [Bug]: new operation `command_execution` HOT 3
- [Bug]: Memory leak in creating Tracer HOT 8
- [Bug]: 0.98.x tar.gz file size increased? HOT 1
- [Bug]: Bad signature error HOT 6
- [Feature] Error Tracking via logs HOT 2
- [Bug]: CLI PHP Processes do not stop and with Apache (mod_php) the connection is closed unexpectedly HOT 1
- [Bug]: Laravel Octane traces not showing in dashboard HOT 15
- [Bug]: Service name is always "laravelqueue" and can't be changed HOT 1
- [Feature] Missing instrumentation for batched AMQP publishing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dd-trace-php.