opentracing.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. use function Hyperf\Support\env;
  13. return [
  14. 'default' => env('TRACER_DRIVER', 'zipkin'),
  15. 'enable' => [
  16. 'guzzle' => env('TRACER_ENABLE_GUZZLE', false),
  17. 'redis' => env('TRACER_ENABLE_REDIS', false),
  18. 'db' => env('TRACER_ENABLE_DB', false),
  19. 'method' => env('TRACER_ENABLE_METHOD', false),
  20. ],
  21. 'tracer' => [
  22. 'zipkin' => [
  23. 'driver' => \Hyperf\Tracer\Adapter\ZipkinTracerFactory::class,
  24. 'app' => [
  25. 'name' => env('APP_NAME', 'skeleton'),
  26. // Hyperf will detect the system info automatically as the value if ipv4, ipv6, port is null
  27. 'ipv4' => '127.0.0.1',
  28. 'ipv6' => null,
  29. 'port' => 9501,
  30. ],
  31. 'options' => [
  32. 'endpoint_url' => env('ZIPKIN_ENDPOINT_URL', 'http://localhost:9411/api/v2/spans'),
  33. 'timeout' => env('ZIPKIN_TIMEOUT', 1),
  34. ],
  35. 'sampler' => BinarySampler::createAsAlwaysSample(),
  36. ],
  37. 'jaeger' => [
  38. 'driver' => \Hyperf\Tracer\Adapter\JaegerTracerFactory::class,
  39. 'name' => env('APP_NAME', 'skeleton'),
  40. 'options' => [
  41. 'local_agent' => [
  42. 'reporting_host' => env('JAEGER_REPORTING_HOST', 'localhost'),
  43. 'reporting_port' => env('JAEGER_REPORTING_PORT', 5775),
  44. ],
  45. ],
  46. ],
  47. ],
  48. ];