Skip to content

Updated deprecated OTel span attributes names and values - #5192

Merged
tim-smart merged 1 commit into
Effect-TS:mainfrom
nikelborm:fixed_deprecated_otel_attributes
Jul 15, 2025
Merged

tim-smart merged 1 commit into
Effect-TS:mainfrom
nikelborm:fixed_deprecated_otel_attributes

Conversation

@nikelborm

Copy link
Copy Markdown
Contributor

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Why?

  1. Easier to identify attributes that do not conform to conventions
  2. It's also easier to work with code of the same style everywhere
  3. Lesser chance of typos, because attribute names' and values' correctness ensured by TS
  4. Fewer magic strings/numbers. Even though, for example, "service.name" may be quite clear for some people, for others it may not be obvious why not for example, "spanSource.name", or "traceCreator.name". Plus, when it's imported, with those constants that have the same strings comes an inline JSDoc explanation of what this specific attribute means, where it comes from, and why it's called that way.
  5. Brought stuff up to date

PR Description

Many of the OpenTelemetry Span attributes have undergone the process of deprecation not once, but twice. Most of the constants holding attribute names have been renamed. These are minor changes.

Additionally, there were numerous changes to the attribute keys themselves. These changes can be considered major.

In the @opentelemetry/semantic-conventions package, new attributes having an ongoing discussion about them are going through a process called incubation, until a consensus about their necessity and form is reached. Otel team recommends devs to copy them directly into their code. Luckily, it's not necessary because all the new attribute names and values emerged from this process (some of which were subsequently changed) and are now considered stable.

Packages that need a major version bump

Or since all their versions are like 0._._, I'm not sure if I'm using the correct term, but maybe it's a minor version bump?

Package Major attribute changes Major value changes
Clickhouse client db.system -> db.system.name
db.name -> db.namespace
MsSQL client db.system -> db.system.name
db.name -> db.namespace
mssql -> microsoft.sql_server
MySQL client db.system -> db.system.name
db.name -> db.namespace
Pg client db.system -> db.system.name
db.name -> db.namespace
Bun SQLite client db.system -> db.system.name
Node SQLite client db.system -> db.system.name
React.Native SQLite client db.system -> db.system.name
Wasm SQLite client db.system -> db.system.name
SQLite Do client db.system -> db.system.name
LibSQL client db.system -> db.system.name
D1 client db.system -> db.system.name
Kysely client db.statement -> db.query.text
@effect/sql db.statement -> db.query.text
db.operation -> db.operation.name

(Expandable) Extended explanation of changes

Clickhouse client

deprecated SEMATTRS_DB_SYSTEM ("db.system")
-> incubated(unstable/experimental)+deprecated ATTR_DB_SYSTEM ("db.system")
-> stable ATTR_DB_SYSTEM_NAME ("db.system.name")

deprecated SEMATTRS_DB_NAME ("db.name")
-> incubated(unstable/experimental)+deprecated ATTR_DB_NAME ("db.name")
-> stable ATTR_DB_NAMESPACE ("db.namespace")

plain string "clickhouse"
-> stable+uniform DB_SYSTEM_NAME_VALUE_CLICKHOUSE ("clickhouse")

MsSQL client

deprecated SEMATTRS_DB_SYSTEM ("db.system")
-> incubated(unstable/experimental)+deprecated ATTR_DB_SYSTEM ("db.system")
-> stable ATTR_DB_SYSTEM_NAME ("db.system.name")

deprecated DBSYSTEMVALUES_MSSQL ("mssql")
-> incubated(unstable/experimental) DB_SYSTEM_VALUE_MSSQL ("mssql").
   It's not formally deprecated, meaning it doesn't have `@deprecated` JSDoc
   comment in `@opentelemetry/semantic-conventions` package, but effectively
   those are enum values of deprecated attribute `ATTR_DB_SYSTEM`
-> stable DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER ("microsoft.sql_server")

deprecated SEMATTRS_DB_NAME ("db.name")
-> incubated(unstable/experimental)+deprecated ATTR_DB_NAME ("db.name")
-> stable ATTR_DB_NAMESPACE ("db.namespace")

plain string "server.address"
-> stable+uniform ATTR_SERVER_ADDRESS ("server.address")

plain string "server.port"
-> stable+uniform ATTR_SERVER_PORT ("server.port")

MySQL client

deprecated SEMATTRS_DB_SYSTEM ("db.system")
-> incubated(unstable/experimental)+deprecated ATTR_DB_SYSTEM ("db.system")
-> stable ATTR_DB_SYSTEM_NAME ("db.system.name")

