Skip to content

Commit

Permalink
fix: compilation issue with latest @types/mysql
Browse files Browse the repository at this point in the history
By importing the and using the ConnectionConfig and PoolActualConfig types.
  • Loading branch information
Naseem committed Aug 6, 2020
1 parent 44dbe5b commit ac725be
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion plugins/node/opentelemetry-plugin-mysql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@opentelemetry/test-utils": "^0.9.0",
"@opentelemetry/tracing": "0.10.1",
"@types/mocha": "7.0.2",
"@types/mysql": "2.15.14",
"@types/mysql": "2.15.15",
"@types/node": "12.12.47",
"@types/shimmer": "1.0.1",
"codecov": "3.7.1",
Expand Down
7 changes: 0 additions & 7 deletions plugins/node/opentelemetry-plugin-mysql/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@
* limitations under the License.
*/

export type ConnectionConfig = Partial<{
host: string;
port: number;
database: string;
user: string;
}>;

export type Query = Partial<{
sql: string;
}>;
5 changes: 3 additions & 2 deletions plugins/node/opentelemetry-plugin-mysql/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

import { Attributes } from '@opentelemetry/api';
import { AttributeNames } from './enums';
import { ConnectionConfig, Query } from './types';
import { Query } from './types';
import { ConnectionConfig, PoolActualConfig } from 'mysql';

/**
* Get a span name from a mysql query
Expand Down Expand Up @@ -49,7 +50,7 @@ function getCommand(query: string | Query) {
*
* @param config ConnectionConfig
*/
export function getConnectionAttributes(config: ConnectionConfig): Attributes {
export function getConnectionAttributes(config: ConnectionConfig | PoolActualConfig): Attributes {
const { host, port, database, user } = getConfig(config);

return {
Expand Down

0 comments on commit ac725be

Please sign in to comment.