Skip to content

feat: draft - PG semantic convention stability migration#2076

Draft
hannahramadan wants to merge 5 commits intoopen-telemetry:mainfrom
hannahramadan:pg_semantic_stability
Draft

feat: draft - PG semantic convention stability migration#2076
hannahramadan wants to merge 5 commits intoopen-telemetry:mainfrom
hannahramadan:pg_semantic_stability

Conversation

@hannahramadan
Copy link
Copy Markdown
Member

@hannahramadan hannahramadan commented Mar 14, 2026

This PR is intended to assist in the transition from the old to new database semantic conventions. Per the database semantic convention stability migration spec, users should be able to set the environment variable OTEL_SEMCONV_STABILITY_OPT_IN to:

  • database to emit stable conventions only
  • database/dup to emit both old and the stable conventions
  • a blank env var will emit old conventions only

The agent is required to maintain this bridge for 6 months and may drop the environment variable in the next major version and emit only the stable database and networking conventions.

This approach was approved for HTTP migration in #1547

Changes:

  • db.system -> db.system.name
  • net.peer.name -> server.address
  • net.peer.port -> server.port
  • db.name -> db.namespace
  • db.statement -> db.query.text
  • db.operation → db.operation.name change

Removed:

  • db.user
  • net.peer.ip
  • net.transport
  • net.sock.family
  • db.collection.name (Removed because accord to spec, we should only add if readily available)
  • peer.service

Added:

  • error.type
  • server.port

@hannahramadan hannahramadan changed the title feat: add database OTEL_SEMCONV_STABILITY_OPT_IN feat: PG semantic convention stability migration Mar 14, 2026
@hannahramadan hannahramadan marked this pull request as ready for review March 16, 2026 20:09
@hannahramadan hannahramadan marked this pull request as draft March 17, 2026 17:22
# By default, this instrumentation obfuscates/sanitizes the executed SQL as the `db.statement`
# semantic attribute. Optionally, you may disable the inclusion of this attribute entirely by
# setting this option to :omit or disable sanitization of the attribute by setting it to :include
db_statement: :include,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I know that it is out of scope of this PR, but would you be willing to also document the obfuscation_limit: 2000 parameter in this file, please?

The description would be something like:

When enabled by db_statement, this instrumentation will not obfuscate SQL queries longer than 2000 characters. The default limit can be overridden by setting the obfuscation_limit to another integer value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The config was released in v0.25.0 (on 2023-05-25), but never documented it seems.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's going to be a while before this is ready for review and merged.

@toncid would you be amenable to submitting a PR that documents the option?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sure, no problem. Thanks for the quick answer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@arielvalentin Done - #2122. 🚀

@hannahramadan hannahramadan changed the title feat: PG semantic convention stability migration feat: draft - PG semantic convention stability migration Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants