Skip to content

Commit b9c73ca

Browse files
authoredFeb 23, 2024··
chore: Updated DatastoreParameters to include collection (#2039)
1 parent 2c97488 commit b9c73ca

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed
 

‎lib/shim/specs/params/datastore.js

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* server.
1717
* @property {string} database_name
1818
* The name of the database being queried or operated on.
19+
* @property {string} collection
20+
* The name of the collection or table being queried or operated on.
1921
*/
2022

2123
/**
@@ -31,6 +33,7 @@ class DatastoreParameters {
3133
this.host = params.host ?? null
3234
this.port_path_or_id = params.port_path_or_id ?? null
3335
this.database_name = params.database_name ?? null
36+
this.collection = params.collection ?? null
3437
}
3538
}
3639

‎test/unit/instrumentation/mysql/getInstanceParameters.test.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ tap.test('getInstanceParameters', (t) => {
3434

3535
t.same(
3636
result,
37-
{ host: null, port_path_or_id: null, database_name: null },
37+
{ host: null, port_path_or_id: null, database_name: null, collection: null },
3838
'should return the default parameters'
3939
)
4040
t.ok(
@@ -84,7 +84,12 @@ tap.test('getInstanceParameters', (t) => {
8484
}
8585

8686
const result = instrumentation.getInstanceParameters(mockShim, mockQueryable, mockQuery)
87-
t.same(result, { host: 'example.com', port_path_or_id: '1234', database_name: 'test-database' })
87+
t.same(result, {
88+
host: 'example.com',
89+
port_path_or_id: '1234',
90+
database_name: 'test-database',
91+
collection: null
92+
})
8893
t.end()
8994
})
9095

@@ -100,7 +105,8 @@ tap.test('getInstanceParameters', (t) => {
100105
t.same(result, {
101106
host: 'localhost',
102107
port_path_or_id: '/var/run/mysqld/mysqld.sock',
103-
database_name: 'test-database'
108+
database_name: 'test-database',
109+
collection: null
104110
})
105111
t.end()
106112
})

0 commit comments

Comments
 (0)
Please sign in to comment.