3.6.0 • Published 30 days ago

aws-xray-sdk-mysql v3.6.0

Weekly downloads
167,496
License
Apache-2.0
Repository
github
Last release
30 days ago

Requirements

  • AWS X-Ray SDK Core
  • MySQL 2.12.0 or greater

AWS X-Ray and MySQL

The AWS X-Ray MySQL package automatically records query information and request and response data. Simply patch the MySQL package via captureMySQL as shown below.

The AWS X-Ray SDK Core has two modes - manual and automatic. Automatic mode uses the cls-hooked package and automatically tracks the current segment and subsegment. This is the default mode. Manual mode requires that you pass around the segment reference. See the examples below.

Environment variables

MYSQL_DATABASE_VERSION           Sets additional data for the sql subsegment.
MYSQL_DRIVER_VERSION             Sets additional data for the sql subsegment.

Lambda Example

var AWSXRay = require('aws-xray-sdk');
var pg = AWSXRay.captureMySQL(require('mysql'));

...

exports.handler = function (event, context, callback) {
  // Make MySQL queries normally
}

Automatic mode example

var AWSXRay = require('aws-xray-sdk-core');
var captureMySQL = require('aws-xray-sdk-mysql');

var mysql = captureMySQL(require('mysql'));

var config = { ... };

...

var connection = mysql.createConnection(config);

connection.query('SELECT * FROM cats', function(err, rows) {
  //Automatically captures query information and errors (if any)
});

...

var pool = mysql.createPool(config);

pool.query('SELECT * FROM cats', function(err, rows, fields) {
  //Automatically captures query information and errors (if any)
}

Manual mode example

var AWSXRay = require('aws-xray-sdk-core');
var captureMySQL = require('aws-xray-sdk-mysql');

var mysql = captureMySQL(require('mysql'));

var config = { ... };

...

var connection = mysql.createConnection(config);

connection.query('SELECT * FROM cats', function(err, rows) {
  //Automatically captures query information and errors (if any)
}, segment);

...

var pool = mysql.createPool(config);

pool.query('SELECT * FROM cats', function(err, rows, fields) {
  //Automatically captures query information and errors (if any)
}, segment);
3.6.0

30 days ago

3.5.4

2 months ago

3.5.3

6 months ago

3.5.2

7 months ago

3.5.1

9 months ago

3.5.0

1 year ago

3.4.1

1 year ago

3.4.0

1 year ago

3.3.8

2 years ago

3.3.7

2 years ago

3.3.6

2 years ago

3.3.5

2 years ago

3.3.4

2 years ago

3.3.3

3 years ago

3.3.2

3 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.2.0

4 years ago

3.1.0

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

3.0.0-alpha.2

4 years ago

3.0.0-alpha.1

4 years ago

2.5.0

4 years ago

2.4.0

5 years ago

2.3.6

5 years ago

2.3.5

5 years ago

2.3.4

5 years ago

2.3.3

5 years ago

2.3.2

5 years ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0-beta

7 years ago