deprecated DBSYSTEMVALUES_MYSQL ("mysql")
-> incubated(unstable/experimental) DB_SYSTEM_VALUE_MYSQL ("mysql").
   It's not formally deprecated, meaning it doesn't have `@deprecated` JSDoc
   comment in `@opentelemetry/semantic-conventions` package, but effectively
   those are enum values of deprecated attribute `ATTR_DB_SYSTEM`
-> stable DB_SYSTEM_NAME_VALUE_MYSQL ("mysql")

deprecated SEMATTRS_DB_NAME ("db.name")
-> incubated(unstable/experimental)+deprecated ATTR_DB_NAME ("db.name")
-> stable ATTR_DB_NAMESPACE ("db.namespace")

plain string "server.address"
-> stable+uniform ATTR_SERVER_ADDRESS ("server.address")

plain string "server.port"
-> stable+uniform ATTR_SERVER_PORT ("server.port")

Pg client

deprecated SEMATTRS_DB_SYSTEM ("db.system")
-> incubated(unstable/experimental)+deprecated ATTR_DB_SYSTEM ("db.system")
-> stable ATTR_DB_SYSTEM_NAME ("db.system.name")

deprecated DBSYSTEMVALUES_POSTGRESQL ("postgresql")
-> incubated(unstable/experimental) DB_SYSTEM_VALUE_POSTGRESQL ("postgresql").
   It's not formally deprecated, meaning it doesn't have `@deprecated` JSDoc
   comment in `@opentelemetry/semantic-conventions` package, but effectively
   those are enum values of deprecated attribute `ATTR_DB_SYSTEM`
-> stable DB_SYSTEM_NAME_VALUE_POSTGRESQL ("postgresql")

deprecated SEMATTRS_DB_NAME ("db.name")
-> incubated(unstable/experimental)+deprecated ATTR_DB_NAME ("db.name")
-> stable ATTR_DB_NAMESPACE ("db.namespace")

plain string "server.address"
-> stable+uniform ATTR_SERVER_ADDRESS ("server.address")

plain string "server.port"
-> stable+uniform ATTR_SERVER_PORT ("server.port")

Bun, Node, React.Native, Wasm, Do, LibSQL, and D1 SQLite clients

deprecated SEMATTRS_DB_SYSTEM ("db.system")
-> incubated(unstable/experimental)+deprecated ATTR_DB_SYSTEM ("db.system")
-> stable ATTR_DB_SYSTEM_NAME ("db.system.name")

deprecated DBSYSTEMVALUES_SQLITE ("sqlite")
-> incubated(unstable/experimental) DB_SYSTEM_VALUE_SQLITE ("sqlite").
   It's not formally deprecated, meaning it doesn't have `@deprecated` JSDoc
   comment in `@opentelemetry/semantic-conventions` package, but effectively
   those are enum values of deprecated attribute `ATTR_DB_SYSTEM`
-> stable DB_SYSTEM_NAME_VALUE_SQLITE ("sqlite")

Kysely client

deprecated SEMATTRS_DB_STATEMENT ("db.statement")
-> incubated(unstable/experimental)+deprecated ATTR_DB_STATEMENT ("db.statement")
-> stable ATTR_DB_QUERY_TEXT ("db.query.text")

@effect/opentelemetry/Resource.ts

deprecated SEMRESATTRS_SERVICE_NAME ("service.name")
-> stable ATTR_SERVICE_NAME ("service.name")

deprecated SEMRESATTRS_TELEMETRY_SDK_NAME ("telemetry.sdk.name")
-> stable ATTR_TELEMETRY_SDK_NAME ("telemetry.sdk.name")

deprecated SEMRESATTRS_TELEMETRY_SDK_LANGUAGE ("telemetry.sdk.language")
-> stable ATTR_TELEMETRY_SDK_LANGUAGE ("telemetry.sdk.language")

deprecated TELEMETRYSDKLANGUAGEVALUES_NODEJS ("nodejs")
-> stable TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS ("nodejs")

deprecated TELEMETRYSDKLANGUAGEVALUES_WEBJS ("webjs")
-> stable TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS ("webjs")

deprecated SEMRESATTRS_SERVICE_VERSION ("service.version")
-> stable ATTR_SERVICE_VERSION ("service.version")

@effect/sql/statement.ts

SEMATTRS_DB_OPERATION ("db.operation")
-> incubated(unstable/experimental)+deprecated ATTR_DB_OPERATION ("db.operation")
-> ATTR_DB_OPERATION_NAME ("db.operation.name")

deprecated SEMATTRS_DB_STATEMENT ("db.statement")
-> incubated(unstable/experimental)+deprecated ATTR_DB_STATEMENT ("db.statement")
-> stable ATTR_DB_QUERY_TEXT ("db.query.text")

... etc I've added a few more patch changes in the following commit, but I'm tired (I wrote the above description by hand) and don't care about writing such a detailed description anymore. Every other change that's left to mention here replaces strings with the same strings imported from the @opentelemetry/semantic-conventions package.

@changeset-bot

changeset-bot Bot commented Jul 10, 2025 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 106a979

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 35 packages
Name Type
@effect/sql-sqlite-react-native Major
@effect/sql-sqlite-node Major
@effect/sql-sqlite-wasm Major
@effect/sql-clickhouse Major
@effect/sql-sqlite-bun Major
@effect/sql-kysely Major
@effect/sql-sqlite-do Major
@effect/sql-libsql Major
@effect/sql-mysql2 Major
@effect/sql-mssql Major
@effect/sql-d1 Major
@effect/sql-pg Major
@effect/sql Minor
@effect/opentelemetry Patch
@effect/platform Patch
effect Patch
@effect/cluster Major
@effect/sql-drizzle Major
@effect/platform-bun Major
@effect/platform-node-shared Major
@effect/platform-node Major
@effect/cli Patch
@effect/experimental Patch
@effect/platform-browser Patch
@effect/rpc Patch
@effect/workflow Patch
@effect/ai Patch
@effect/ai-amazon-bedrock Patch
@effect/ai-anthropic Patch
@effect/ai-google Patch
@effect/ai-openai Patch
@effect/printer-ansi Patch
@effect/printer Patch
@effect/typeclass Patch
@effect/vitest Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@nikelborm
nikelborm changed the base branch from main to next-minor July 10, 2025 01:02
@nikelborm

Copy link
Copy Markdown
Contributor Author

This is reopened version of #5104 with new merge base

Comment thread packages/effect/package.json Resolved
@effect-bot
effect-bot force-pushed the next-minor branch 19 times, most recently from f2e1188 to 2e6f72b Compare July 14, 2025 10:39
@nikelborm
nikelborm force-pushed the fixed_deprecated_otel_attributes branch 2 times, most recently from 5d5d968 to 56b2b69 Compare July 14, 2025 15:19
@nikelborm
nikelborm force-pushed the fixed_deprecated_otel_attributes branch 4 times, most recently from f3a5bbd to e5c6755 Compare July 15, 2025 07:02
@tim-smart
tim-smart changed the base branch from next-minor to main July 15, 2025 21:44
Many of the attributes have undergone the process of deprecation not once, but twice. Most of the constants holding attribute names have been renamed. These are minor changes.

Additionally, there were numerous changes to the attribute keys themselves. These changes can be considered major.

In the `@opentelemetry/semantic-conventions` package, new attributes having ongoing discussion about them are going through a process called incubation, until a consensus about their necessity and form is reached. Otel team [recommends](https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv) devs to copy them directly into their code. Luckily, it's not necessary because all of the new attribute names and values came out of this process (some of them were changed again) and are now considered stable.

| Package                    | Major attribute changes                                                       | Major value changes               |
| -------------------------- | ----------------------------------------------------------------------------- | --------------------------------- |
| Clickhouse client          | `db.system` -> `db.system.name` <br/> `db.name` -> `db.namespace`             |                                   |
| MsSQL client               | `db.system` -> `db.system.name` <br/> `db.name` -> `db.namespace`             | `mssql` -> `microsoft.sql_server` |
| MySQL client               | `db.system` -> `db.system.name` <br/> `db.name` -> `db.namespace`             |                                   |
| Pg client                  | `db.system` -> `db.system.name` <br/> `db.name` -> `db.namespace`             |                                   |
| Bun SQLite client          | `db.system` -> `db.system.name`                                               |                                   |
| Node SQLite client         | `db.system` -> `db.system.name`                                               |                                   |
| React.Native SQLite client | `db.system` -> `db.system.name`                                               |                                   |
| Wasm SQLite client         | `db.system` -> `db.system.name`                                               |                                   |
| SQLite Do client           | `db.system` -> `db.system.name`                                               |                                   |
| LibSQL client              | `db.system` -> `db.system.name`                                               |                                   |
| D1 client                  | `db.system` -> `db.system.name`                                               |                                   |
| Kysely client              | `db.statement` -> `db.query.text`                                             |                                   |
| @effect/sql                | `db.statement` -> `db.query.text` <br/> `db.operation` -> `db.operation.name` |                                   |
@tim-smart
tim-smart force-pushed the fixed_deprecated_otel_attributes branch from 549ffcd to 106a979 Compare July 15, 2025 21:45
@tim-smart
tim-smart merged commit 17a5ea8 into Effect-TS:main Jul 15, 2025
tim-smart added a commit that referenced this pull request Jul 16, 2025
some otel variables went missing since #5192
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants