Middleware
class Middleware
This class handles integration with GuzzleHttp 6. Adding this middleware to your Guzzle client, will enable distrubted tracing by passing along the trace context header and will also create trace spans for all outgoing requests.
Example:
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use OpenCensus\Trace\Integrations\Guzzle\Middleware;
$stack = new HandlerStack();
$stack->setHandler(\GuzzleHttp\choose_handler());
$stack->push(new Middleware());
$client = new Client(['handler' => $stack]);
Methods
__construct(PropagatorInterface $propagator = null)
Create a new Guzzle middleware that creates trace spans and propagates the current trace context to the downstream request.
callable
__invoke(callable $handler)
Magic method which makes this object callable. Guzzle middleware are expected to be callables.
Details
at line 56
__construct(PropagatorInterface $propagator = null)
Create a new Guzzle middleware that creates trace spans and propagates the current trace context to the downstream request.
at line 68
callable
__invoke(callable $handler)
Magic method which makes this object callable. Guzzle middleware are expected to be callables.