{"name":"@opentelemetry/semantic-conventions","version":"1.28.0","description":"OpenTelemetry semantic conventions","main":"build/src/index.js","module":"build/esm/index.js","esnext":"build/esnext/index.js","types":"build/src/index.d.ts","exports":{".":{"module":"./build/esm/index.js","esnext":"./build/esnext/index.js","types":"./build/src/index.d.ts","default":"./build/src/index.js"},"./incubating":{"module":"./build/esm/index-incubating.js","esnext":"./build/esnext/index-incubating.js","types":"./build/src/index-incubating.d.ts","default":"./build/src/index-incubating.js"}},"typesVersions":{"*":{"*":["./build/src/index.d.ts"],"incubating":["./build/src/index-incubating.d.ts"]}},"repository":{"type":"git","url":"git+https://github.com/open-telemetry/opentelemetry-js.git"},"scripts":{"prepublishOnly":"npm run compile","compile":"tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json","clean":"tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json","version":"node ../scripts/version-update.js","watch":"tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json","precompile":"cross-var lerna run version --scope $npm_package_name --include-dependencies","prewatch":"npm run precompile","peer-api-check":"node ../scripts/peer-api-check.js","size-check":"npm run compile && mocha 'test/**/*.test.ts'","align-api-deps":"node ../scripts/align-api-deps.js"},"keywords":["opentelemetry","nodejs","tracing","attributes","semantic conventions"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","engines":{"node":">=14"},"publishConfig":{"access":"public"},"devDependencies":{"@size-limit/file":"^11.0.1","@size-limit/time":"^11.0.1","@size-limit/webpack":"^11.0.1","@types/mocha":"10.0.9","@types/node":"18.6.5","@types/sinon":"17.0.3","cross-var":"1.1.0","lerna":"6.6.2","mocha":"10.8.2","nock":"13.3.8","nyc":"15.1.0","sinon":"15.1.2","size-limit":"^11.0.1","ts-node":"10.9.2","typescript":"4.4.4"},"homepage":"https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions","sideEffects":false,"gitHead":"e97cc2ee8efa176232dc701462a49e9a10e95dfc","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js/issues"},"_id":"@opentelemetry/semantic-conventions@1.28.0","_nodeVersion":"18.20.5","_npmVersion":"lerna/6.6.2/node@v18.20.5+x64 (linux)","dist":{"integrity":"sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA==","shasum":"337fb2bca0453d0726696e745f50064411f646d6","tarball":"http://registry-npm.ywwl.com/@opentelemetry/semantic-conventions/download/@opentelemetry/semantic-conventions-1.28.0.tgz","fileCount":111,"unpackedSize":6246365,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@opentelemetry%2fsemantic-conventions@1.28.0","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA8jxmaYauCpXpU5mel5RJP/TR4BNfPphH+bC/2KFZNWAiEAitPsnl8AbB2slyCmrlIXOaJnQc10WXSL5UYC90pH580="}],"size":929174,"noattachment":false,"key":"/@opentelemetry/semantic-conventions/-/@opentelemetry/semantic-conventions-1.28.0.tgz"},"_npmUser":{"name":"dyladan","email":"dyladan@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/semantic-conventions_1.28.0_1732134681522_0.3475593388130753"},"_hasShrinkwrap":false,"readme":"# OpenTelemetry Semantic Conventions\n\n[![NPM Published Version][npm-img]][npm-url]\n[![Apache License][license-image]][license-image]\n\nSemantic Convention constants for use with the OpenTelemetry SDK/APIs. [This document][trace-semantic_conventions] defines standard attributes for traces.\n\n## Installation\n\n```bash\nnpm install --save @opentelemetry/semantic-conventions\n```\n\n## Import Structure\n\nThis package has 2 separate entry-points:\n\n- The main entry-point, `@opentelemetry/semantic-conventions`, includes only stable semantic conventions.\n  This entry-point follows semantic versioning 2.0: it will not include breaking changes except with a change in the major version number.\n- The \"incubating\" entry-point, `@opentelemetry/semantic-conventions/incubating`, contains unstable semantic conventions (sometimes called \"experimental\") and, for convenience, a re-export of the stable semantic conventions.\n  This entry-point is _NOT_ subject to the restrictions of semantic versioning and _MAY_ contain breaking changes in minor releases.\n\nExported constants follow this naming scheme:\n\n- `ATTR_${attributeName}` for attributes\n- `METRIC_${metricName}` for metric names\n- `${attributeName}_VALUE_{$enumValue}` for enumerations\n\nThe `ATTR`, `METRIC`, and `VALUE` static strings were used to facilitate readability and filtering in auto-complete lists in IDEs.\n\n## Usage\n\n### Stable SemConv\n\n```bash\nnpm install --save @opentelemetry/semantic-conventions\n```\n\n```ts\nimport {\n  ATTR_NETWORK_PEER_ADDRESS,\n  ATTR_NETWORK_PEER_PORT,\n  ATTR_NETWORK_PROTOCOL_NAME,\n  ATTR_NETWORK_PROTOCOL_VERSION,\n  NETWORK_TRANSPORT_VALUE_TCP,\n} from '@opentelemetry/semantic-conventions';\n\nconst span = tracer.startSpan(spanName, spanOptions)\n  .setAttributes({\n    [ATTR_NETWORK_PEER_ADDRESS]: 'localhost',\n    [ATTR_NETWORK_PEER_PORT]: 8080,\n    [ATTR_NETWORK_PROTOCOL_NAME]: 'http',\n    [ATTR_NETWORK_PROTOCOL_VERSION]: '1.1',\n    [ATTR_NETWORK_TRANSPORT]: NETWORK_TRANSPORT_VALUE_TCP,\n  });\n```\n\n### Unstable SemConv\n\n<!-- Dev Note: ^^ This '#unstable-semconv' anchor is being used in jsdoc links in the code. -->\n\n```bash\nnpm install --save-exact @opentelemetry/semantic-conventions\n```\n\n**Note**: Because the \"incubating\" entry-point may include breaking changes in minor versions, it is recommended that users of unstable semconv values either:\n\n1. depend on a pinned (exact) version of the package (`npm install --save-exact ...`), or\n2. [copy relevant definitions to their code base](https://opentelemetry.io/docs/specs/semconv/non-normative/code-generation/#stability-and-versioning).\n\n```ts\nimport {\n  ATTR_PROCESS_COMMAND,\n  ATTR_PROCESS_COMMAND_ARGS,\n  ATTR_PROCESS_COMMAND_LINE,\n} from '@opentelemetry/semantic-conventions/incubating';\n\nconst span = tracer.startSpan(spanName, spanOptions)\n  .setAttributes({\n    [ATTR_PROCESS_COMMAND]: 'cat',\n    [ATTR_PROCESS_COMMAND_ARGS]: ['file1', 'file2'],\n    [ATTR_CONTAINER_COMMAND_LINE]: 'cat file1 file2',\n  });\n```\n\n## Deprecations\n\nThere are two main types of deprecations in this package:\n\n1. \"semconv deprecations\": The process of defining the OpenTelemetry [Semantic Conventions][semconv-docs] sometimes involves deprecating a particular field name as conventions are [stabilized][semconv-stability]. For example, the [stabilization of HTTP conventions][semconv-http-stabilization] included deprecating the `http.url` span attribute in favor of `url.full`. When using this JS package, that appears as a deprecation of the `ATTR_HTTP_URL` export in favour of `ATTR_URL_FULL`.\n2. \"JS package deprecations\": Independently, this JavaScript package has twice changed how it exports the Semantic Conventions constants, e.g. `ATTR_HTTP_URL` instead of `SEMATTRS_HTTP_URL`. The two older forms are still included in 1.x versions of this package for backwards compatibility. The rest of this section shows how to migrate to the latest form.\n\n### Migrating from `SEMATTRS_*`, `SEMRESATTRS_*`, ...\n\nDeprecated as of `@opentelemetry/semantic-conventions@1.26.0`.\n\nBefore v1.26.0, constants for each semconv attribute were exported, prefixed with `SEMRESATTRS_` (if defined as a Resource Attribute) or `SEMATTRS_`. As well, constants were exported for each value in an enumeration, of the form `${attributeName}VALUES_${enumValue}`. For example:\n\n**Deprecated usage:**\n\n```js\nimport {\n  SEMRESATTRS_SERVICE_NAME,\n  SEMATTRS_HTTP_ROUTE,\n  SEMATTRS_DB_SYSTEM,\n  DBSYSTEMVALUES_POSTGRESQL\n} from '@opentelemetry/semantic-conventions';\n\n// 'service.name' resource attribute\nconsole.log(SEMRESATTRS_SERVICE_NAME); // migrate to 'ATTR_SERVICE_NAME'\n\n// 'http.route' attribute\nconsole.log(SEMATTRS_HTTP_ROUTE); // migrate to 'ATTR_HTTP_ROUTE'\n\n// 'db.system' attribute\nconsole.log(SEMATTRS_DB_SYSTEM); // migrate to 'ATTR_DB_SYSTEM' (in incubating [*])\n\n// 'postgresql' enum value for 'db.system' attribute\nconsole.log(DBSYSTEMVALUES_POSTGRESQL); // migrate to 'DB_SYSTEM_VALUE_POSTGRESQL' (in incubating [*])\n```\n\nSee [Migrated usage](#migrated-usage) below.\n\n### Migrating from `SemanticAttributes.*`, `SemanticResourceAttributes.*`, ...\n\nDeprecated as of `@opentelemetry/semantic-conventions@1.0.0`.\n\nBefore v1.0.0, constants were exported in namespace objects `SemanticResourceAttributes` and `SemanticAttributes`, and a namespace object for enumerated values for some fields (e.g. `DbSystemValues` for values of the 'db.system' enum). For example:\n\n**Deprecated usage:**\n\n```js\nimport {\n  SemanticAttributes,\n  SemanticResourceAttributes,\n  DbSystemValues,\n} from '@opentelemetry/semantic-conventions';\n\n// 'service.name' resource attribute\nconsole.log(SemanticResourceAttributes.SERVICE_NAME); // migrate to 'ATTR_SERVICE_NAME'\n\n// 'http.route' attribute\nconsole.log(SemanticAttributes.HTTP_ROUTE); // migrate to 'ATTR_HTTP_ROUTE'\n\n// 'db.system' attribute\nconsole.log(SemanticAttributes.DB_SYSTEM); // migrate to 'ATTR_DB_SYSTEM' (in incubating [*])\n\n// 'postgresql' enum value for 'db.system' attribute\nconsole.log(DbSystemValues.POSTGRESQL); // migrate to 'DB_SYSTEM_VALUE_POSTGRESQL' (in incubating [*])\n```\n\nSee [Migrated usage](#migrated-usage) below.\n\n### Migrated usage\n\n```js\nimport {\n  ATTR_SERVICE_NAME,\n  ATTR_HTTP_ROUTE,\n  METRIC_HTTP_CLIENT_REQUEST_DURATION\n} from '@opentelemetry/semantic-conventions';\nimport {\n  ATTR_DB_SYSTEM,\n  DB_SYSTEM_VALUE_POSTGRESQL\n} from '@opentelemetry/semantic-conventions/incubating';\n\nconsole.log(ATTR_SERVICE_NAME); // 'service.name'\nconsole.log(ATTR_HTTP_ROUTE);   // 'http.route'\n\n// Bonus: the older exports did not include metric names from semconv.\n// 'http.client.request.duration' metric name\nconsole.log(METRIC_HTTP_CLIENT_REQUEST_DURATION);\n\nconsole.log(ATTR_DB_SYSTEM);    // 'db.system'\n// 'postgresql' enum value for 'db.system' attribute\nconsole.log(DB_SYSTEM_VALUE_POSTGRESQL);\n```\n\n### What is \"incubating\"?\n\nThe first three fields in the preceding code sample ('service.name', 'http.route', 'http.client.request.duration') are _stable_ in semantic conventions, the latter two are not. Version 1.26.0 of this package separated stable and unstable into separate module entry points: stable conventions are imported `from '@opentelemetry/semantic-conventions'` and unstable `from '@opentelemetry/semantic-conventions/incubating'`. The name \"incubating\" is [suggested by the Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/non-normative/code-generation/#semantic-conventions-artifact-structure).\n\nIt is recommended that if you are using exports from _incubating_, that you **pin the version** in your package.json dependencies (e.g. via `npm install --save-exact @opentelemetry/semantic-conventions`) _or_ that you copy the relevant definitions into your code base. This is because the removal of exports from the _incubating_ entry point is _not considered a breaking change_ and hence can happen in a minor version.\n\nNote: The _incubating_ entry point also exports all stable fields, so the above example could be changed to import all five constants `from '@opentelemetry/semantic-conventions/incubating'`.\n\n## Useful links\n\n- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>\n- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>\n- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]\n\n## License\n\nApache 2.0 - See [LICENSE][license-url] for more information.\n\n[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions\n[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE\n[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat\n[npm-url]: https://www.npmjs.com/package/@opentelemetry/semantic-conventions\n[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fsemantic-conventions.svg\n[semconv-docs]: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/README.md\n[semconv-stability]: https://opentelemetry.io/docs/specs/otel/versioning-and-stability/#semantic-conventions-stability\n[semconv-http-stabilization]: https://opentelemetry.io/blog/2023/http-conventions-declared-stable/\n[trace-semantic_conventions]: https://github.com/open-telemetry/semantic-conventions/tree/main/specification/trace/semantic_conventions\n","publish_time":1732134681818,"maintainers":[{"name":"pichlermarc","email":"marc.pichler@dynatrace.com"},{"name":"bogdandrutu","email":"bogdandrutu@gmail.com"},{"name":"dyladan","email":"dyladan@gmail.com"}],"_cnpm_publish_time":1732134681818,"dist-tags":{"canary":"0.25.1-alpha.13","latest":"1.45.0","next":"1.8.0"}}