Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions javascript/sentry-conventions/src/attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3113,7 +3113,7 @@ export type AWS_S3_COPY_SOURCE_TYPE = string;
// Path: model/attributes/aws/aws__s3__delete.json

/**
* The delete request container that specifies the objects to be deleted. `aws.s3.delete`
* The JSON-serialized value of Delete request field, which specifies the objects to be deleted. `aws.s3.delete`
*
* Attribute Value Type: `string` {@link AWS_S3_DELETE_TYPE}
*
Expand All @@ -3122,7 +3122,7 @@ export type AWS_S3_COPY_SOURCE_TYPE = string;
* Attribute defined in OTEL: Yes
* Visibility: public
*
* @example "Objects=[{Key=string,VersionId=string},{Key=string,VersionId=string}],Quiet=boolean"
* @example "{\"Objects\":[{\"Key\":\"someFile.yml\",\"VersionId\":\"3HL4kqtJlcpXroDTDmJ\"}],\"Quiet\":false}"
*/
export const AWS_S3_DELETE = 'aws.s3.delete';

Expand Down Expand Up @@ -5381,6 +5381,7 @@ export type CULTURE_TIMEZONE_TYPE = string;
* Aliases: {@link DB_MONGODB_COLLECTION} `db.mongodb.collection`
*
* @example "users"
* @example ",customers,orders,"
*/
export const DB_COLLECTION_NAME = 'db.collection.name';

