{"id":37192622,"url":"https://github.com/mdsol/xk6-output-otlp","last_synced_at":"2026-01-14T22:21:08.618Z","repository":{"id":246890590,"uuid":"807690361","full_name":"mdsol/xk6-output-otlp","owner":"mdsol","description":"K6 output extension for motel-collector","archived":false,"fork":false,"pushed_at":"2025-01-28T19:28:19.000Z","size":96,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":86,"default_branch":"main","last_synced_at":"2025-01-28T20:29:18.405Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/mdsol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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":"2024-05-29T15:30:54.000Z","updated_at":"2024-07-17T00:29:19.000Z","dependencies_parsed_at":"2024-07-17T03:54:28.362Z","dependency_job_id":null,"html_url":"https://github.com/mdsol/xk6-output-otlp","commit_stats":null,"previous_names":["mdsol/xk6-output-otlp"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mdsol/xk6-output-otlp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsol%2Fxk6-output-otlp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsol%2Fxk6-output-otlp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsol%2Fxk6-output-otlp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsol%2Fxk6-output-otlp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdsol","download_url":"https://codeload.github.com/mdsol/xk6-output-otlp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsol%2Fxk6-output-otlp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28436283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T21:32:52.117Z","status":"ssl_error","status_checked_at":"2026-01-14T21:32:33.442Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-01-14T22:21:07.847Z","updated_at":"2026-01-14T22:21:08.609Z","avatar_url":"https://github.com/mdsol.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# K6 OTLP Output Extension\n\nThis repository is for [K6 output extension](https://k6.io/docs/extensions/). The extension exports metrics of K6 tests using OTLP/HTTP protocol.\n\n## Usage\n\nThe released binary is expected to run in containers or linux-like hosts of `amd64` architecture.\nFor Windows 10+ environments you can run it in  WSL2.\nFor other environments, please build your version from sources.\n\n### Build K6 binary\n\nYou should have `Go 1.22+` and `make` installed.\n\n- clone the [repository](https://github.com/mdsol/xk6-output-otlp) using git;\n- run `make build`;\n- the `k6` binary is in the project's `./bin` subfolder.\n\n### Configuration\n\nConfiguration parameters can be set in a JSON configuration file or using environment variables:\n\nExample of configuration file:\n\n```json\n{\n  \"collectors\": {\n    \"otlp\": {\n      \"metrics_url\": \"http://localhost:8080/v1/metrics\",\n      \"headers\": {\n        \"job\": \"tests\"\n      },\n      \"push_interval\": \"1m\",\n      \"timeout\": \"3s\",\n      \"gzip\": true,\n      \"insecure\": true,\n      \"add_id_attributes\": true\n    }\n  }\n}\n```\n\nEnvironment variables:\n\n| Environment Variable       | Default Value | Description |\n|----------------------------|---------------|-------------|\n| `K6_OTLP_ADD_ID_ATTRS`     | `false`       | If `true`, attributes `provider_id` and `run_id` added to metrics. |\n| `K6_OTLP_GZIP`             | `false`       | `true` or `false`. Use GZIP encoding or not.  |\n| `K6_OTLP_HTTP_HEADERS`     | empty         | Optional HTTP headers |\n| `K6_OTLP_INSECURE`         | `true`        | `true` or `false`. Validate SSL certificate or not. |\n| `K6_OTLP_PUSH_INTERVAL`    | `5s`          | Metric push interval in Go duration format for intermediate metrics. At the end on the test metrics exported regardless of this value. |\n| `K6_OTLP_TIMEOUT`          | `5s`          | HTTP request timeout  in Go duration format |\n| `K6_OTLP_SERVER_URL`       | `http://localhost:8080/v1/metrics`| OTLP metrics endpoint url. Usually ends with `/v1/metrics` |\n\n### Run K6 tests like\n\n  ```sh\n  ./k6 run --out otlp --config \u003cconfig-file\u003e \u003ctest-file\u003e\n  ```\n\n## K6 Metrics Conversion\n\nThe Grafana K6 testing utility uses a metric model that requires some metrics conversion before sending to Opentelemetry Collector or other OTLP receiver.\n\n### Rate\n\nEach metric of type \"rate\" is converted to three OTLP metrics.\n\nIf `\u003cname\u003e` is a name of the original rate metric, it produces:\n\n- `k6_\u003cname\u003e_total` OTLP counter which contains the total number of occurrences;\n- `k6_\u003cname\u003e_success_total` OTLP counter which contains the total number of successful occurrences;\n- `k6_\u003cname\u003e_success_rate` OTLP Gauge, which contains the pre-computed rate over the whole metric family. \n\nThe latest pre-computed rate value should match appropriate K6 output.\n\n### Trend\n\nEach metric of type \"trend\" is converted to one OTLP histogram and\na gauge which label `stat` will define pre-computed statistics.\n\n_Example: original K6 trend metric: `http_req_duration` typically produces `k6_http_req_duration_stat{stat=\"avg|min|max|p50|p90|p95\"}` metric family._\n\nThe latest pre-computed stat values should match appropriate K6 output.\n\n### Attributes\n\nSometimes it's required to distinguish metrics received from different test runs. For this scenario we have\na configuration option that adds the following attributes/labels to the metrics:\n\n| Attribute     | Meaning |\n|---------------|---------|\n| `provider_id` | Initially, a random generated string. Expected to be the same for the same running location (host, user) |\n| `run_id`      | A cyclic counter 0..255 indicates the test run. We should limit the range for avoiding high-cardinality. |\n\nTo insert attributes, set environment variable `K6_OTLP_ADD_ID_ATTRS=true`\nor set `add_id_attributes: true` in the config file.\n\n#### Using of meaningful provider_id\n\nYou can update your local file `~/.xk6-output-otlp/provider_id` by changing the randomly generated id to\nsomething meaningful (your hostname or username, etc.).\nThe new id should be unique and match pattern `^[0-9a-zA-Z_]{3,16}$`.\n\n## Contributing\n\nSee [CONTRIBUTING](./CONTRIBUTING.md)\n\n## Contact\n\nSee the [factbook](factbook.yaml).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsol%2Fxk6-output-otlp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdsol%2Fxk6-output-otlp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsol%2Fxk6-output-otlp/lists"}