Skip to content

Updated deprecated OTel span attributes names and values - #5104

Closed
nikelborm wants to merge 1 commit into
Effect-TS:mainfrom
nikelborm:fixed_deprecated_opentelemetry_resource_attributes
Closed

nikelborm wants to merge 1 commit into
Effect-TS:mainfrom
nikelborm:fixed_deprecated_opentelemetry_resource_attributes

Conversation

@nikelborm

@nikelborm nikelborm commented Jun 26, 2025 •

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 Jun 26, 2025 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3ae318e

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 force-pushed the fixed_deprecated_opentelemetry_resource_attributes branch from 262749f to 5eba921 Compare June 26, 2025 15:59
@nikelborm nikelborm changed the title fix(otel): replaced deprecated OTel resource attribute names Updated deprecated OTel Resource attributes names and values Jun 26, 2025
@nikelborm
nikelborm force-pushed the fixed_deprecated_opentelemetry_resource_attributes branch 2 times, most recently from 7a2451f to 02e8576 Compare June 26, 2025 16:30
@nikelborm
nikelborm marked this pull request as ready for review June 26, 2025 16:40
@nikelborm
nikelborm requested a review from tim-smart as a code owner June 26, 2025 16:40
nikelborm added a commit to nikelborm/effect that referenced this pull request Jun 26, 2025
@nikelborm

nikelborm commented Jun 26, 2025 •

Copy link
Copy Markdown
Contributor Author

Since #4692 is based on a @effect/sql-pg package, the lines 195-198 should be updated there.

I updated those lines in the already merged PR evelant#2, which sets proper resource attribute names and values.

evelant added a commit to evelant/effect that referenced this pull request Jun 26, 2025
Updated deprecated OTel Resource attributes names and values to match changes from Effect-TS#5104
@nikelborm nikelborm changed the title Updated deprecated OTel Resource attributes names and values Updated deprecated OTel span attributes names and values Jun 30, 2025
@nikelborm
nikelborm force-pushed the fixed_deprecated_opentelemetry_resource_attributes branch from 02e8576 to 7aaf30f Compare July 6, 2025 01:15
@nikelborm
nikelborm requested a review from mikearnaldi as a code owner July 6, 2025 01:15
@nikelborm

nikelborm commented Jul 6, 2025 •

Copy link
Copy Markdown
Contributor Author

While looking at Effect-TS/effect-smol#223 I've noticed a few more places that should be brought to a single style of OTel attr names

I added those changes in 7aaf30f. These are not breaking changes

nikelborm added a commit to nikelborm/effect that referenced this pull request Jul 6, 2025
@nikelborm
nikelborm force-pushed the fixed_deprecated_opentelemetry_resource_attributes branch from 2ea2ff6 to 3ae318e Compare July 10, 2025 00:58
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` |                                   |
@nikelborm
nikelborm force-pushed the fixed_deprecated_opentelemetry_resource_attributes branch from 3ae318e to b35a9e9 Compare July 10, 2025 00:59
@nikelborm nikelborm closed this Jul 10, 2025
@nikelborm

Copy link
Copy Markdown
Contributor Author

Closed in favor of #5192

evelant pushed a commit to evelant/effect that referenced this pull request Dec 17, 2025
evelant pushed a commit to evelant/effect that referenced this pull request Dec 17, 2025
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.

1 participant