Expand Down Expand Up @@ -25432,17 +25433,18 @@ export const ATTRIBUTE_METADATA: Record<AttributeName, AttributeMetadata> = {
],
},
'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.',
type: 'string',
keys: ['aws.s3.delete'],
applyScrubbing: {
key: 'auto',
},
isInOtel: true,
visibility: 'public',
example: 'Objects=[{Key=string,VersionId=string},{Key=string,VersionId=string}],Quiet=boolean',
examples: ['Objects=[{Key=string,VersionId=string},{Key=string,VersionId=string}],Quiet=boolean'],
example: '{"Objects":[{"Key":"someFile.yml","VersionId":"3HL4kqtJlcpXroDTDmJ"}],"Quiet":false}',
examples: ['{"Objects":[{"Key":"someFile.yml","VersionId":"3HL4kqtJlcpXroDTDmJ"}],"Quiet":false}'],
changelog: [
{ version: 'next', description: 'Changed the value to a JSON-serialized field, with an example' },
{ version: '0.28.0', prs: [713], description: 'Changed apply_scrubbing from manual to auto' },
{ version: '0.27.0', prs: [672], description: 'Added aws.s3.delete attribute' },
],
Expand Down Expand Up @@ -26973,12 +26975,17 @@ export const ATTRIBUTE_METADATA: Record<AttributeName, AttributeMetadata> = {
isInOtel: true,
visibility: 'public',
example: 'users',
examples: ['users', ',customers,orders,'],
aliases: ['db.mongodb.collection'],
changelog: [
{ version: 'next', description: 'Add comma-wrapped format for calls on more than one collection' },
{ version: '0.19.0', prs: [483], description: 'Added db.mongodb.collection as an alias' },
{ version: '0.1.0', prs: [106, 127] },
{ version: '0.0.0' },
],
additionalContext: [
'For a call on more than one collection: the unique names, sorted and wrapped in commas (`,customers,orders,`), so each name matches `,<name>,`.',
],
},
'db.connection_string': {
brief: 'The connection string used to connect to the database.',
Expand Down
2 changes: 1 addition & 1 deletion javascript/sentry-conventions/src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7357,7 +7357,7 @@ export const ATTRIBUTE_SEARCH_METADATA: Record<string, AttributeSearchMetadata>
'aws.s3.delete': {
canonicalName: 'aws.s3.delete',
type: 'string',
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.',
deprecationChain: ['aws.s3.delete'],
},
'aws.s3.key': {
Expand Down
8 changes: 6 additions & 2 deletions model/attributes/aws/aws__s3__delete.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{
"key": "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.",
"additional_context": ["Applicable only to the delete-objects operation, corresponding to its Delete parameter."],
"type": "string",
"apply_scrubbing": {
"key": "auto"
},
"is_in_otel": true,
"visibility": "public",
"examples": ["Objects=[{Key=string,VersionId=string},{Key=string,VersionId=string}],Quiet=boolean"],
"examples": ["{\"Objects\":[{\"Key\":\"someFile.yml\",\"VersionId\":\"3HL4kqtJlcpXroDTDmJ\"}],\"Quiet\":false}"],
"changelog": [
{
"version": "next",
"description": "Changed the value to a JSON-serialized field, with an example"
},
{
"version": "0.28.0",
"prs": [713],
Expand Down
9 changes: 8 additions & 1 deletion model/attributes/db/db__collection__name.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
{
"key": "db.collection.name",
"brief": "The name of a collection (table, container) within the database.",
"additional_context": [
"For a call on more than one collection: the unique names, sorted and wrapped in commas (`,customers,orders,`), so each name matches `,<name>,`."
],
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"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)

"alias": ["db.mongodb.collection"],
"visibility": "public",
"changelog": [
{
"version": "next",
"description": "Add comma-wrapped format for calls on more than one collection"
},
{
"version": "0.19.0",
"prs": [483],
Expand Down
23 changes: 18 additions & 5 deletions python/src/sentry_conventions/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2196,13 +2196,13 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):

# Path: model/attributes/aws/aws__s3__delete.json
AWS_S3_DELETE: Literal["aws.s3.delete"] = "aws.s3.delete"
"""The delete request container that specifies the objects to be deleted.
"""The JSON-serialized value of Delete request field, which specifies the objects to be deleted.

Type: str
Apply Scrubbing: auto
Defined in OTEL: Yes
Visibility: public
Example: "Objects=[{Key=string,VersionId=string},{Key=string,VersionId=string}],Quiet=boolean"
Example: "{\"Objects\":[{\"Key\":\"someFile.yml\",\"VersionId\":\"3HL4kqtJlcpXroDTDmJ\"}],\"Quiet\":false}"
"""

# Path: model/attributes/aws/aws__s3__key.json
Expand Down Expand Up @@ -3512,6 +3512,7 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
Visibility: public
Aliases: db.mongodb.collection
Example: "users"
Example: ",customers,orders,"
"""

# Path: model/attributes/db/db__connection_string.json
Expand Down Expand Up @@ -15205,17 +15206,21 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
],
),
"aws.s3.delete": AttributeMetadata(
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.",
type=AttributeType.STRING,
keys=("aws.s3.delete",),
apply_scrubbing=ApplyScrubbingInfo(key=ApplyScrubbing.AUTO),
is_in_otel=True,
visibility=Visibility.PUBLIC,
example="Objects=[{Key=string,VersionId=string},{Key=string,VersionId=string}],Quiet=boolean",
example='{"Objects":[{"Key":"someFile.yml","VersionId":"3HL4kqtJlcpXroDTDmJ"}],"Quiet":false}',
examples=[
"Objects=[{Key=string,VersionId=string},{Key=string,VersionId=string}],Quiet=boolean"
'{"Objects":[{"Key":"someFile.yml","VersionId":"3HL4kqtJlcpXroDTDmJ"}],"Quiet":false}'
],
changelog=[
ChangelogEntry(
version="next",
description="Changed the value to a JSON-serialized field, with an example",
),
ChangelogEntry(
version="0.28.0",
prs=[713],
Expand Down Expand Up @@ -17068,8 +17073,13 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
is_in_otel=True,
visibility=Visibility.PUBLIC,
example="users",
examples=["users", ",customers,orders,"],
aliases=["db.mongodb.collection"],
changelog=[
ChangelogEntry(
version="next",
description="Add comma-wrapped format for calls on more than one collection",
),
ChangelogEntry(
version="0.19.0",
prs=[483],
Expand All @@ -17078,6 +17088,9 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
ChangelogEntry(version="0.1.0", prs=[106, 127]),
ChangelogEntry(version="0.0.0"),
],
additional_context=[
"For a call on more than one collection: the unique names, sorted and wrapped in commas (`,customers,orders,`), so each name matches `,<name>,`."
],
),
"db.connection_string": AttributeMetadata(
brief="The connection string used to connect to the database.",
Expand Down
Loading