{"id":16442303,"url":"https://github.com/cbandy/pg_otel","last_synced_at":"2025-10-06T01:17:44.258Z","repository":{"id":62016084,"uuid":"555092452","full_name":"cbandy/pg_otel","owner":"cbandy","description":"OpenTelemetry Exporter for PostgreSQL","archived":false,"fork":false,"pushed_at":"2023-11-04T05:30:28.000Z","size":92,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-12T09:16:54.796Z","etag":null,"topics":["logging","observability","opentelemetry","postgres","postgresql","postgresql-extension"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cbandy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-10-20T23:57:48.000Z","updated_at":"2024-07-04T00:24:22.000Z","dependencies_parsed_at":"2023-01-22T12:10:11.069Z","dependency_job_id":"b7b9a489-423c-4666-807e-c5582de20624","html_url":"https://github.com/cbandy/pg_otel","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbandy%2Fpg_otel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbandy%2Fpg_otel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbandy%2Fpg_otel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbandy%2Fpg_otel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cbandy","download_url":"https://codeload.github.com/cbandy/pg_otel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224036339,"owners_count":17245035,"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":["logging","observability","opentelemetry","postgres","postgresql","postgresql-extension"],"created_at":"2024-10-11T09:16:56.889Z","updated_at":"2025-10-06T01:17:39.227Z","avatar_url":"https://github.com/cbandy.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pg_otel\n\nA loadable module for PostgreSQL that exports server log messages\nto an OpenTelemetry [collector][].\n\n[collector]: https://docs.opentelemetry.io/concepts/data-collection/\n\n\n## Getting Started\n\nAdd `pg_otel` to your [shared_preload_libraries][] and restart PostgreSQL.\nIts default settings do nothing, so this is safe to leave in all the time.\n\n```ini\n# postgresql.conf\nshared_preload_libraries = pg_otel\n```\n\nOpenTelemetry recommends running its [collector][] as an [agent][] on the same\nmachine as the application generating telemetry data. If that is how your\nsystem is arranged, this module's default settings are for you!\n\nIf your collector is somewhere else, you need put its URL in `otel.otlp_endpoint`.\n\n```sql\nALTER SYSTEM SET otel.otlp_endpoint TO 'https://my-collector:4318';\n```\n\nWith that in place, the `otel.export` setting starts or stops the flow of logs.\nThese settings affect every connection to PostgreSQL, so the server needs to\n[reload][] to finally apply them.\n\n```sql\nALTER SYSTEM SET otel.export TO 'logs';\nSELECT pg_reload_conf();\n```\n\nYou should see logs in your collector and connected logging systems right away.\nCongratulations! 🎉\n\nIf you want to stop exporting logs, [reset][] `otel.export` to its empty default.\n\n```sql\nALTER SYSTEM RESET otel.export;\nSELECT pg_reload_conf();\n```\n\n[agent]: https://opentelemetry.io/docs/collector/deployment/\n[reload]: https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-ADMIN-SIGNAL\n[reset]: https://www.postgresql.org/docs/current/sql-altersystem.html\n[shared_preload_libraries]: https://www.postgresql.org/docs/current/runtime-config-client.html#GUC-SHARED-PRELOAD-LIBRARIES\n\n\n## Configuration\n\nThere are number of other OpenTelemetry settings that can be adjusted for your\nenvironment. Their respective [environment variables][sdk-env] also work.\n\n```\n            name            |        default        | unit |                       description\n----------------------------+-----------------------+------+-----------------------------------------------------------\n otel.export                |                       |      | Signals to export over OTLP\n otel.otlp_endpoint         | http://localhost:4318 |      | Target URL to which the exporter sends signals\n otel.otlp_timeout          | 10000                 | ms   | Maximum time the exporter will wait for each batch export\n otel.resource_attributes   |                       |      | Key-value pairs to be used as resource attributes\n otel.service_name          | postgresql            |      | Logical name of this service\n```\n\nThe following settings cannot be changed at this time:\n\n```\n            name            |         value         | unit |                       description\n----------------------------+-----------------------+------+-----------------------------------------------------------\n otel.attribute_count_limit | 128                   |      | Maximum attributes allowed on each signal\n otel.otlp_protocol         | http/protobuf         |      | The exporter transport protocol\n```\n\n[sdk-env]: https://opentelemetry.io/docs/reference/specification/sdk-environment-variables/\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbandy%2Fpg_otel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcbandy%2Fpg_otel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbandy%2Fpg_otel/lists"}