chore: upgrades zipkin to 2.0. (#2712)

* chore: upgrades zipkin to 2.0.

* fix(tracer): fixes the static checks.

Code would still work with no changes as Zipkin 2.0 is mostly retrocompatible but static checks fails.

* chore(tracer): upgrades zipkin-opentracing to 0.2.0

* Format code.

Co-authored-by: 李铭昕 <715557344@qq.com>
This commit is contained in:
José Carlos Chávez 2020-10-29 08:26:12 +01:00 committed by GitHub
parent 07e0181cff
commit caf4435d2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 4 deletions

View File

@ -7,6 +7,7 @@
- Upgraded `vlucas/phpdotenv` to `^5.0`;
- Upgraded `endclothing/prometheus_client_php` to `^1.0`;
- Upgraded `twig/twig` to `^3.0`;
- Upgraded `jcchavezs/zipkin-opentracing` to `^0.2.0`;
## Removed

View File

@ -47,7 +47,7 @@
"hyperf/engine": "dev-master",
"influxdb/influxdb-php": "^1.15.0",
"ircmaxell/random-lib": "^1.2",
"jcchavezs/zipkin-opentracing": "^0.1.5",
"jcchavezs/zipkin-opentracing": "^0.2.0",
"jean85/pretty-package-versions": "^1.2",
"jonahgeorge/jaeger-client-php": "^0.6.0",
"laminas/laminas-mime": "^2.7",

View File

@ -22,7 +22,7 @@
"hyperf/di": "~2.1.0",
"hyperf/guzzle": "~2.1.0",
"hyperf/utils": "~2.1.0",
"jcchavezs/zipkin-opentracing":"^0.1.3",
"jcchavezs/zipkin-opentracing":"^0.2.0",
"opentracing/opentracing":"1.0.*"
},
"require-dev": {

View File

@ -29,7 +29,7 @@ class HttpClientFactory implements ClientFactory
public function build(array $options): callable
{
return function ($payload) use ($options) {
return function (string $payload) use ($options): void {
$url = $options['endpoint_url'];
unset($options['endpoint_url']);
$client = $this->guzzleClientFactory->create($options);
@ -37,6 +37,7 @@ class HttpClientFactory implements ClientFactory
$requiredHeaders = [
'Content-Type' => 'application/json',
'Content-Length' => strlen($payload),
'b3' => '0',
];
$headers = array_merge($additionalHeaders, $requiredHeaders);
$response = $client->post($url, [

View File

@ -49,7 +49,7 @@ class ZipkinTracerFactory implements NamedFactoryInterface
}
[$app, $options, $sampler] = $this->parseConfig();
$endpoint = Endpoint::create($app['name'], $app['ipv4'], $app['ipv6'], $app['port']);
$reporter = new Http($this->clientFactory, $options);
$reporter = new Http($options, $this->clientFactory);
$tracing = TracingBuilder::create()
->havingLocalEndpoint($endpoint)
->havingSampler($sampler)