Skip to content

Commit 0a1134d

Browse files
committed
Updating tests:
- error.type is dropped in favour of using https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/ - db.response.status_code is set in case of an error - namespace and collection names are reported as following: - 1: If the operation/command operates at the user collection level, then these fields should be set - 2: If the operation/command operates at the admin db, then only db.namespace should be set - 3: For bulkWrite collection name is not reported (db name is admin) - 4: For [abort|commit]Transaction no db name or collection reported
1 parent b478c9e commit 0a1134d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1383
-1216
lines changed

source/open-telemetry/tests/cursor/cursor.json

Lines changed: 119 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
},
103103
"nested": [
104104
{
105-
"name": "find cursor.test",
105+
"name": "find",
106106
"attributes": {
107107
"db.system": "mongodb",
108108
"db.namespace": "cursor",
@@ -133,7 +133,7 @@
133133
"long"
134134
]
135135
},
136-
"db.query.summary": "find",
136+
"db.query.summary": "find cursor.test",
137137
"db.query.text": {
138138
"$$matchAsDocument": {
139139
"$$matchAsRoot": {
@@ -160,130 +160,130 @@
160160
]
161161
}
162162
}
163-
}
164-
]
165-
},
166-
{
167-
"name": "getMore cursor.test",
168-
"attributes": {
169-
"db.system": "mongodb",
170-
"db.namespace": "cursor",
171-
"db.collection.name": "test",
172-
"db.command.name": "getMore",
173-
"network.transport": "tcp",
174-
"db.mongodb.cursor_id": {
175-
"$$type": [
176-
"int",
177-
"long"
178-
]
179-
},
180-
"db.response.status_code": {
181-
"$$exists": false
182163
},
183-
"exception.message": {
184-
"$$exists": false
185-
},
186-
"exception.type": {
187-
"$$exists": false
188-
},
189-
"exception.stacktrace": {
190-
"$$exists": false
191-
},
192-
"server.address": {
193-
"$$type": "string"
194-
},
195-
"server.port": {
196-
"$$type": [
197-
"int",
198-
"long"
199-
]
200-
},
201-
"db.query.summary": "getMore",
202-
"db.query.text": {
203-
"$$matchAsDocument": {
204-
"$$matchAsRoot": {
205-
"getMore": {
206-
"$$type": "long"
207-
},
208-
"collection": "test",
209-
"batchSize": 2
164+
{
165+
"name": "getMore",
166+
"attributes": {
167+
"db.system": "mongodb",
168+
"db.namespace": "cursor",
169+
"db.collection.name": "test",
170+
"db.command.name": "getMore",
171+
"network.transport": "tcp",
172+
"db.mongodb.cursor_id": {
173+
"$$type": [
174+
"int",
175+
"long"
176+
]
177+
},
178+
"db.response.status_code": {
179+
"$$exists": false
180+
},
181+
"exception.message": {
182+
"$$exists": false
183+
},
184+
"exception.type": {
185+
"$$exists": false
186+
},
187+
"exception.stacktrace": {
188+
"$$exists": false
189+
},
190+
"server.address": {
191+
"$$type": "string"
192+
},
193+
"server.port": {
194+
"$$type": [
195+
"int",
196+
"long"
197+
]
198+
},
199+
"db.query.summary": "getMore cursor.test",
200+
"db.query.text": {
201+
"$$matchAsDocument": {
202+
"$$matchAsRoot": {
203+
"getMore": {
204+
"$$type": "long"
205+
},
206+
"collection": "test",
207+
"batchSize": 2
208+
}
209+
}
210+
},
211+
"db.mongodb.server_connection_id": {
212+
"$$type": [
213+
"int",
214+
"long"
215+
]
216+
},
217+
"db.mongodb.driver_connection_id": {
218+
"$$type": [
219+
"int",
220+
"long"
221+
]
210222
}
211223
}
212224
},
213-
"db.mongodb.server_connection_id": {
214-
"$$type": [
215-
"int",
216-
"long"
217-
]
218-
},
219-
"db.mongodb.driver_connection_id": {
220-
"$$type": [
221-
"int",
222-
"long"
223-
]
224-
}
225-
}
226-
},
227-
{
228-
"name": "getMore cursor.test",
229-
"attributes": {
230-
"db.system": "mongodb",
231-
"db.namespace": "cursor",
232-
"db.collection.name": "test",
233-
"db.command.name": "getMore",
234-
"network.transport": "tcp",
235-
"db.mongodb.cursor_id": {
236-
"$$type": [
237-
"int",
238-
"long"
239-
]
240-
},
241-
"db.response.status_code": {
242-
"$$exists": false
243-
},
244-
"exception.message": {
245-
"$$exists": false
246-
},
247-
"exception.type": {
248-
"$$exists": false
249-
},
250-
"exception.stacktrace": {
251-
"$$exists": false
252-
},
253-
"server.address": {
254-
"$$type": "string"
255-
},
256-
"server.port": {
257-
"$$type": [
258-
"int",
259-
"long"
260-
]
261-
},
262-
"db.query.summary": "getMore",
263-
"db.query.text": {
264-
"$$matchAsDocument": {
265-
"$$matchAsRoot": {
266-
"getMore": {
267-
"$$type": "long"
268-
},
269-
"collection": "test",
270-
"batchSize": 2
225+
{
226+
"name": "getMore",
227+
"attributes": {
228+
"db.system": "mongodb",
229+
"db.namespace": "cursor",
230+
"db.collection.name": "test",
231+
"db.command.name": "getMore",
232+
"network.transport": "tcp",
233+
"db.mongodb.cursor_id": {
234+
"$$type": [
235+
"int",
236+
"long"
237+
]
238+
},
239+
"db.response.status_code": {
240+
"$$exists": false
241+
},
242+
"exception.message": {
243+
"$$exists": false
244+
},
245+
"exception.type": {
246+
"$$exists": false
247+
},
248+
"exception.stacktrace": {
249+
"$$exists": false
250+
},
251+
"server.address": {
252+
"$$type": "string"
253+
},
254+
"server.port": {
255+
"$$type": [
256+
"int",
257+
"long"
258+
]
259+
},
260+
"db.query.summary": "getMore cursor.test",
261+
"db.query.text": {
262+
"$$matchAsDocument": {
263+
"$$matchAsRoot": {
264+
"getMore": {
265+
"$$type": "long"
266+
},
267+
"collection": "test",
268+
"batchSize": 2
269+
}
270+
}
271+
},
272+
"db.mongodb.server_connection_id": {
273+
"$$type": [
274+
"int",
275+
"long"
276+
]
277+
},
278+
"db.mongodb.driver_connection_id": {
279+
"$$type": [
280+
"int",
281+
"long"
282+
]
271283
}
272284
}
273-
},
274-
"db.mongodb.server_connection_id": {
275-
"$$type": [
276-
"int",
277-
"long"
278-
]
279-
},
280-
"db.mongodb.driver_connection_id": {
281-
"$$type": [
282-
"int",
283-
"long"
284-
]
285285
}
286-
}
286+
]
287287
}
288288
]
289289
}

source/open-telemetry/tests/cursor/cursor.yml

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ tests:
5050
db.operation.name: find
5151
db.operation.summary: find cursor.test
5252
nested:
53-
- name: find cursor.test
53+
- name: find
5454
attributes:
5555
db.system: mongodb
5656
db.namespace: cursor
@@ -64,7 +64,7 @@ tests:
6464
exception.stacktrace: { $$exists: false }
6565
server.address: { $$type: string }
6666
server.port: { $$type: ['int', 'long'] }
67-
db.query.summary: find
67+
db.query.summary: find cursor.test
6868
db.query.text:
6969
$$matchAsDocument:
7070
$$matchAsRoot:
@@ -76,54 +76,54 @@ tests:
7676
db.mongodb.driver_connection_id:
7777
$$type: [ 'int', 'long' ]
7878

79-
- name: getMore cursor.test
80-
attributes:
81-
db.system: mongodb
82-
db.namespace: cursor
83-
db.collection.name: *collectionName0
84-
db.command.name: getMore
85-
network.transport: tcp
86-
db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] }
87-
db.response.status_code: { $$exists: false }
88-
exception.message: { $$exists: false }
89-
exception.type: { $$exists: false }
90-
exception.stacktrace: { $$exists: false }
91-
server.address: { $$type: string }
92-
server.port: { $$type: ['int', 'long'] }
93-
db.query.summary: getMore
94-
db.query.text:
95-
$$matchAsDocument:
96-
$$matchAsRoot:
97-
getMore: { $$type: long }
98-
collection: test
99-
batchSize: 2
100-
db.mongodb.server_connection_id:
101-
$$type: [ 'int', 'long' ]
102-
db.mongodb.driver_connection_id:
103-
$$type: [ 'int', 'long' ]
79+
- name: getMore
80+
attributes:
81+
db.system: mongodb
82+
db.namespace: cursor
83+
db.collection.name: *collectionName0
84+
db.command.name: getMore
85+
network.transport: tcp
86+
db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] }
87+
db.response.status_code: { $$exists: false }
88+
exception.message: { $$exists: false }
89+
exception.type: { $$exists: false }
90+
exception.stacktrace: { $$exists: false }
91+
server.address: { $$type: string }
92+
server.port: { $$type: ['int', 'long'] }
93+
db.query.summary: getMore cursor.test
94+
db.query.text:
95+
$$matchAsDocument:
96+
$$matchAsRoot:
97+
getMore: { $$type: long }
98+
collection: test
99+
batchSize: 2
100+
db.mongodb.server_connection_id:
101+
$$type: [ 'int', 'long' ]
102+
db.mongodb.driver_connection_id:
103+
$$type: [ 'int', 'long' ]
104104

