auxmoney / opentracingbundle-guzzle Goto Github PK
View Code? Open in Web Editor NEWGuzzle extension for the auxmoney/OpentracingBundle-core
License: MIT License
Guzzle extension for the auxmoney/OpentracingBundle-core
License: MIT License
Within https://github.com/8p/EightPointsGuzzleBundle the handlers are services by themself. The Client doesn't seem to get registred.
id: eight_points_guzzle.handler_stack.
class: GuzzleHttp\HandlerStack
I would suggest the following change:
if ($definition->getClass() === Client::class) {
$this->addMiddlewareToHandlerStack($container, $definition, $clientServiceName);
} elseif () {
$definition->addMethodCall('push', [new Reference(GuzzleRequestSpanning::class)]);
$definition->addMethodCall('push', [new Reference(GuzzleTracingHeaderInjection::class)]);
}
We should check the upgrade guide and enable the plugin to work with Guzzle v7.
In order to save manual implementation overhead for each bundle user, we would like to automatically generate spans for Guzzle requests, exactly like auxmoney/OpentracingBundle-core#2 .
In GuzzleRequestSpanning
, isn't the $onRejected
callback missing ?
OpentracingBundle-Guzzle/Middleware/GuzzleRequestSpanning.php
Lines 31 to 37 in ced155c
See the relevant interface here:
https://github.com/guzzle/promises/blob/89b1a76b7fda5853401297dc4b2a093cba1fda23/src/PromiseInterface.php#L28-L31
I fear that if the request is canceled or in case of an error, the open span won't be closed.
We have a factory that creates a guzzle client, this factory returns the guzzle client with a handler created given some arguments.
The service looks like this:
admin.microservice.client:
class: GuzzleHttp\Client
factory: [\Agriconomie\Microservice\ClientFactory, create]
arguments:
$debug: '%kernel.debug%'
$logger: '@monolog.logger.internal_api'
And the factory:
/**
* @param bool $debug
* @param LoggerInterface|null $logger
*/
public static function create(bool $debug, ?LoggerInterface $logger) {
$handlerStack = HandlerStack::create();
$client = new \GuzzleHttp\Client([
'handler' => $handlerStack
]);
if (null !== $logger) {
$handlerStack->push(Middleware::log($logger, new MessageFormatter(MessageFormatter::SHORT), LogLevel::INFO));
if ($debug) {
$handlerStack->push(Middleware::log($logger, new MessageFormatter(MessageFormatter::DEBUG), LogLevel::DEBUG));
}
}
return $client;
}
I integrated the opentracing guzzle bundle, it breaks here i think:
probably because of this:
Shouldn't the process
method take care of the factory use case ?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.