Skip to content

ref(attributes): Use JSON for aws.s3.delete & document multi-collection db.collection.name - #711

Open
pabloDeputter wants to merge 2 commits into
mainfrom
pablo/aws-s3-delete-db-collection-name
Open

pabloDeputter wants to merge 2 commits into
mainfrom
pablo/aws-s3-delete-db-collection-name

Conversation

@pabloDeputter

Copy link
Copy Markdown
Member

Description

Update aws.s3.delete and db.collection.name descriptions and examples.

@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
sentry-conventions Ready Ready Preview Oct 14, 2026 8:36am UTC

Request Review

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (attributes) Add http.request.duration by loewenheim in #697

Internal Changes 🔧

  • (attributes) Use JSON for aws.s3.delete & document multi-collection db.collection.name by pabloDeputter in #711
  • (repo) Update CODEOWNERS to include @giortzisg by Lms24 in #708

🤖 This preview updates automatically when you update the PR.

@pabloDeputter
pabloDeputter marked this pull request as ready for review October 13, 2026 14:58
},
"is_in_otel": true,
"example": "users",
"examples": ["users", ",customers,orders,"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I looked at documentation in OTel how they treat multiple collections but it doesn't seem like they specify anything regarding multiple collections. Looking at their database span spec, it seems like they only want this attribute to be set, when the db operation is done on one collection.

I think this is free to interpretation but I would assume that when you have something like SELECT * FROM users JOIN orders ON ..., db.collection.name should only hold users.

This is a string attribute, so I'd prefer we avoid joining multiple values into one string.
Are we doing the comma-joined list already somewhere? If so, why the leading ,? 😅

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yup, I noticed that as well. So for a JOIN OTel will probably omit both users and orders. However db.collection.name is already set to this joined form by Relay; I sent a few queries through the python-SQLAlchemy integration (which never sets db.collection.name): https://sentry-sdks.sentry.io/explore/traces/trace/a4c29d7664f047bfac9ba507460c7ed1/?mode=samples&node=span-a7290e2aed0619ab&project=4511733153660928&source=traces&statsPeriod=1h&table=trace&timestamp=1791970030.188

  • join on 2 tables: SELECT * FROM users JOIN orders ON ... => ,orders,users,
  • multiple queries: SELECT * FROM "acme-shop-customers" …; SELECT * FROM "acme-shop-orders" … => ,acme-shop-customers,acme-shop-orders,
  • single table: SELECT * FROM "Users" WHERE ... => ,users,

So pretty sure Relay sets db.collection.name (when not provided by the SDK) based off query.text; sorts and lower-cases it as well.

So that's why I added the new example to it, I probably should have been a bit more specific on why I changed this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So I looked at this again and OTel ([1] remark at https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/#db-collection-name) states that it should not be extracted from db.query.text when the db system supports queries over multiple collections (which basically covers any SQL db), and recommends no case normalization. sql_tables_from_query() does both of these things when db.collection.name isn't set by the SDK (Users => ,users,, users JOIN orders => ,orders,users,).

The commas are inherited from v1 span.domain which was (I think) so a contains-search can differentiate ,users, from ,users_postfix, (getsentry/relay#5399)

Comment on lines +24543 to +24544
example: '{"Objects":[{"Key":"someFile.yml","VersionId":"3HL4kqtJlcpXroDTDmJ"}],"Quiet":false}',
examples: ['{"Objects":[{"Key":"someFile.yml","VersionId":"3HL4kqtJlcpXroDTDmJ"}],"Quiet":false}'],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

examples takes precedence, so no need to have both keys

Suggested change
example: '{"Objects":[{"Key":"someFile.yml","VersionId":"3HL4kqtJlcpXroDTDmJ"}],"Quiet":false}',
examples: ['{"Objects":[{"Key":"someFile.yml","VersionId":"3HL4kqtJlcpXroDTDmJ"}],"Quiet":false}'],
examples: ['{"Objects":[{"Key":"someFile.yml","VersionId":"3HL4kqtJlcpXroDTDmJ"}],"Quiet":false}'],

},
'aws.s3.delete': {
brief: 'The delete request container that specifies the objects to be deleted.',
brief: 'The JSON-serialized value of Delete request field, which specifies the objects to be deleted.',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you know which SDKs set this attribute and if they all use the JSON-serialized version?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

actually, this is the more important question: #711 (comment)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In sentry-python (for the next major, so not yet released), boto3 passes it as a dict, so we serialize it as a JSON (https://github.com/getsentry/sentry-python/blob/major/3.0/sentry_sdk/integrations/boto3/_services/s3.py#L70-L79)

},
'aws.s3.delete': {
brief: 'The delete request container that specifies the objects to be deleted.',
brief: 'The JSON-serialized value of Delete request field, which specifies the objects to be deleted.',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I looked up the OTel definition and the current format is what OTel specifies. Why should we diverge here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm pretty sure that the Objects[{key=string, ... format is just copied from the AWS CLI docs which is one way of providing it to the CLI, next to JSON.

In the SDK we get the Deletestructure itself, e.g. boto3 passes it as a dict, so we serialize it to a JSON: https://github.com/getsentry/sentry-python/blob/major/3.0/sentry_sdk/integrations/boto3/_services/s3.py#L70-L79 (for the next major, not relased yet)

Other OTel attributes, e.g. aws.dynamodb.* also use JSON-serialized values; so just trying to make it consistent across the aws.* attributes.

This branch was successfully deployed

1 active deployment
Preview — 06ef18a3 Deployed Oct 14, 2026 by vercel[bot]
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