opentracing.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. use Zipkin\Samplers\BinarySampler;
  12. return [
  13. 'default' => env('TRACER_DRIVER', 'zipkin'),
  14. 'enable' => [
  15. 'guzzle' => env('TRACER_ENABLE_GUZZLE', false),
  16. 'redis' => env('TRACER_ENABLE_REDIS', false),
  17. 'db' => env('TRACER_ENABLE_DB', false),
  18. 'method' => env('TRACER_ENABLE_METHOD', false),
  19. ],
  20. 'tracer' => [
  21. 'zipkin' => [
  22. 'driver' => \Hyperf\Tracer\Adapter\ZipkinTracerFactory::class,
  23. 'app' => [
  24. 'name' => env('APP_NAME', 'skeleton'),
  25. // Hyperf will detect the system info automatically as the value if ipv4, ipv6, port is null
  26. 'ipv4' => '127.0.0.1',
  27. 'ipv6' => null,
  28. 'port' => 9501,
  29. ],
  30. 'options' => [
  31. 'endpoint_url' => env('ZIPKIN_ENDPOINT_URL', 'http://localhost:9411/api/v2/spans'),
  32. 'timeout' => env('ZIPKIN_TIMEOUT', 1),
  33. ],
  34. 'sampler' => BinarySampler::createAsAlwaysSample(),
  35. ],
  36. 'jaeger' => [
  37. 'driver' => \Hyperf\Tracer\Adapter\JaegerTracerFactory::class,
  38. 'name' => env('APP_NAME', 'skeleton'),
  39. 'options' => [
  40. 'local_agent' => [
  41. 'reporting_host' => env('JAEGER_REPORTING_HOST', 'localhost'),
  42. 'reporting_port' => env('JAEGER_REPORTING_PORT', 5775),
  43. ],
  44. ],
  45. ],
  46. ],
  47. ];