Skip to content

Conversation

alexander-alderman-webb
Copy link
Contributor

DESCRIBE YOUR PR

Tell us what you're changing and why. If your PR resolves an issue, please link it so it closes automatically.

Spec out work for getsentry/sentry-python#4320.

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

LEGAL BOILERPLATE

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

EXTRA RESOURCES

Copy link

vercel bot commented Oct 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
develop-docs Ready Ready Preview Comment Oct 16, 2025 8:37am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
sentry-docs Ignored Ignored Preview Oct 16, 2025 8:37am

@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review October 13, 2025 12:28
@alexander-alderman-webb alexander-alderman-webb changed the title feat(develop): Add SDK spec for SQL transaction feat(develop): Add SDK spec for database transactions Oct 13, 2025
Copy link
Contributor Author

@alexander-alderman-webb alexander-alderman-webb left a comment

Choose a reason for hiding this comment

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

Implemented your suggestions @lcian. Thanks!

@@ -0,0 +1,21 @@
---
title: HTTP Requests within SQL Transactions Module
Copy link
Member

Choose a reason for hiding this comment

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

This spec doesn't cover HTTP, is the "HTTP Requests within" here intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the page in the modules folder here since the SQL transaction spans support a feature in the product. The page follows the same structure as the other pages in the folder, with a title of the feature we are supporting and the SDK requirements below.

As for whether our spec should be organized this way, that's probably another discussion we will have soon as the Sentry evolves.

Copy link
Member

Choose a reason for hiding this comment

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

Just to be clear, there is no current product feature which detects this - that project was postponed as telemetry wasn't available. We are currently planning to use this information to detect a wide variety of SQL transaction related problems in Q4, including but not limited to HTTP requests within them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, the clarification is useful. I didn't have the full context from the Linear project. I've moved the page and changed the title.

Equivalent deprecated attributes MAY be used for backward compatibility, but they SHOULD be marked for deprecation.

The operation names for BEGIN, COMMIT and ROLLBACK instructions MUST be "BEGIN", "COMMIT", and "ROLLBACK", respectively.
For other transaction-level instructions like MySQL's START TRANSACTION, the SDK SHOULD represent the literal statement as closely as possible, omitting control-flow characters like semicolons.
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@alexander-alderman-webb alexander-alderman-webb Oct 15, 2025

Choose a reason for hiding this comment

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

I would consider SAVEPOINT, RELEASE SAVEPOINT, ROLLBACK TO, SAVE TRANSACTION transaction-level statements, so they should have sensible operation name values that reflect the literal statement.

The spec is currently unclear what spans must be available for an SQL transaction to be considered instrumented.

What would be useful for you @mrduncan? Would tracing save points inside a transaction context enable better database issue detection?

I'll then amend the spec to be clearer about what database instructions should be traced.

Copy link
Member

Choose a reason for hiding this comment

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

Would tracing save points inside a transaction context enable better database issue detection?

Yes, to some degree however it is totally reasonable for us to start focused on begin/commit/rollback for now as those are going to provide 90% of the value. If the others are present, great, but we can invest more in those in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great to know, I've worked in that it's recommended to instrument all transaction-level statements. We'll still focus on BEGIN, COMMIT and ROLLBACK, and similar statements to begin with.

title: SQL Transactions
---

The SDK SHOULD auto-instrument all database transactions for SQL databases like PostgreSQL and MySQL.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The SDK SHOULD auto-instrument all database transactions for SQL databases like PostgreSQL and MySQL.
The SDK _should_ auto-instrument all database transactions for SQL databases like PostgreSQL and MySQL.

---

The SDK SHOULD auto-instrument all database transactions for SQL databases like PostgreSQL and MySQL.
Each BEGIN, COMMIT, and ROLLBACK, or equivalent statement in the database system MUST result in an individual span.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Each BEGIN, COMMIT, and ROLLBACK, or equivalent statement in the database system MUST result in an individual span.
Each BEGIN, COMMIT, and ROLLBACK, or equivalent statement in the database system _must_ result in an individual span.


The SDK SHOULD auto-instrument all database transactions for SQL databases like PostgreSQL and MySQL.
Each BEGIN, COMMIT, and ROLLBACK, or equivalent statement in the database system MUST result in an individual span.
Spans for other transaction-level statements, such as SAVEPOINT, are RECOMMENDED and, when implemented, MUST also correspond to an individual SQL statement.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Spans for other transaction-level statements, such as SAVEPOINT, are RECOMMENDED and, when implemented, MUST also correspond to an individual SQL statement.
Spans for other transaction-level statements, such as SAVEPOINT, are _recommended_ and, when implemented, **must** also correspond to an individual SQL statement.

