{"id":22679818,"url":"https://github.com/contember/nginx-open-telemetry-module","last_synced_at":"2025-04-19T23:49:24.873Z","repository":{"id":213314553,"uuid":"733421006","full_name":"contember/nginx-open-telemetry-module","owner":"contember","description":"Nginx otel module for Alpine-based machines","archived":false,"fork":false,"pushed_at":"2024-12-10T14:43:15.000Z","size":24,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-19T23:49:19.861Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","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/contember.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}},"created_at":"2023-12-19T09:41:43.000Z","updated_at":"2024-12-10T14:43:18.000Z","dependencies_parsed_at":"2024-12-09T19:11:08.097Z","dependency_job_id":"c6d8091f-faab-4273-952f-93b01abd5944","html_url":"https://github.com/contember/nginx-open-telemetry-module","commit_stats":null,"previous_names":["contember/nginx-open-telemetry-module"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contember%2Fnginx-open-telemetry-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contember%2Fnginx-open-telemetry-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contember%2Fnginx-open-telemetry-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contember%2Fnginx-open-telemetry-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/contember","download_url":"https://codeload.github.com/contember/nginx-open-telemetry-module/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249830846,"owners_count":21331357,"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":[],"created_at":"2024-12-09T19:10:56.060Z","updated_at":"2025-04-19T23:49:24.857Z","avatar_url":"https://github.com/contember.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nginx OpenTelemetry (OTEL) module\n\nThe Nginx OTEL module package, designed for Debian/Ubuntu-based systems, \nis exclusively available to Nginx Plus users through official distribution and maintenance by Nginx. \nWhile Nginx provides all the open-source code, they recommend users compile and distribute the module independently.\n\nThis particular module is derived from the Open Telemetry Nginx addon \n(found at [https://github.com/open-telemetry/opentelemetry-cpp-contrib/tree/main/instrumentation/nginx](https://github.com/open-telemetry/opentelemetry-cpp-contrib/tree/main/instrumentation/nginx)), \nnot the Nginx-based source ([https://github.com/nginxinc/nginx-otel](https://github.com/nginxinc/nginx-otel)). \nBoth utilize `opentelemetry-cpp`, resulting in nearly identical functionality. \nHowever, the Open Telemetry addon is configured externally rather than directly within Nginx using the `nginx.conf` file.\n\nNotably, comprehensive tutorials for compiling this module for Alpine-based systems or ARM CPUs are scarce. \nTherefore, this repository provides examples for building and configuring the Nginx OTEL module for Alpine.\n\n\u003e **Warning**\n\u003e It's crucial to compile the module using the same Nginx source code version as the one in operation.\n\nThe compilation process yields a module file, `otel_ngx_module.so`, located in the `/usr/lib/nginx/modules/` directory. \nWhile this file can be simply archived for distribution, a repeatable process is advised. \nThis means establishing a build pipeline, especially when the Nginx version used for the build becomes outdated.\n\n### Building module\n\n```bash\ndocker build \\\n    -f Dockerfile \\\n    --build-arg=IMAGE=nginx:1.25.3-alpine .\n```\n\n### Usage of module\n\n```dockerfile\n# Version must be same for source image and for version that was used for build module\nFROM nginx:1.25.3-alpine\n\nRUN apk add --no-cache tar libstdc++\n\n# Change Nginx version and/or architecture (amd64 / arm64)\nADD https://github.com/contember/nginx-open-telemetry-module/releases/download/v1.0.0/otel_ngx_module_1.25.3-alpine_amd64.tgz /opt\n\n# Unzip asset and put it into rigt place\nRUN cd /opt ; tar xf otel_ngx_module_1.25.3-alpine_amd64.tgz\nRUN cp /opt/otel_ngx_module.so /usr/lib/nginx/modules/otel_ngx_module.so\n\n# (Optional) put custom configuration files\nCOPY opentelemetry.toml /etc/nginx/opentelemetry.toml\nCOPY nginx.conf /etc/nginx/nginx.conf\n```\n\n### Usage in examples\n\n```nginx configuration\n# Location for module copied from build pipeline\nload_module /etc/nginx/modules/otel_ngx_module.so;\n\nuser  nginx;\nworker_processes  auto;\n\nerror_log  /var/log/nginx/error.log notice;\npid        /var/run/nginx.pid;\n\nevents {\n    worker_connections  1024;\n}\n\nhttp {\n    include       /etc/nginx/mime.types;\n    default_type  application/octet-stream;\n\n    # Configuration for OpenTelemetry module\n    opentelemetry_config /etc/nginx/opentelemetry.toml;\n    access_log /var/log/nginx/access.log  main;\n\n    keepalive_timeout  65;\n\n    server {\n        listen 127.0.0.1:80;\n\n        location / {\n            opentelemetry on;\n            opentelemetry_propagate;\n\n            add_header Content-Type text/plain;\n            return 200 \"Hello World!\";\n        }\n    }\n\n    include /etc/nginx/conf.d/*.conf;\n}\n```\n\n#### Example of configuration\nMore details about possibility of configuration files can be [found here](https://github.com/open-telemetry/opentelemetry-cpp-contrib/tree/2a0db982f3d7ee91dfbe8150435e49e837bfb7ce/instrumentation/nginx#usage).\nOr in example of file [permalink to example](https://github.com/open-telemetry/opentelemetry-cpp-contrib/blob/2a0db982f3d7ee91dfbe8150435e49e837bfb7ce/instrumentation/nginx/test/conf/otel-nginx.toml).\n\n```tomp\nexporter = \"otlp\"\nprocessor = \"batch\"\n\n[exporters.otlp]\nhost = \"localhost\"\nport = 4317\n\n[processors.batch]\nmax_queue_size = 2048\nschedule_delay_millis = 5000\nmax_export_batch_size = 512\n\n[service]\nname = \"nginx-ingress\" # Opentelemetry resource name\n\n[sampler]\nname = \"AlwaysOn\" # Also: AlwaysOff, TraceIdRatioBased\nratio = 0.1\nparent_based = false\n```\n\n### Related sources\n- [Open Telemetry C++ sdk](https://github.com/open-telemetry/opentelemetry-cpp)\n- [Open Telemetry Nginx module](https://github.com/open-telemetry/opentelemetry-cpp-contrib)\n- [Nginx Open Telemetry module](https://github.com/nginxinc/nginx-otel)\n- [Inspiration for this repository](https://github.com/tangx/Nginx-With-OpenTelemetry)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontember%2Fnginx-open-telemetry-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontember%2Fnginx-open-telemetry-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontember%2Fnginx-open-telemetry-module/lists"}