diff --git a/lib/db/parsed-statement.js b/lib/db/parsed-statement.js index ac5eedfaec..8a6a8e2733 100644 --- a/lib/db/parsed-statement.js +++ b/lib/db/parsed-statement.js @@ -49,10 +49,11 @@ ParsedStatement.prototype.recordMetrics = function recordMetrics(segment, scope) segment.name = model || operation // Datastore instance metrics. - if (segment.parameters.instance) { - var instanceName = DB.INSTANCE + '/' + thisTypeSlash + segment.parameters.instance - transaction.measure(instanceName, null, duration, exclusive) - } + // This is commented out due to future possible metric name changes. + // if (segment.parameters.instance) { + // var instanceName = DB.INSTANCE + '/' + thisTypeSlash + segment.parameters.instance + // transaction.measure(instanceName, null, duration, exclusive) + // } if (this.raw) { transaction.agent.queries.addQuery( diff --git a/lib/db/tracer.js b/lib/db/tracer.js index e746c92560..2416900b8e 100644 --- a/lib/db/tracer.js +++ b/lib/db/tracer.js @@ -166,18 +166,19 @@ QuerySample.prototype.prepareJSON = function prepareJSON(done) { } QuerySample.prototype.getParams = function getParams() { - var segmentParams = this.trace.segment.parameters + // var segmentParams = this.trace.segment.parameters var params = { backtrace: this.trace.trace, } - if (segmentParams.instance) { - params.instance = segmentParams.instance - } + // XXX: Uncomment this once metric names have been decided on + // if (segmentParams.instance) { + // params.instance = segmentParams.instance + // } - if (segmentParams.database_name) { - params.database_name = segmentParams.database_name - } + // if (segmentParams.database_name) { + // params.database_name = segmentParams.database_name + // } return params } diff --git a/lib/db/utils.js b/lib/db/utils.js index 798d1c1fa2..62a20ec8cc 100644 --- a/lib/db/utils.js +++ b/lib/db/utils.js @@ -6,7 +6,7 @@ var INSTANCE_UNKNOWN = 'unknown' exports.captureInstanceAttributes = captureInstanceAttributes -function captureInstanceAttributes(segment, host, port, database) { +function captureInstanceAttributes(segment, host, port/* , database */) { port = port || INSTANCE_UNKNOWN if (host && urltils.isLocalhost(host)) { host = segment.transaction.agent.config.getHostnameSafe(host) @@ -15,6 +15,7 @@ function captureInstanceAttributes(segment, host, port, database) { host = INSTANCE_UNKNOWN } - segment.parameters.database_name = database || INSTANCE_UNKNOWN - segment.parameters.instance = host + ':{' + port + '}' + // XXX: Uncomment this when metric names have been decided on + // segment.parameters.database_name = database || INSTANCE_UNKNOWN + // segment.parameters.instance = host + ':{' + port + '}' } diff --git a/test/versioned/pg-1/pg.common.js b/test/versioned/pg-1/pg.common.js index ef63de13fd..1a49cb37e9 100644 --- a/test/versioned/pg-1/pg.common.js +++ b/test/versioned/pg-1/pg.common.js @@ -77,23 +77,25 @@ module.exports = function runTests(agent, pg, name) { expected['Datastore/statement/Postgres/' + selectTable + '/select'] = 1 var hostId = METRIC_HOST_NAME + ':{' + params.postgres_port + '}' - expected['Datastore/instance/Postgres/' + hostId] = 2 + // this should be uncommented out when instance metrics are sent up + // expected['Datastore/instance/Postgres/' + hostId] = 2 var slowQuerySamples = agent.queries.samples for (var key in slowQuerySamples) { var queryParams = slowQuerySamples[key].getParams() - t.equal( - queryParams.instance, - hostId, - 'instance data should show up in slow query params' - ) + // XXX: Uncomment once metric names have been decided on + // t.equal( + // queryParams.instance, + // hostId, + // 'instance data should show up in slow query params' + // ) - t.equal( - queryParams.database_name, - params.postgres_db, - 'database name should show up in slow query params' - ) + // t.equal( + // queryParams.database_name, + // params.postgres_db, + // 'database name should show up in slow query params' + // ) t.ok(queryParams.backtrace, 'params should contain a backtrace') } @@ -134,12 +136,13 @@ module.exports = function runTests(agent, pg, name) { t.ok(setSegment, 'trace segment for insert should exist') t.ok(getSegment, 'trace segment for select should exist') - t.equals(setSegment.parameters.instance, hostId, 'should add the instance parameter') - t.equals( - setSegment.parameters.database_name, - params.postgres_db, - 'should add the database name parameter' - ) + // XXX: Uncomment once metric names have been decided on + // t.equals(setSegment.parameters.instance, hostId, 'should add the instance parameter') + // t.equals( + // setSegment.parameters.database_name, + // params.postgres_db, + // 'should add the database name parameter' + // ) if (!getSegment) return t.end() diff --git a/test/versioned/pg-2/pg.common.js b/test/versioned/pg-2/pg.common.js index ef63de13fd..1a49cb37e9 100644 --- a/test/versioned/pg-2/pg.common.js +++ b/test/versioned/pg-2/pg.common.js @@ -77,23 +77,25 @@ module.exports = function runTests(agent, pg, name) { expected['Datastore/statement/Postgres/' + selectTable + '/select'] = 1 var hostId = METRIC_HOST_NAME + ':{' + params.postgres_port + '}' - expected['Datastore/instance/Postgres/' + hostId] = 2 + // this should be uncommented out when instance metrics are sent up + // expected['Datastore/instance/Postgres/' + hostId] = 2 var slowQuerySamples = agent.queries.samples for (var key in slowQuerySamples) { var queryParams = slowQuerySamples[key].getParams() - t.equal( - queryParams.instance, - hostId, - 'instance data should show up in slow query params' - ) + // XXX: Uncomment once metric names have been decided on + // t.equal( + // queryParams.instance, + // hostId, + // 'instance data should show up in slow query params' + // ) - t.equal( - queryParams.database_name, - params.postgres_db, - 'database name should show up in slow query params' - ) + // t.equal( + // queryParams.database_name, + // params.postgres_db, + // 'database name should show up in slow query params' + // ) t.ok(queryParams.backtrace, 'params should contain a backtrace') } @@ -134,12 +136,13 @@ module.exports = function runTests(agent, pg, name) { t.ok(setSegment, 'trace segment for insert should exist') t.ok(getSegment, 'trace segment for select should exist') - t.equals(setSegment.parameters.instance, hostId, 'should add the instance parameter') - t.equals( - setSegment.parameters.database_name, - params.postgres_db, - 'should add the database name parameter' - ) + // XXX: Uncomment once metric names have been decided on + // t.equals(setSegment.parameters.instance, hostId, 'should add the instance parameter') + // t.equals( + // setSegment.parameters.database_name, + // params.postgres_db, + // 'should add the database name parameter' + // ) if (!getSegment) return t.end() diff --git a/test/versioned/pg-3/pg.common.js b/test/versioned/pg-3/pg.common.js index ef63de13fd..1a49cb37e9 100644 --- a/test/versioned/pg-3/pg.common.js +++ b/test/versioned/pg-3/pg.common.js @@ -77,23 +77,25 @@ module.exports = function runTests(agent, pg, name) { expected['Datastore/statement/Postgres/' + selectTable + '/select'] = 1 var hostId = METRIC_HOST_NAME + ':{' + params.postgres_port + '}' - expected['Datastore/instance/Postgres/' + hostId] = 2 + // this should be uncommented out when instance metrics are sent up + // expected['Datastore/instance/Postgres/' + hostId] = 2 var slowQuerySamples = agent.queries.samples for (var key in slowQuerySamples) { var queryParams = slowQuerySamples[key].getParams() - t.equal( - queryParams.instance, - hostId, - 'instance data should show up in slow query params' - ) + // XXX: Uncomment once metric names have been decided on + // t.equal( + // queryParams.instance, + // hostId, + // 'instance data should show up in slow query params' + // ) - t.equal( - queryParams.database_name, - params.postgres_db, - 'database name should show up in slow query params' - ) + // t.equal( + // queryParams.database_name, + // params.postgres_db, + // 'database name should show up in slow query params' + // ) t.ok(queryParams.backtrace, 'params should contain a backtrace') } @@ -134,12 +136,13 @@ module.exports = function runTests(agent, pg, name) { t.ok(setSegment, 'trace segment for insert should exist') t.ok(getSegment, 'trace segment for select should exist') - t.equals(setSegment.parameters.instance, hostId, 'should add the instance parameter') - t.equals( - setSegment.parameters.database_name, - params.postgres_db, - 'should add the database name parameter' - ) + // XXX: Uncomment once metric names have been decided on + // t.equals(setSegment.parameters.instance, hostId, 'should add the instance parameter') + // t.equals( + // setSegment.parameters.database_name, + // params.postgres_db, + // 'should add the database name parameter' + // ) if (!getSegment) return t.end() diff --git a/test/versioned/pg-4/pg.common.js b/test/versioned/pg-4/pg.common.js index ef63de13fd..1a49cb37e9 100644 --- a/test/versioned/pg-4/pg.common.js +++ b/test/versioned/pg-4/pg.common.js @@ -77,23 +77,25 @@ module.exports = function runTests(agent, pg, name) { expected['Datastore/statement/Postgres/' + selectTable + '/select'] = 1 var hostId = METRIC_HOST_NAME + ':{' + params.postgres_port + '}' - expected['Datastore/instance/Postgres/' + hostId] = 2 + // this should be uncommented out when instance metrics are sent up + // expected['Datastore/instance/Postgres/' + hostId] = 2 var slowQuerySamples = agent.queries.samples for (var key in slowQuerySamples) { var queryParams = slowQuerySamples[key].getParams() - t.equal( - queryParams.instance, - hostId, - 'instance data should show up in slow query params' - ) + // XXX: Uncomment once metric names have been decided on + // t.equal( + // queryParams.instance, + // hostId, + // 'instance data should show up in slow query params' + // ) - t.equal( - queryParams.database_name, - params.postgres_db, - 'database name should show up in slow query params' - ) + // t.equal( + // queryParams.database_name, + // params.postgres_db, + // 'database name should show up in slow query params' + // ) t.ok(queryParams.backtrace, 'params should contain a backtrace') } @@ -134,12 +136,13 @@ module.exports = function runTests(agent, pg, name) { t.ok(setSegment, 'trace segment for insert should exist') t.ok(getSegment, 'trace segment for select should exist') - t.equals(setSegment.parameters.instance, hostId, 'should add the instance parameter') - t.equals( - setSegment.parameters.database_name, - params.postgres_db, - 'should add the database name parameter' - ) + // XXX: Uncomment once metric names have been decided on + // t.equals(setSegment.parameters.instance, hostId, 'should add the instance parameter') + // t.equals( + // setSegment.parameters.database_name, + // params.postgres_db, + // 'should add the database name parameter' + // ) if (!getSegment) return t.end()