The SDK SHOULD auto-instrument all database transactions for SQL databases like PostgreSQL and MySQL.
Each BEGIN, COMMIT, and ROLLBACK, or equivalent statement in the database system MUST result in an individual span.
Spans for other transaction-level statements, such as SAVEPOINT, are RECOMMENDED and, when implemented, MUST also correspond to an individual SQL statement.
Transaction statements SHOULD produce spans whether they are issued through a database driver or through an ORM.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Transaction statements SHOULD produce spans whether they are issued through a database driver or through an ORM.
Transaction statements _should_ produce spans whether they are issued through a database driver or through an ORM.

### Span Data

Refer to <Link to="https://getsentry.github.io/sentry-conventions/generated/attributes/db.html">Database Span Data Conventions</Link> for a full list of attributes that database spans should have.
The SDK SHOULD set the
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The SDK SHOULD set the
The SDK should set the

- db.operation.name

attributes for transaction statement spans.
Equivalent deprecated attributes MAY be used for backward compatibility, but they SHOULD be marked for deprecation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Equivalent deprecated attributes MAY be used for backward compatibility, but they SHOULD be marked for deprecation.
Equivalent deprecated attributes may be used for backward compatibility, but they _should_ be marked for deprecation.

attributes for transaction statement spans.
Equivalent deprecated attributes MAY be used for backward compatibility, but they SHOULD be marked for deprecation.

The operation names for BEGIN, COMMIT and ROLLBACK statements MUST be "BEGIN", "COMMIT", and "ROLLBACK", respectively.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The operation names for BEGIN, COMMIT and ROLLBACK statements MUST be "BEGIN", "COMMIT", and "ROLLBACK", respectively.
The operation names for BEGIN, COMMIT and ROLLBACK statements _must_ be "BEGIN", "COMMIT", and "ROLLBACK", respectively.

Equivalent deprecated attributes MAY be used for backward compatibility, but they SHOULD be marked for deprecation.

The operation names for BEGIN, COMMIT and ROLLBACK statements MUST be "BEGIN", "COMMIT", and "ROLLBACK", respectively.
For synonyms, like BEGIN TRANSACTION for BEGIN, the operation name MAY reflect the synonym. In this example, "BEGIN TRANSACTION" MAY be used.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
For synonyms, like BEGIN TRANSACTION for BEGIN, the operation name MAY reflect the synonym. In this example, "BEGIN TRANSACTION" MAY be used.
For synonyms, like BEGIN TRANSACTION for BEGIN, the operation name may reflect the synonym. In this example, "BEGIN TRANSACTION" may be used.

The operation names for BEGIN, COMMIT and ROLLBACK statements MUST be "BEGIN", "COMMIT", and "ROLLBACK", respectively.
For synonyms, like BEGIN TRANSACTION for BEGIN, the operation name MAY reflect the synonym. In this example, "BEGIN TRANSACTION" MAY be used.
Some statements, like SAVEPOINT, ROLLBACK TO SAVEPOINT and RELEASE SAVEPOINT, take arguments.
The operation name for statements that accept arguments MUST be the statement without the arguments. For the examples above, the operation names are "SAVEPOINT", "ROLLBACK TO SAVEPOINT", and "RELEASE SAVEPOINT", respectively.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The operation name for statements that accept arguments MUST be the statement without the arguments. For the examples above, the operation names are "SAVEPOINT", "ROLLBACK TO SAVEPOINT", and "RELEASE SAVEPOINT", respectively.
The operation name for statements that accept arguments _must_ be the statement without the arguments. For the examples above, the operation names are "SAVEPOINT", "ROLLBACK TO SAVEPOINT", and "RELEASE SAVEPOINT", respectively.

Some statements, like SAVEPOINT, ROLLBACK TO SAVEPOINT and RELEASE SAVEPOINT, take arguments.
The operation name for statements that accept arguments MUST be the statement without the arguments. For the examples above, the operation names are "SAVEPOINT", "ROLLBACK TO SAVEPOINT", and "RELEASE SAVEPOINT", respectively.

For other transaction-level statements like MySQL's START TRANSACTION, the SDK SHOULD represent the literal statement as closely as possible, omitting control-flow characters like semicolons.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
For other transaction-level statements like MySQL's START TRANSACTION, the SDK SHOULD represent the literal statement as closely as possible, omitting control-flow characters like semicolons.
For other transaction-level statements like MySQL's START TRANSACTION, the SDK should represent the literal statement as closely as possible, omitting control-flow characters like semicolons.

Copy link
Contributor

@sfanahata sfanahata left a comment

Choose a reason for hiding this comment

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

I'm confused about the consistent use of ALL CAPS for should, must, and may. It is more appropriate to use italics or bold to convey important words. This is also confusing because of the use of all caps for what I'm assuming are code blocks. Can we change these to begin, commit, rollback, etc? Is there a reason to leave them as caps?

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.

5 participants