{"id":26904400,"url":"https://github.com/billmeyer/otel-tailsampling","last_synced_at":"2025-04-01T10:53:34.319Z","repository":{"id":279259975,"uuid":"936906720","full_name":"billmeyer/otel-tailsampling","owner":"billmeyer","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-24T16:17:52.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T17:30:03.955Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/billmeyer.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":"2025-02-21T22:43:24.000Z","updated_at":"2025-02-24T16:17:56.000Z","dependencies_parsed_at":"2025-02-24T17:30:10.564Z","dependency_job_id":"b7a01778-e6d4-4bc9-906f-86cfc0999ed8","html_url":"https://github.com/billmeyer/otel-tailsampling","commit_stats":null,"previous_names":["billmeyer/otel-tailsampling"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billmeyer%2Fotel-tailsampling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billmeyer%2Fotel-tailsampling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billmeyer%2Fotel-tailsampling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billmeyer%2Fotel-tailsampling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/billmeyer","download_url":"https://codeload.github.com/billmeyer/otel-tailsampling/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246628337,"owners_count":20808106,"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":"2025-04-01T10:53:33.308Z","updated_at":"2025-04-01T10:53:34.313Z","avatar_url":"https://github.com/billmeyer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Testing Tail Sampling with OTel and Python\n\n## One Time Setup\n\n1. Create a Python virtualenv:\n\n    ```bash\n    python3 -m venv venv\n    ```\n\n2. Source the new env:\n\n    ```bash\n    source venv/bin/activate\n    ```\n\n3. Install dependencies:\n\n    ```bash\n    pip3 install -r requirements.txt\n    ```\n   \n4. Download a OTel Collector\n\nDownload a [Contrib release](https://github.com/open-telemetry/opentelemetry-collector-releases/releases/tag/v0.120.0) of the OTel Collector and extract in the local directory.\n\n## Execution\n\n1. Start the Collector with the supplied config:\n\n   ```bash\n   ./otelcol-contrib --config config.yaml\n   ```\n\n2. In another terminal, run the python script to generate trace(s):\n\n   ```bash\n   source venv/bin/activate\n   python3 send-traces.py\n   ```\n    \n## Description\n\nThe python script send two traces-- one from a service named `checkout-worker` and the other named `frontend-worker`, both of which have an attribute named `env` with a value of `prod-eus2`.\n\nThe expectation is the following:\n\n* the traces do not match Policy #1 (`env-based-sampling-policy`) because `env` does not match any of the listed values,\n* the trace with `service.name` == `frontend-worker` **should** match Policy #2 and the trace should always be sampled resulting in it being sent to an exporter.\n* the trace with `service.name` == `checkout-worker` **should** match Policy #3 and the trace should always be sampled resulting in it being sent to an exporter.\n\n## Result\n\nOnly the trace for the `frontend-worker` (Policy #2) get sent to the exporter. \n\n## Test cases\n\nComment out Policy #2 in the collector config, restart and send the trace. The `checkout-worker` trace now gets sampled properly and sent to an exporter.\n\n## Suspicion\n\nIt would seem as if a key/value check in *any* policy uses an `invert_match` condition, the key/value pair can't be used in other policies. Note: changing the policy order in the collector config make no difference.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbillmeyer%2Fotel-tailsampling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbillmeyer%2Fotel-tailsampling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbillmeyer%2Fotel-tailsampling/lists"}