105-
- name: getMore cursor.test
106-
attributes:
107-
db.system: mongodb
108-
db.namespace: cursor
109-
db.collection.name: *collectionName0
110-
db.command.name: getMore
111-
network.transport: tcp
112-
db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] }
113-
db.response.status_code: { $$exists: false }
114-
exception.message: { $$exists: false }
115-
exception.type: { $$exists: false }
116-
exception.stacktrace: { $$exists: false }
117-
server.address: { $$type: string }
118-
server.port: { $$type: ['int', 'long'] }
119-
db.query.summary: getMore
120-
db.query.text:
121-
$$matchAsDocument:
122-
$$matchAsRoot:
123-
getMore: { $$type: long }
124-
collection: test
125-
batchSize: 2
126-
db.mongodb.server_connection_id:
127-
$$type: [ 'int', 'long' ]
128-
db.mongodb.driver_connection_id:
129-
$$type: [ 'int', 'long' ]
105+
- name: getMore
106+
attributes:
107+
db.system: mongodb
108+
db.namespace: cursor
109+
db.collection.name: *collectionName0
110+
db.command.name: getMore
111+
network.transport: tcp
112+
db.mongodb.cursor_id: { $$type: [ 'int', 'long' ] }
113+
db.response.status_code: { $$exists: false }
114+
exception.message: { $$exists: false }
115+
exception.type: { $$exists: false }
116+
exception.stacktrace: { $$exists: false }
117+
server.address: { $$type: string }
118+
server.port: { $$type: ['int', 'long'] }
119+
db.query.summary: getMore cursor.test
120+
db.query.text:
121+
$$matchAsDocument:
122+
$$matchAsRoot:
123+
getMore: { $$type: long }
124+
collection: test
125+
batchSize: 2
126+
db.mongodb.server_connection_id:
127+
$$type: [ 'int', 'long' ]
128+
db.mongodb.driver_connection_id:
129+
$$type: [ 'int', 'long' ]

0 commit comments

Comments
 (0)