Gathering detailed insights and metrics for @opentelemetry/semantic-conventions
Gathering detailed insights and metrics for @opentelemetry/semantic-conventions
Gathering detailed insights and metrics for @opentelemetry/semantic-conventions
Gathering detailed insights and metrics for @opentelemetry/semantic-conventions
@traceloop/ai-semantic-conventions
OpenTelemetry ai-specific semantic conventions
@traceloop/instrumentation-pinecone
OpenTelemetry instrumentation for pinecone vector DB
@traceai/fi-semantic-conventions
Semantic conventions for OpenTelemetry instrumentation
@traceloop/instrumentation-cohere
Cohere Instrumentation
OpenTelemetry JavaScript Client
npm install @opentelemetry/semantic-conventions
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.6
Supply Chain
100
Quality
89.2
Maintenance
100
Vulnerability
100
License
experimental/v0.202.0
Updated on Jun 02, 2025
semconv/v1.34.0
Updated on May 21, 2025
semconv/v1.33.1
Updated on May 20, 2025
experimental/v0.201.1
Updated on May 19, 2025
experimental/v0.201.0
Updated on May 15, 2025
v2.0.1
Updated on May 15, 2025
TypeScript (96.66%)
JavaScript (3.06%)
Jinja (0.19%)
Shell (0.08%)
Total Downloads
1,851,845,998
Last Day
1,538,444
Last Week
32,832,597
Last Month
140,448,214
Last Year
1,132,373,356
Apache-2.0 License
3,020 Stars
2,702 Commits
899 Forks
53 Watchers
15 Branches
337 Contributors
Updated on Jun 30, 2025
Minified
Minified + Gzipped
Latest Version
1.34.0
Package Id
@opentelemetry/semantic-conventions@1.34.0
Unpacked Size
7.33 MB
Size
1.09 MB
File Count
111
NPM Version
lerna/6.6.2/node@v18.20.8+x64 (linux)
Node Version
18.20.8
Published on
May 21, 2025
Cumulative downloads
Total Downloads
Last Day
4%
1,538,444
Compared to previous day
Last Week
-6.4%
32,832,597
Compared to previous week
Last Month
4.4%
140,448,214
Compared to previous month
Last Year
149.9%
1,132,373,356
Compared to previous year
Semantic Convention constants for use with the OpenTelemetry SDK/APIs. This document defines standard attributes for traces.
1npm install --save @opentelemetry/semantic-conventions
This package has 2 separate entry-points:
@opentelemetry/semantic-conventions
, includes only stable semantic conventions.
This entry-point follows semantic versioning 2.0: it will not include breaking changes except with a change in the major version number.@opentelemetry/semantic-conventions/incubating
, contains unstable semantic conventions (sometimes called "experimental") and, for convenience, a re-export of the stable semantic conventions.
This entry-point is NOT subject to the restrictions of semantic versioning and MAY contain breaking changes in minor releases. See below for suggested usage of this entry-point.Exported constants follow this naming scheme:
ATTR_${attributeName}
for attributesMETRIC_${metricName}
for metric names${attributeName}_VALUE_{$enumValue}
for enumerationsThe ATTR
, METRIC
, and VALUE
static strings were used to facilitate readability and filtering in auto-complete lists in IDEs.
1npm install --save @opentelemetry/semantic-conventions
1import { 2 ATTR_NETWORK_PEER_ADDRESS, 3 ATTR_NETWORK_PEER_PORT, 4 ATTR_NETWORK_PROTOCOL_NAME, 5 ATTR_NETWORK_PROTOCOL_VERSION, 6 NETWORK_TRANSPORT_VALUE_TCP, 7} from '@opentelemetry/semantic-conventions'; 8 9const span = tracer.startSpan(spanName, spanOptions) 10 .setAttributes({ 11 [ATTR_NETWORK_PEER_ADDRESS]: 'localhost', 12 [ATTR_NETWORK_PEER_PORT]: 8080, 13 [ATTR_NETWORK_PROTOCOL_NAME]: 'http', 14 [ATTR_NETWORK_PROTOCOL_VERSION]: '1.1', 15 [ATTR_NETWORK_TRANSPORT]: NETWORK_TRANSPORT_VALUE_TCP, 16 });
Because the "incubating" entry-point may include breaking changes in minor versions, it is recommended that instrumentation libraries not import @opentelemetry/semantic-conventions/incubating
in runtime code, but instead copy relevant definitions into their own code base. (This is the same recommendation as for other languages.)
For example, create a "src/semconv.ts" (or "lib/semconv.js" if implementing in JavaScript) file that copies from experimental_attributes.ts or experimental_metrics.ts:
1// src/semconv.ts 2export const ATTR_DB_NAMESPACE = 'db.namespace'; 3export const ATTR_DB_OPERATION_NAME = 'db.operation.name';
1// src/instrumentation.ts 2import { 3 ATTR_SERVER_PORT, 4 ATTR_SERVER_ADDRESS, 5} from '@opentelemetry/semantic-conventions'; 6import { 7 ATTR_DB_NAMESPACE, 8 ATTR_DB_OPERATION_NAME, 9} from './semconv'; 10 11span.setAttributes({ 12 [ATTR_DB_NAMESPACE]: ..., 13 [ATTR_DB_OPERATION_NAME]: ..., 14 [ATTR_SERVER_PORT]: ..., 15 [ATTR_SERVER_ADDRESS]: ..., 16})
Occasionally, one should review changes to @opentelemetry/semantic-conventions
to see if any used unstable conventions have changed or been stabilized. However, an update to a newer minor version of the package will never be breaking.
A considered alternative for using unstable exports is to pin the version. I.e., depend on an exact version, rather than on a version range.
1npm install --save-exact @opentelemetry/semantic-conventions # Don't do this.
Then, import directly from @opentelemetry/semantic-conventions/incubating
.
This is not recommended.
In some languages having multiple versions of a package in a single application is not possible. This is possible in JavaScript. The primary argument against pinning this package is that it can easily lead to many copies being installed in an application's node_modules/...
, which can cause significant disk usage. In a disk-constrained environment, such as AWS Lambda Layers, that can be a blocker.
There are two main types of deprecations in this package:
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
.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.SEMATTRS_*
, SEMRESATTRS_*
, ...Deprecated as of @opentelemetry/semantic-conventions@1.26.0
.
Before 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:
Deprecated usage:
1import { 2 SEMRESATTRS_SERVICE_NAME, 3 SEMATTRS_HTTP_ROUTE, 4 SEMATTRS_DB_SYSTEM, 5 DBSYSTEMVALUES_POSTGRESQL 6} from '@opentelemetry/semantic-conventions'; 7 8// 'service.name' resource attribute 9console.log(SEMRESATTRS_SERVICE_NAME); // migrate to 'ATTR_SERVICE_NAME' 10 11// 'http.route' attribute 12console.log(SEMATTRS_HTTP_ROUTE); // migrate to 'ATTR_HTTP_ROUTE' 13 14// 'db.system' attribute 15console.log(SEMATTRS_DB_SYSTEM); // migrate to 'ATTR_DB_SYSTEM' (in incubating [*]) 16 17// 'postgresql' enum value for 'db.system' attribute 18console.log(DBSYSTEMVALUES_POSTGRESQL); // migrate to 'DB_SYSTEM_VALUE_POSTGRESQL' (in incubating [*])
See Migrated usage below.
SemanticAttributes.*
, SemanticResourceAttributes.*
, ...Deprecated as of @opentelemetry/semantic-conventions@1.0.0
.
Before 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:
Deprecated usage:
1import { 2 SemanticAttributes, 3 SemanticResourceAttributes, 4 DbSystemValues, 5} from '@opentelemetry/semantic-conventions'; 6 7// 'service.name' resource attribute 8console.log(SemanticResourceAttributes.SERVICE_NAME); // migrate to 'ATTR_SERVICE_NAME' 9 10// 'http.route' attribute 11console.log(SemanticAttributes.HTTP_ROUTE); // migrate to 'ATTR_HTTP_ROUTE' 12 13// 'db.system' attribute 14console.log(SemanticAttributes.DB_SYSTEM); // migrate to 'ATTR_DB_SYSTEM' (in incubating [*]) 15 16// 'postgresql' enum value for 'db.system' attribute 17console.log(DbSystemValues.POSTGRESQL); // migrate to 'DB_SYSTEM_VALUE_POSTGRESQL' (in incubating [*])
See Migrated usage below.
If using any unstable conventions, copy the relevant definitions into your code base (e.g. to "src/semconv.ts", see above):
1// src/semconv.ts 2export const ATTR_DB_SYSTEM = 'db.system' as const; 3export const DB_SYSTEM_VALUE_POSTGRESQL = "postgresql" as const;
then:
1import { 2 ATTR_SERVICE_NAME, 3 ATTR_HTTP_ROUTE, 4 METRIC_HTTP_CLIENT_REQUEST_DURATION 5} from '@opentelemetry/semantic-conventions'; // stable semconv 6import { 7 ATTR_DB_SYSTEM, 8 DB_SYSTEM_VALUE_POSTGRESQL 9} from './semconv'; // unstable semconv 10 11console.log(ATTR_SERVICE_NAME); // 'service.name' 12console.log(ATTR_HTTP_ROUTE); // 'http.route' 13 14// Bonus: the older exports did not include metric names from semconv. 15// 'http.client.request.duration' metric name 16console.log(METRIC_HTTP_CLIENT_REQUEST_DURATION); 17 18console.log(ATTR_DB_SYSTEM); // 'db.system' 19// 'postgresql' enum value for 'db.system' attribute 20console.log(DB_SYSTEM_VALUE_POSTGRESQL);
Apache 2.0 - See LICENSE for more information.
No vulnerabilities found.
Reason
update tool detected
Details
Reason
30 commit(s) and 7 issue activity found in the last 90 days -- score normalized to 10
Reason
all changesets reviewed
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
SAST tool is run on all commits
Details
Reason
30 out of 30 merged PRs checked by a CI test -- score normalized to 10
Reason
project has 43 contributing companies or organizations
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
Project has not signed or included provenance with any releases.
Details
Reason
project is not fuzzed
Details
Reason
13 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30T07:48:53Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More