{"id":31768951,"url":"https://github.com/opentelemetry-php/contrib-sqlcommenter","last_synced_at":"2026-01-20T16:39:49.939Z","repository":{"id":318238185,"uuid":"1070113323","full_name":"opentelemetry-php/contrib-sqlcommenter","owner":"opentelemetry-php","description":"[READONLY] OpenTelemetry SqlCommenter","archived":false,"fork":false,"pushed_at":"2025-10-05T09:47:29.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-06T01:44:02.797Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opentelemetry-php.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-05T09:46:52.000Z","updated_at":"2025-10-05T09:47:33.000Z","dependencies_parsed_at":"2025-10-06T01:44:04.466Z","dependency_job_id":"75188e40-9639-49bf-bfc8-dbc22125a8b9","html_url":"https://github.com/opentelemetry-php/contrib-sqlcommenter","commit_stats":null,"previous_names":["opentelemetry-php/contrib-sqlcommenter"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/opentelemetry-php/contrib-sqlcommenter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentelemetry-php%2Fcontrib-sqlcommenter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentelemetry-php%2Fcontrib-sqlcommenter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentelemetry-php%2Fcontrib-sqlcommenter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentelemetry-php%2Fcontrib-sqlcommenter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opentelemetry-php","download_url":"https://codeload.github.com/opentelemetry-php/contrib-sqlcommenter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentelemetry-php%2Fcontrib-sqlcommenter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006026,"owners_count":26084024,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-10-10T02:23:57.082Z","updated_at":"2025-10-11T03:04:47.546Z","avatar_url":"https://github.com/opentelemetry-php.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Releases](https://img.shields.io/badge/releases-purple)](https://github.com/opentelemetry-php/contrib-sqlcommenter/releases)\n[![Issues](https://img.shields.io/badge/issues-pink)](https://github.com/open-telemetry/opentelemetry-php/issues)\n[![Source](https://img.shields.io/badge/source-contrib-green)](https://github.com/open-telemetry/opentelemetry-php-contrib/tree/main/src/SqlCommenter)\n[![Mirror](https://img.shields.io/badge/mirror-opentelemetry--php--contrib-blue)](https://github.com/opentelemetry-php/contrib-sqlcommenter)\n[![Latest Version](http://poser.pugx.org/open-telemetry/opentelemetry-sqlcommenter/v/unstable)](https://packagist.org/packages/open-telemetry/opentelemetry-sqlcommenter/)\n[![Stable](http://poser.pugx.org/open-telemetry/opentelemetry-sqlcommenter/v/stable)](https://packagist.org/packages/open-telemetry/opentelemetry-sqlcommenter/)\n\n\u003e **Note:** This is a read-only subtree split of [open-telemetry/opentelemetry-php-contrib](https://github.com/open-telemetry/opentelemetry-php-contrib).\n\n# OpenTelemetry SQL Commenter\n\nOpenTelemetry SQL Commenter for PHP provides a [SqlCommenter](https://opentelemetry.io/docs/specs/semconv/database/database-spans/#sql-commenter) implementation, enabling you to inject trace and context comments into SQL queries for enhanced observability and distributed tracing.\n\n## Installation\n\nInstall via Composer:\n\n```bash\ncomposer require open-telemetry/opentelemetry-sqlcommenter\n```\n\n## Usage\n\nInject comments into your SQL query as follows:\n\n```php\nuse OpenTelemetry\\SqlCommenter\\SqlCommenter;\n\n$comments = [\n    'traceparent' =\u003e '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-00',\n    'custom' =\u003e 'value',\n];\n$query = SqlCommenter::inject($query, $comments);\n```\n\n## Configuration\n\n- **Context Propagators**\n\n  Set the propagators to use (comma-separated):\n\n  ```shell\n  OTEL_PHP_SQLCOMMENTER_CONTEXT_PROPAGATORS=tracecontext\n  ```\n  Default: `''`\n\n- **SQL Commenter Attribute**\n\n  Add SQL comments to `DbAttributes::DB_QUERY_TEXT` in span attributes:\n\n  ```shell\n  otel.sqlcommenter.attribute = true\n  ```\n  or via environment variable:\n  ```shell\n  OTEL_PHP_SQLCOMMENTER_ATTRIBUTE=true\n  ```\n  Default: `false`\n\n- **Prepend Comments**\n\n  Prepend comments to the query statement using either a configuration directive:\n\n  ```shell\n  otel.sqlcommenter.prepend = true\n  ```\n  or via environment variable:\n\n  ```shell\n  OTEL_PHP_SQLCOMMENTER_PREPEND=true\n  ```\n  Default: `false`\n\n## Development\n\nInstall dependencies and run tests from the `SqlCommenter` subdirectory:\n\n```bash\ncomposer install\n./vendor/bin/phpunit tests\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentelemetry-php%2Fcontrib-sqlcommenter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopentelemetry-php%2Fcontrib-sqlcommenter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentelemetry-php%2Fcontrib-sqlcommenter/lists"}