{"id":13816366,"url":"https://github.com/jonahgeorge/jaeger-client-php","last_synced_at":"2026-01-16T00:45:07.710Z","repository":{"id":26365186,"uuid":"107800668","full_name":"jonahgeorge/jaeger-client-php","owner":"jonahgeorge","description":"Jaeger Bindings for PHP OpenTracing API","archived":false,"fork":false,"pushed_at":"2025-02-24T16:33:40.000Z","size":276,"stargazers_count":145,"open_issues_count":15,"forks_count":47,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-13T12:08:06.255Z","etag":null,"topics":["distributed-tracing","jaeger","jaegertracing","opentracing","php"],"latest_commit_sha":null,"homepage":"https://jaegertracing.io","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonahgeorge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-10-21T17:25:22.000Z","updated_at":"2024-12-21T08:25:05.000Z","dependencies_parsed_at":"2024-04-11T23:01:55.501Z","dependency_job_id":null,"html_url":"https://github.com/jonahgeorge/jaeger-client-php","commit_stats":{"total_commits":108,"total_committers":38,"mean_commits":"2.8421052631578947","dds":0.7685185185185185,"last_synced_commit":"3173d9c68ad8cea16058f25337982b00cc3d1c2b"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonahgeorge%2Fjaeger-client-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonahgeorge%2Fjaeger-client-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonahgeorge%2Fjaeger-client-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonahgeorge%2Fjaeger-client-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonahgeorge","download_url":"https://codeload.github.com/jonahgeorge/jaeger-client-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254367645,"owners_count":22059549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distributed-tracing","jaeger","jaegertracing","opentracing","php"],"created_at":"2024-08-04T05:00:39.551Z","updated_at":"2026-01-16T00:45:07.657Z","avatar_url":"https://github.com/jonahgeorge.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"![Build Status](https://github.com/jonahgeorge/jaeger-client-php/workflows/Test/badge.svg) [![PHP version][packagist-img]][packagist]\n\n# Jaeger Bindings for PHP OpenTracing API\n\nThis is a client-side library that can be used to instrument PHP apps for distributed trace collection,\nand to send those traces to Jaeger. See the [OpenTracing PHP API](https://github.com/opentracing/opentracing-php)\nfor additional detail.\n\n## Contributing and Developing\n\nPlease see [CONTRIBUTING.md](./CONTRIBUTING.md).\n\n## Installation\n\nJaeger client can be installed via Composer:\n\n```bash\ncomposer require jonahgeorge/jaeger-client-php\n```\n\n## Getting Started\n\n```php\n\u003c?php\n\nrequire_once 'vendor/autoload.php';\n\nuse Jaeger\\Config;\nuse OpenTracing\\GlobalTracer;\n\n$config = new Config(\n    [\n        'sampler' =\u003e [\n            'type' =\u003e Jaeger\\SAMPLER_TYPE_CONST,\n            'param' =\u003e true,\n        ],\n        'logging' =\u003e true,\n    ],\n    'your-app-name'\n);\n$config-\u003einitializeTracer();\n\n$tracer = GlobalTracer::get();\n\n$scope = $tracer-\u003estartActiveSpan('TestSpan', []);\n$scope-\u003eclose();\n\n$tracer-\u003eflush();\n```\n\n### Samplers\n\nList of supported samplers, for more info about samplers, please read [Jaeger Sampling](https://www.jaegertracing.io/docs/1.9/sampling/) guide.\n\n#### Const sampler\nThis sampler either samples everything, or nothing.\n\n##### Configuration\n```\n'sampler' =\u003e [\n    'type' =\u003e Jaeger\\SAMPLER_TYPE_CONST,\n    'param' =\u003e true, // boolean wheter to trace or not\n],\n```\n\n#### Probabilistic sampler\nThis sampler samples request by given rate.\n\n##### Configuration\n```\n'sampler' =\u003e [\n    'type' =\u003e Jaeger\\SAMPLER_TYPE_PROBABILISTIC,\n    'param' =\u003e 0.5, // float [0.0, 1.0]\n],\n```\n\n#### Rate limiting sampler\nSamples maximum specified number of traces (requests) per second.\n\n##### Requirements\n* `psr/cache` PSR-6 cache component to store and retrieve sampler state between requests.\nCache component is passed to `Jaeger\\Config` trough its constructor.\n* `hrtime()` function, that can retrieve time in nanoseconds. You need either `php 7.3` or [PECL/hrtime](http://pecl.php.net/package/hrtime) extension.\n\n##### Configuration\n```\n'sampler' =\u003e [\n    'type' =\u003e Jaeger\\SAMPLER_TYPE_RATE_LIMITING,\n    'param' =\u003e 100 // integer maximum number of traces per second,\n    'cache' =\u003e [\n        'currentBalanceKey' =\u003e 'rate.currentBalance' // string\n        'lastTickKey' =\u003e 'rate.lastTick' // string\n    ]\n],\n```\n## Dispatch mode\n\nThe library supports 3 ways of sending data to Jaeger Agent:  \n\n1. `Zipkin.thrift` over Compact protocol (socket - UDP) - default \n2. `Jaeger.thrift` over Binary protocol (socket - UDP)\n2. `Jaeger.thrift` over Binary protocol (HTTP)\n\nIf you want to enable \"`Jaeger.thrift` over Binary protocol\" one or other, than\nyou need to set `dispatch_mode` config option or `JAEGER_DISPATCH_MODE` env\nvariable.\n\nAllowed values for `dispatch_mode` are:\n- `jaeger_over_binary_udp`\n- `jaeger_over_binary_http`\n- `zipkin_over_compact_udp`\n\nThere are 3 constants available, so it is better to use them:\n```php\nclass Config\n{\n    const ZIPKIN_OVER_COMPACT_UDP   = \"zipkin_over_compact_udp\";\n    const JAEGER_OVER_BINARY_UDP    = \"jaeger_over_binary_udp\";\n    const JAEGER_OVER_BINARY_HTTP   = \"jaeger_over_binary_http\";\n    ...\n}\n```\n\nA possible config with custom `dispatch_mode` can look like this:\n```php\n// config.php\n\nuse Jaeger\\Config;\n\nreturn [\n    'sampler' =\u003e [\n        'type' =\u003e Jaeger\\SAMPLER_TYPE_CONST,\n        'param' =\u003e true,\n    ],\n    'logging' =\u003e true,\n    \"tags\" =\u003e [\n        // process. prefix works only with JAEGER_OVER_HTTP, JAEGER_OVER_BINARY\n        // otherwise it will be shown as simple global tag\n        \"process.process-tag-key-1\" =\u003e \"process-value-1\", // all tags with `process.` prefix goes to process section\n        \"process.process-tag-key-2\" =\u003e \"process-value-2\", // all tags with `process.` prefix goes to process section\n        \"global-tag-key-1\" =\u003e \"global-tag-value-1\", // this tag will be appended to all spans\n        \"global-tag-key-2\" =\u003e \"global-tag-value-2\", // this tag will be appended to all spans\n    ],\n    \"local_agent\" =\u003e [\n        \"reporting_host\" =\u003e \"localhost\", \n//        You can override port by setting local_agent.reporting_port value   \n        \"reporting_port\" =\u003e 6832\n    ],\n//     Different ways to send data to Jaeger. Config::ZIPKIN_OVER_COMPACT - default):\n    'dispatch_mode' =\u003e Config::JAEGER_OVER_BINARY_UDP,\n];\n```\nThe full example you can see at `examples` directory.\n\nBy default, for each `dispatch_mode` there is default `reporting_port` config value. Table with\ndefault values you can see below: \n\n`dispatch_mode`          | default `reporting_port` \n------------------------ | ---------------- \nZIPKIN_OVER_COMPACT_UDP  | 5775\nJAEGER_OVER_BINARY_UDP   | 6832\nJAEGER_OVER_BINARY_HTTP  | 14268\n\n## IPv6\n\nIn case you need IPv6 support you need to set `ip_version` Config variable.\nBy default, IPv4 is used. There is an alias `Config::IP_VERSION` which you can use\nas an alternative to raw `ip_version`.\n\nExample:\n\n```php\nuse Jaeger\\Config;\n\n$config = new Config(\n    [\n        \"ip_version\" =\u003e Config::IPV6, // \u003c-- or use Config::IP_VERSION constant\n        'logging' =\u003e true,\n        'dispatch_mode' =\u003e Config::JAEGER_OVER_BINARY_UDP,\n    ],\n    'serviceNameExample',\n);\n$config-\u003einitializeTracer();\n```\nor\n\n```php\nuse Jaeger\\Config;\n\n$config = new Config(\n    [\n        Config::IP_VERSION =\u003e Config::IPV6, // \u003c--\n        'logging' =\u003e true,\n        'dispatch_mode' =\u003e Config::JAEGER_OVER_BINARY_UDP,\n    ],\n    'serviceNameExample',\n);\n$config-\u003einitializeTracer();\n```\n\n\n## Testing\n\nTests are located in the `tests` directory. See [tests/README.md](./tests/README.md).\n\n## Roadmap\n\n- [Support Span baggage](https://github.com/jonahgeorge/jaeger-client-php/issues/5)\n- [Support Tracer metrics](https://github.com/jonahgeorge/jaeger-client-php/issues/12)\n- [Support Tracer error reporting](https://github.com/jonahgeorge/jaeger-client-php/issues/13)\n\n## License\n\n[MIT License](./LICENSE).\n\n[ci-img]: https://travis-ci.org/jonahgeorge/jaeger-client-php.svg?branch=travis\n[ci]: https://travis-ci.org/jonahgeorge/jaeger-client-php\n[packagist-img]: https://badge.fury.io/ph/jonahgeorge%2Fjaeger-client-php.svg\n[packagist]: https://badge.fury.io/ph/jonahgeorge%2Fjaeger-client-php\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonahgeorge%2Fjaeger-client-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonahgeorge%2Fjaeger-client-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonahgeorge%2Fjaeger-client-php/lists"}