{"_id":"@aergonaut/playwright-opentelemetry-reporter","name":"@aergonaut/playwright-opentelemetry-reporter","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@aergonaut/playwright-opentelemetry-reporter","version":"0.2.0","description":"OpenTelemetry reporter for Playwright Test","main":"build/main/index.js","typings":"build/main/index.d.ts","module":"build/module/index.js","repository":{"type":"git","url":"git+https://github.com/aergonaut/playwright-opentelemetry-reporter.git"},"license":"MIT","keywords":["playwright","opentelemetry","reporter"],"scripts":{"build":"run-p build:*","build:main":"tsc -p tsconfig.json","build:module":"tsc -p tsconfig.module.json","fix":"run-s fix:*","fix:prettier":"prettier \"src/**/*.ts\" --write","fix:lint":"eslint src --ext .ts --fix","genversion":"genversion --property name,version --esm --semi src/lib/version.ts","test":"run-s build test:*","test:lint":"eslint src --ext .ts","test:prettier":"prettier \"src/**/*.ts\" --list-different","test:unit":"nyc --silent ava","playwright":"playwright test","watch:build":"tsc -p tsconfig.json -w","watch:test":"nyc --silent ava --watch","cov":"run-s build test:unit cov:html cov:lcov && open-cli coverage/index.html","cov:html":"nyc report --reporter=html","cov:lcov":"nyc report --reporter=lcov","cov:send":"run-s cov:lcov && codecov","cov:check":"nyc report && nyc check-coverage --lines 100 --functions 100 --branches 100","doc":"run-s doc:html && open-cli build/docs/index.html","doc:html":"typedoc src/ --exclude **/*.spec.ts --target ES6 --mode file --out build/docs","doc:json":"typedoc src/ --exclude **/*.spec.ts --target ES6 --mode file --json build/docs/typedoc.json","doc:publish":"gh-pages -m \"[ci skip] Updates\" -d build/docs","version":"standard-version","reset-hard":"git clean -dfx && git reset --hard && npm i","prepare-release":"run-s reset-hard test cov:check doc:html version doc:publish"},"engines":{"node":">=10"},"devDependencies":{"@ava/typescript":"^5.0.0","@istanbuljs/nyc-config-typescript":"^1.0.1","@opentelemetry/sdk-node":"^0.57.0","@playwright/test":"^1.49.1","@types/node":"^22.10.2","@typescript-eslint/eslint-plugin":"^4.0.1","@typescript-eslint/parser":"^4.0.1","ava":"^6.2.0","codecov":"^3.5.0","cspell":"^4.1.0","cz-conventional-changelog":"^3.3.0","dotenv":"^16.4.7","eslint":"^7.8.0","eslint-config-prettier":"^6.11.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.22.0","gh-pages":"^6.2.0","npm-run-all":"^4.1.5","nyc":"^15.1.0","open-cli":"^8.0.0","prettier":"^2.1.1","standard-version":"^9.0.0","ts-node":"^9.0.0","typedoc":"^0.27.6","typescript":"^5.7.2"},"peerDependencies":{"@playwright/test":">=1.36.0"},"ava":{"failFast":true,"timeout":"60s","typescript":{"rewritePaths":{"src/":"build/main/"},"compile":false},"files":["!build/module/**","!test/e2e/**"]},"config":{"commitizen":{"path":"cz-conventional-changelog"}},"prettier":{"singleQuote":true},"nyc":{"extends":"@istanbuljs/nyc-config-typescript","exclude":["**/*.spec.js"]},"dependencies":{"@opentelemetry/api":"^1.9.0"},"_id":"@aergonaut/playwright-opentelemetry-reporter@0.2.0","gitHead":"1ce2569726d6dda6a7ea7fd93317cc14068c1673","bugs":{"url":"https://github.com/aergonaut/playwright-opentelemetry-reporter/issues"},"homepage":"https://github.com/aergonaut/playwright-opentelemetry-reporter#readme","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-U1jtyMUkF/tSudD8cXZSgANIRMMacPwAXR+Tbg71DWbm93FINNWhrz0+FdJ3ZXV0G5voicNyE2NiyiZdNa1n4A==","shasum":"57429ba82c626ee60d3e1355c525d9d3a236d502","tarball":"https://registry.npmjs.org/@aergonaut/playwright-opentelemetry-reporter/-/playwright-opentelemetry-reporter-0.2.0.tgz","fileCount":24,"unpackedSize":45380,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICMQL9NrrZrhwgJUjHZxEgl3X812vHoqKu+s8281x3U2AiAhbwqmEtsWBzrsRZ9u89XxuRUdeJAF2QjlNzeTB3hqzA=="}]},"_npmUser":{"name":"aergonaut","email":"aergonaut@gmail.com"},"directories":{},"maintainers":[{"name":"aergonaut","email":"aergonaut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/playwright-opentelemetry-reporter_0.2.0_1735798942694_0.3059486301141361"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-02T06:22:22.578Z","0.2.0":"2025-01-02T06:22:22.891Z","modified":"2025-01-02T06:22:23.565Z"},"maintainers":[{"name":"aergonaut","email":"aergonaut@gmail.com"}],"description":"OpenTelemetry reporter for Playwright Test","homepage":"https://github.com/aergonaut/playwright-opentelemetry-reporter#readme","keywords":["playwright","opentelemetry","reporter"],"repository":{"type":"git","url":"git+https://github.com/aergonaut/playwright-opentelemetry-reporter.git"},"bugs":{"url":"https://github.com/aergonaut/playwright-opentelemetry-reporter/issues"},"license":"MIT","readme":"# Playwright OpenTelemetry Reporter\n\nSimple reporter that generates OpenTelemetry traces from Playwright test runs. You can then export these traces to your\nvendor of choice.\n\n![Example of trace in Honeycomb](docs/images/honeycomb-trace-example.png)\n\n## Installation\n\n### Dependencies\n\nInstall the package with your favorite package manager:\n\n```\n$ npm install @aergonaut/playwright-opentelemetry-reporter --save-dev\n```\n\nYou will also need to install the OpenTelemetry Node SDK and any other packages required by your vendor to export traces.\n\n```\n$ npm install @opentelemetry/sdk-trace-node --save-dev\n```\n\n### Initialize the SDK\n\nTo collect traces, you must initialize the OpenTelemetry SDK before Playwright begins running your tests. The easiest\nway to do this is through `globalSetup`. For example:\n\n```ts\n// global-setup.ts\nconst sdk = new NodeSDK({\n  traceExporter: new OTLPTraceExporter(),\n  metricReader: new PeriodicExportingMetricReader({\n    exporter: new ConsoleMetricExporter(),\n  }),\n});\n\nexport default async function globalSetup(_config: FullConfig) {\n  sdk.start();\n\n  return async () => {\n    await sdk.shutdown();\n  };\n}\n```\n\nN.b. ensure your `globalSetup` functions returns a function that calls `sdk.shutdown()`. This will ensure that traces\nare exported before Playwright exits.\n\n### Configure Playwright\n\nConfigure Playwright to use your `global-setup.ts` and the reporter:\n\n```ts\n// playwright.config.ts\nexport default defineConfig({\n  globalSetup: require.resolve(\"./global-setup.ts\"),\n  reporter: \"@aergonaut/playwright-opentelemetry-reporter\",\n})\n```\n\n## Usage\n\n### Generated Spans\n\nThis reporter generates spans for each test case and for each test step within each test case. Step spans are nested\naccording to Playwright's internal organization. Practically, this means that work in before and after hooks will be\ngrouped under nested spans, as will work to set up fixtures, etc.\n\n### Span Statuses\n\nThe reporter will set status on test spans and step spans according to the status of each test or step.\n\nFor step spans, if an error occurs during the step (e.g. a locator times out, or a click fails), the span's status will\nbe set to `ERROR` and the error message will be recorded on the span.\n\nFor test spans, the span will only be set to `ERROR` if the test fails _unexpectedly_. Tests which are skipped or which\npass will be `UNSET`. Similarly, expected errors (e.g. declared with `test.fail`) will also be `UNSET`.\n\n### Attaching Span Attributes\n\nYou can attach attributes to the test span by using Playwright\n[test annotations](https://playwright.dev/docs/test-annotations). Your annotation `type` must start with the prefix\n`pw_otel_reporter.` in order to be attached to the span. Anything after the prefix will be used as the attribute name,\nand the description will be used as the attribute value.\n\nTo make constructing the `type` easier, you can use the `annotationLabel` function.\n\n```ts\nimport { annotationLabel } from \"@aergonaut/playwright-opentelemetry-reporter\";\n\ntest(\"example test\", async ({ page }) => {\n  // ...\n  test.info().annotations.push({\n    type: annotationLabel(\"my_annotation\"),\n    description: \"My custom annotation!\",\n  });\n});\n```\n\n## License\n\nMIT.\n","readmeFilename":"README.md"}