Skip to content

Conversation

IMax153
Copy link
Member

@IMax153 IMax153 commented Aug 18, 2025

Type

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

Description

The OpenTelemetry packages have issues with ESM builds. This PR removes the @opentelemetry/semantic-conventions dependency from all packages except the @effect/opentelemetry integration package in favor of statically declared attribute names / values.

Related

  • Related Issue #
  • Closes #

@IMax153 IMax153 requested a review from mikearnaldi August 18, 2025 13:37
@IMax153 IMax153 requested a review from tim-smart as a code owner August 18, 2025 13:37
@github-project-automation github-project-automation bot moved this to Discussion Ongoing in PR Backlog Aug 18, 2025
Copy link

changeset-bot bot commented Aug 18, 2025

🦋 Changeset detected

Latest commit: 0132356

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

This PR includes changesets to release 30 packages
Name Type
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-wasm Patch
@effect/sql-clickhouse Patch
@effect/sql-sqlite-bun Patch
@effect/opentelemetry Patch
@effect/sql-sqlite-do Patch
@effect/sql-kysely Patch
@effect/sql-libsql Patch
@effect/sql-mysql2 Patch
@effect/sql-mssql Patch
@effect/platform Patch
@effect/sql-d1 Patch
@effect/sql-pg Patch
@effect/sql Patch
@effect/cluster Patch
@effect/sql-drizzle Patch
@effect/cli Patch
@effect/experimental Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node 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

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

@IMax153 IMax153 changed the title remove dependency on @opentelemetry/semantic-conventions Remove dependency on @opentelemetry/semantic-conventions Aug 18, 2025
Comment on lines +30 to +39
const ATTR_HTTP_REQUEST_HEADER = (key: string): string => `http.request.header.${key}`
const ATTR_HTTP_REQUEST_METHOD = "http.request.method"
const ATTR_HTTP_RESPONSE_HEADER = (key: string): string => `http.response.header.${key}`
const ATTR_HTTP_RESPONSE_STATUS_CODE = "http.response.status_code"
const ATTR_SERVER_ADDRESS = "server.address"
const ATTR_SERVER_PORT = "server.port"
const ATTR_URL_FULL = "url.full"
const ATTR_URL_PATH = "url.path"
const ATTR_URL_SCHEME = "url.scheme"
const ATTR_URL_QUERY = "url.query"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: I'm wondering if it would be appropriate to include an inline comments above each of those const declaration groups that links to the relevant documentation online where someone could find out what all semantic keys are derived from.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are debating how to best handle semantic OTEL attributes. For now, this will unblock the bugs we are facing with ESM builds but are looking at a larger strategy. Once we have one in place we will document accordingly. I avoided doing it here to prevent drift.

Copy link

@colelawrence colelawrence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just a comment from the perspective of someone from the outside looking in.

@IMax153 IMax153 merged commit 0e46e24 into main Aug 18, 2025
11 checks passed
@IMax153 IMax153 deleted the remove-otel branch August 18, 2025 22:24
@github-project-automation github-project-automation bot moved this from Discussion Ongoing to Done in PR Backlog Aug 18, 2025
@github-actions github-actions bot mentioned this pull request Aug 18, 2025
@nikelborm
Copy link
Contributor

nikelborm commented Aug 19, 2025

😭 #5192

@nikelborm
Copy link
Contributor

nikelborm commented Aug 19, 2025

If you change your mind and decide to add comments, let me do it. I want to do it right at least this time. I can make a PR adding comments with links.

In the end, as a thing to consider, maybe it will be a good idea to create an @effect/otel-conventions package, where you'll mirror the constants from @opentelemetry/semantic-conventions without importing it, and then all other packages from the effect codebase will depend on ESM-ready @effect/otel-conventions. I'm happy to add it if you like

@IMax153
Copy link
Member Author

IMax153 commented Aug 19, 2025

In the end, as a thing to consider, maybe it will be a good idea to create an @effect/otel-conventions package

We were actually just discussing something like this internally, but instead of creating a new package, keeping everything in our existing opentelemetry package given the OTEL deps are peer dependencies there. May make sense as a separate package but we really haven't come to a conclusion yet.

The OTEL folks look like they autogenerate a lot of the semantic conventions code from the spec so it's probably not too difficult to maintain.

@nikelborm if you are interested maybe you could spec something out in the existing OTEL package and we can separate it out if we decide it make sense?

@nikelborm
Copy link
Contributor

nikelborm commented Aug 19, 2025

Could you please elaborate on what kinds of ESM problems @opentelemetry/semantic-conventions has?

spec something out in the existing OTEL package

By that, do you mean in the upstream repo (open-telemetry/opentelemetry-js) of @opentelemetry/semantic-conventions package?

@IMax153
Copy link
Member Author

IMax153 commented Aug 19, 2025

Could you please elaborate on what kinds of ESM problems @opentelemetry/semantic-conventions has?

Our users have consistently run into a variety of issues when building due to OTEL dependencies coming from our packages due to the way the libraries are published. It's highly specific to build environment. We would rather get rid of this friction point moving forward.

I'll let @mikearnaldi provide more context on the concrete issues as he has dealt with more of this than I have.

@mikearnaldi
Copy link
Member

Could you please elaborate on what kinds of ESM problems @opentelemetry/semantic-conventions has?

spec something out in the existing OTEL package

By that, do you mean in the upstream repo (open-telemetry/opentelemetry-js) of @opentelemetry/semantic-conventions package?

all @opentelemetry/x packages have broken ESM builds, they don't output correct modules per spec. There are opened issues there if you search their github. Generally speaking the @opentelemetry/x packages are a mess, which is why we try to offer an out-of-the-box working alternative

@nikelborm
Copy link
Contributor

nikelborm commented Aug 19, 2025

I found a few PRs that promise to fix the situation with ESM.

And they seem to be quite active. Will you be willing to reconsider removing dependency on @opentelemetry/semantic-conventions (or @opentelemetry/... packages in general) after they are merged?

@IMax153
Copy link
Member Author

IMax153 commented Aug 19, 2025

Probably not given our experience in the past and the lack of guarantee that this will fix all underlying issues.

@nikelborm
Copy link
Contributor

Probably not, given our experience in the past and the lack of guarantee that this will fix all underlying issues.

So, by that, I assume the answer to my previous question:

spec something out in the existing OTEL package

By that, do you mean in the upstream repo (open-telemetry/opentelemetry-js) of @opentelemetry/semantic-conventions package?

is no?

I'm a bit confused about what you meant by the existing OTEL package. If your trust in @opentelemetry/... packages is breached beyond recovery, where do you want me to spec something out? In @effect/opentelemetry?

@IMax153
Copy link
Member Author

IMax153 commented Aug 19, 2025

Yea I was referring to our @effect/opentelemetry package.

@mikearnaldi
Copy link
Member

Our objective is to have the Effect DX being smooth, for the time being official otel packages are a liability rather than an asset, if that changes over time and I truly hope it will we will reconsider. Note that this doesn’t mean dropping support for official otel packages, rather it means providing alternatives

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants