Skip to content

Commit

Permalink
[pinpoint-apm#125] Support SQL_ID AnnotationKey
Browse files Browse the repository at this point in the history
  • Loading branch information
feelform committed Mar 6, 2023
1 parent d4aa03f commit 09091bf
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 48 deletions.
3 changes: 3 additions & 0 deletions lib/constant/annotation-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const AnnotationKeyProperty = require('./annotation').AnnotationKeyProperty
const DefaultAnnotationKey = {
API: new AnnotationKey(12, 'API'),
API_METADATA: new AnnotationKey(13, 'API-METADATA'),

SQL_ID: new AnnotationKey(20, "SQL-ID"),

HTTP_URL: new AnnotationKey(40, 'http.url'),
HTTP_PARAM: new AnnotationKey(41, 'http.param', AnnotationKeyProperty.VIEW_IN_RECORD_SET),
HTTP_STATUS_CODE: new AnnotationKey(46, 'http.status.code'),
Expand Down
85 changes: 38 additions & 47 deletions lib/instrumentation/module/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,55 +9,37 @@
const semver = require('semver')
const shimmer = require('shimmer')
const ServiceTypeCode = require('../../constant/service-type').ServiceTypeCode
const IdGenerator = require('../../context/id-generator')
const log = require('../../utils/logger')
const DefaultAnnotationKey = require('../../constant/annotation-key').DefaultAnnotationKey

// https://github.com/elastic/apm-agent-nodejs/blob/master/lib/instrumentation/modules/mysql.js
module.exports = function(agent, version, mysql) {
module.exports = function (agent, version, mysql) {
if (!semver.satisfies(version, '^2.0.0')) {
log.debug('mysql version %s not supported - aborting...', version)
return mysql
}

log.debug('shimming mysql.createPool')
shimmer.wrap(mysql, 'createPool', wrapCreatePool)

log.debug('shimming mysql.createPoolCluster')
shimmer.wrap(mysql, 'createPoolCluster', wrapCreatePoolCluster)

log.debug('shimming mysql.createConnection')
shimmer.wrap(mysql, 'createConnection', wrapCreateConnection)

return mysql


function wrapCreateConnection (original) {
return function wrappedCreateConnection () {
const connection = original.apply(this, arguments)

wrapQueryable(connection, 'connection', agent)

return connection
}
}

function wrapCreatePool (original) {
return function wrappedCreatePool () {
shimmer.wrap(mysql, 'createPool', function (original) {
return function wrappedCreatePool() {
const pool = original.apply(this, arguments)

log.debug('shimming mysql pool.getConnection')
shimmer.wrap(pool, 'getConnection', wrapGetConnection)

return pool
}
}
})

function wrapCreatePoolCluster (original) {
return function wrappedCreatePoolCluster () {
log.debug('shimming mysql.createPoolCluster')
shimmer.wrap(mysql, 'createPoolCluster', function (original) {
return function wrappedCreatePoolCluster() {
const cluster = original.apply(this, arguments)

log.debug('shimming mysql cluster.of')
shimmer.wrap(cluster, 'of', function wrapOf (original) {
return function wrappedOf () {
shimmer.wrap(cluster, 'of', function wrapOf(original) {
return function wrappedOf() {
const ofCluster = original.apply(this, arguments)

log.debug('shimming mysql cluster of.getConnection')
Expand All @@ -69,15 +51,26 @@ module.exports = function(agent, version, mysql) {
return cluster
}
}
)

function wrapGetConnection (original) {
return function wrappedGetConnection () {
log.debug('shimming mysql.createConnection')
shimmer.wrap(mysql, 'createConnection', function (original) {
return function wrappedCreateConnection() {
const connection = original.apply(this, arguments)
wrapQueryable(connection, 'connection', agent)
return connection
}
})

return mysql

function wrapGetConnection(original) {
return function wrappedGetConnection() {
const cb = arguments[0]

if (typeof cb === 'function') {
arguments[0] = function bindFunction() {
return function wrapedCallback (err, connection) {
// eslint-disable-line handle-callback-err
return function wrapperCallback(err, connection) {
if (connection) wrapQueryable(connection, 'getConnection() > connection', agent)
return cb.apply(this, arguments)
}
Expand All @@ -87,12 +80,12 @@ module.exports = function(agent, version, mysql) {
}
}

function wrapQueryable (obj, objType, agent) {
function wrapQueryable(obj, objType, agent) {
log.debug('shimming mysql %s.query', objType)
shimmer.wrap(obj, 'query', wrapQuery)

function wrapQuery (original) {
return function wrappedQuery (sql, values, cb) {
function wrapQuery(original) {
return function wrappedQuery(sql, values, cb) {
let hasCallback = false
let sqlStr

Expand All @@ -102,7 +95,7 @@ module.exports = function(agent, version, mysql) {
if (trace) {
spanEventRecorder = trace.traceBlockBegin()
spanEventRecorder.recordServiceType(ServiceTypeCode.ASYNC_HTTP_CLIENT_INTERNAL)
spanEventRecorder.recordApiDesc('mysql.'+ String(sql).toUpperCase()+'.call' )
spanEventRecorder.recordApiDesc('mysql.' + String(sql).toUpperCase() + '.call')
trace.traceBlockEnd(spanEventRecorder)

switch (typeof sql) {
Expand All @@ -127,9 +120,9 @@ module.exports = function(agent, version, mysql) {
asyncEventRecorder.recordApiDesc(`mysql.${objType}.query `)
asyncEventRecorder.recordNextSpanId(nextSpanId)

if (sqlStr) { // TODO. this point
asyncEventRecorder.recordApiArguments(EventAnnotationKey.MONGO_JSON_DATA,
convertUtils.convertStringStringValue(sqlStr), ValueType.stringStringValue)
if (sqlStr) {
const intStringStringValue = null
asyncEventRecorder.recordApiArguments(DefaultAnnotationKey.SQL_ID, intStringStringValue)
}

if (typeof values === 'function') {
Expand All @@ -156,18 +149,16 @@ module.exports = function(agent, version, mysql) {

return result

function wrapCallback (cb) {
function wrapCallback(cb) {
hasCallback = true
return function wrappedCallback () {
if (trace) {
trace.traceAsyncEnd(asyncEventRecorder)
return function wrappedCallback() {
if (asyncTrace) {
asyncTrace.traceAsyncEnd(asyncEventRecorder)
}
return cb.apply(this, arguments)
}
}
}
}
}


}
}
26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
"shimmer": "^1.2.0"
},
"devDependencies": {
"@types/semver": "^7.3.13",
"@types/shimmer": "^1.0.2",
"axios": "^0.21.1",
"elasticsearch": "^15.4.1",
"eslint": "^8.30.0",
Expand Down
28 changes: 27 additions & 1 deletion test/instrumentation/module/mysql.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,33 @@ const path = require('path')
const agent = require('../../support/agent-singleton-mock')
const mysql = require('mysql')

/**
0 = {SpanEvent@16605} "SpanEvent{stackId=-1, timeRecording=true, startTime=1678085203418, elapsedTime=0, asyncIdObject=null, sequence=0, serviceType=1011, endPoint='null', annotations=null, depth=1, nextSpanId=-1, destinationId='null', apiId=3, exceptionInfo=null} "
1 = {SpanEvent@16606} "SpanEvent{stackId=-1, timeRecording=true, startTime=1678085204583, elapsedTime=0, asyncIdObject=null, sequence=1, serviceType=5051, endPoint='null', annotations=null, depth=2, nextSpanId=-1, destinationId='null', apiId=0, exceptionInfo=null} "
2 = {SpanEvent@16607} "SpanEvent{stackId=-1, timeRecording=true, startTime=1678085205823, elapsedTime=0, asyncIdObject=null, sequence=2, serviceType=5071, endPoint='null', annotations=null, depth=3, nextSpanId=-1, destinationId='null', apiId=0, exceptionInfo=null} "
0 = {SpanEvent@16605} "SpanEvent{stackId=-1, timeRecording=true, startTime=1678085203418, elapsedTime=0, asyncIdObject=null, sequence=0, serviceType=1011, endPoint='null', annotations=null, depth=1, nextSpanId=-1, destinationId='null', apiId=3, exceptionInfo=null} "
1 = {SpanEvent@16606} "SpanEvent{stackId=-1, timeRecording=true, startTime=1678085204583, elapsedTime=0, asyncIdObject=null, sequence=1, serviceType=5051, endPoint='null', annotations=null, depth=2, nextSpanId=-1, destinationId='null', apiId=0, exceptionInfo=null} "
2 = {SpanEvent@16607} "SpanEvent{stackId=-1, timeRecording=true, startTime=1678085205823, elapsedTime=0, asyncIdObject=null, sequence=2, serviceType=5071, endPoint='null', annotations=null, depth=3, nextSpanId=-1, destinationId='null', apiId=0, exceptionInfo=null} "
3 = {SpanEvent@17781} "SpanEvent{stackId=-1, timeRecording=true, startTime=1678085347720, elapsedTime=0, asyncIdObject=null, sequence=3, serviceType=0, endPoint='null', annotations=null, depth=4, nextSpanId=-1, destinationId='null', apiId=0, exceptionInfo=null} "
0 = {SpanEvent@16605} "SpanEvent{stackId=-1, timeRecording=true, startTime=1678085203418, elapsedTime=0, asyncIdObject=null, sequence=0, serviceType=1011, endPoint='null', annotations=null, depth=1, nextSpanId=-1, destinationId='null', apiId=3, exceptionInfo=null} "
1 = {SpanEvent@16606} "SpanEvent{stackId=-1, timeRecording=true, startTime=1678085204583, elapsedTime=0, asyncIdObject=null, sequence=1, serviceType=5051, endPoint='null', annotations=null, depth=2, nextSpanId=-1, destinationId='null', apiId=0, exceptionInfo=null} "
2 = {SpanEvent@16607} "SpanEvent{stackId=-1, timeRecording=true, startTime=1678085205823, elapsedTime=0, asyncIdObject=null, sequence=2, serviceType=5071, endPoint='null', annotations=null, depth=3, nextSpanId=-1, destinationId='null', apiId=0, exceptionInfo=null} "
3 = {SpanEvent@17781} "SpanEvent{stackId=-1, timeRecording=true, startTime=1678085347720, elapsedTime=0, asyncIdObject=null, sequence=3, serviceType=0, endPoint='null', annotations=null, depth=4, nextSpanId=-1, destinationId='null', apiId=0, exceptionInfo=null} "
4 = {SpanEvent@18051} "SpanEvent{stackId=-1, timeRecording=true, startTime=1678085406682, elapsedTime=0, asyncIdObject=null, sequence=4, serviceType=0, endPoint='null', annotations=null, depth=5, nextSpanId=-1, destinationId='null', apiId=0, exceptionInfo=null} "
{
host: "localhost",
port: 49162,
database: "test",
user: "af7bcd28d3xxxxxxz",
password: "xxxxxx",
}
*/
const fixtures = path.resolve(__dirname, '..', '..', 'fixtures', 'db')
test(`SELECT query hooking`, async (t) => {
test(`getConnection query hooking`, async (t) => {
agent.bindHttp()
const source = path.resolve(fixtures, 'mysql.sql')
const container = await new MySqlContainer()
Expand All @@ -26,6 +51,7 @@ test(`SELECT query hooking`, async (t) => {
}])
.start()

agent.createTraceObject()
const connection = mysql.createConnection({
host: container.getHost(),
port: container.getPort(),
Expand Down

3 comments on commit 09091bf

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

76.60%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
lib
   agent.js74.70%62.50%75%78.18%130, 130, 130–134, 136, 140, 142–143, 29–32, 57–58, 79
   config.js87.31%85%100%85.32%107, 118–121, 124–127, 130–133, 178–179, 197–199, 203, 206, 210–211, 217, 239, 249
   supports.js21.74%0%16.67%30.77%14, 14, 14–15, 18, 18, 18–19, 22, 25, 28, 31, 35
lib/client
   data-sender-factory.js100%100%100%100%
   data-sender.js49.15%36.36%42.86%60%24, 28, 28, 28–29, 39, 41, 41, 41–43, 43, 43–44, 49, 49, 49–50, 55, 55, 55–56, 61, 61, 61–62
   grpc-bidirectional-stream.js53.33%31.58%71.43%68.42%17, 17, 17, 17, 17, 17–18, 22, 22–23, 27, 27, 27–28, 32, 32, 32–33, 41
   grpc-client-side-stream.js73.13%57.14%87.50%83.87%22–23, 25–27, 38, 38, 38, 38, 38, 38–39, 43, 43, 43–44, 65
   grpc-data-sender.js75%56.90%88%81.65%117, 126, 126, 126–127, 144, 152–153, 159, 173, 173, 173, 173, 173–174, 187, 187, 187, 187, 187–188, 196–197, 201, 201, 201, 201, 201–202, 208–209, 209, 209–210, 212, 216–217, 217, 217–218, 220, 81–82, 90–91
   grpc-stream.js95.18%88.89%100%97.83%37–38, 78, 96
   grpc-unary-rpc.js97.44%90.91%100%100%36
   pinpoint-client.js58.33%100%33.33%66.67%20, 23, 27
lib/constant
   annotation-key.js100%100%100%100%
   annotation.js100%100%100%100%
   commaned-type.js100%100%100%100%
   http-header.js100%100%100%100%
   method-descriptor.js100%100%100%100%
   method-type.js100%100%100%100%
   service-type.js100%100%100%100%
   valued-type.js100%100%100%100%
lib/context
   annotation-key-utils.js23.08%9.09%100%28.57%14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36
   annotation-key.js94.74%66.67%100%100%21
   annotation.js100%100%100%100%
   api-meta-service.js93.75%75%100%97.06%30, 45, 64
   async-id-accessor.js71.43%100%50%80%10
   async-id.js100%100%100%100%
   async-method-descriptor.js100%100%100%100%
   async-trace.js91.67%75%83.33%94.74%53, 66–67
   buffered-storage.js93.88%76.92%100%100%23, 34, 63
   context-manager.js94.44%75%100%100%15, 28
   disable-async-trace.js25%100%0%50%13, 21
   disable-span-event-recorder.js30%0%18.75%50%36, 36, 36–38, 40, 42, 70
   disable-trace.js43.75%0%44.44%62.50%33, 33, 33–35, 40, 40, 40–41, 50, 50, 50, 50
   express-method-descriptor-builder.js33.33%20%100%40%11–12, 15–16, 16, 16, 16, 16–17, 17, 17–18, 20, 22
   id-generator.js100%100%100%100%
   koa-method-descriptor-builder.js71.43%50%100%75%11–12
   make-method-descriptor-builder.js91.15%86.36%100%93.22%16, 22, 25, 29, 40–41, 64–65, 86–87
   method-descriptor-builder.js82.38%85.53%75%82.35%109, 118, 127, 137–138, 145–146, 148, 148–149, 157–158, 205–206, 209–210, 28, 31, 45, 52–53, 72, 76, 80–81, 85–86, 95–96
   method-descriptor.js91.11%100%84.62%92.31%43, 47
   sequence-generator.js86.67%75%100%87.50%17–18
   sequence-generators.js100%100%100%100%
   service-type.js75%40%100%80%24, 26, 26, 31–32, 37–38
   span-chunk.js91.53%70%100%95%15–16, 58, 68–69
   span-event-recorder.js62.22%50.85%72.22%70.69%101, 108, 114, 114, 114, 114, 114–116, 121, 128, 128, 128, 128, 128–129, 129, 129–130, 130, 130, 130, 130–131, 135, 135, 135, 135, 135–137, 143, 27, 31, 37, 43, 49, 55–56, 61, 65, 71, 78–81
   span-event.js92.31%80%100%96%10–11, 36
   span-events.js95.56%87.50%100%96.67%22, 25
   span-recorder.js64.56%56.10%80%71.43%19, 25, 31–34, 43, 49, 55, 61, 67, 67, 67, 67, 67–68, 68, 68–69, 73, 78, 78, 78, 78, 78–79
   span.js94.67%72.73%100%98.31%15–16, 46, 61
   string-meta-service.js34.48%0%50%38.10%25, 25, 25, 27–28, 28, 28–33, 35, 39–40, 42, 44
   trace-context.js93.48%91.30%100%93.22%105, 34–35, 76–77, 92
   trace-id.js100%100%100%100%
   trace.js63.11%41.38%75%70.97%100, 102–103, 107, 107, 107, 107, 107, 109–111, 119, 119, 119, 119, 52–53, 57–59, 62, 64, 67–68, 68, 68, 68, 68–70, 84, 91, 97–99
   transaction-id.js88.89%80%100%92.86%30, 32, 36
lib/data
   grpc-data-convertor.js59.79%50.85%65.22%61.81%107–108, 118–119, 130, 130, 130, 130, 130–131, 136, 136, 136–137, 139–148, 150–151, 155–156, 16, 164–165, 17, 181–182, 191–192, 198, 198, 198–199, 201, 203–205, 207–210, 214, 217–218, 220–223, 239, 241–242, 242, 242, 242, 242, 242–243, 246–247, 251–252, 289–290, 32–33, 51–52, 61, 61, 61–62, 64–67, 69, 69, 69–71, 74–85, 87–88, 90–91, 95–96
   typed-value.js53.33%40%66.67%59.26%15, 15, 15, 20–21, 26, 26, 26–27, 29, 31–32, 37, 45–47, 49, 49, 49–50
lib/data/dto
   agent-info.js95.24%0%100%100%14
   api-meta-info.js95.65%88.89%100%100%10
   string-meta-info.js85.71%0%100%100%10
lib/instrumentation
   http-shared.js79.01%64.15%92.31%85.42%109–110, 140, 143, 143, 143–144, 144, 144–145, 147, 147, 147–148, 150, 158, 37, 40–41, 56, 67–68, 68, 68, 68, 68–69, 69, 69–70, 72, 74, 91
   module-hook.js82.46%66.67%100%83.33%37, 42, 50–51, 54, 67, 93, 93, 93–94
   request-data.js100%100%100%100%
   request-header-utils.js87.63%74.19%100%93.33%19–20, 29, 35, 51, 53, 58, 73–74, 84–85, 89
lib/instrumentation/module
   express.js45.45%28.17%63.16%52.94%100, 102, 106, 106, 106–112, 112, 112, 112, 112–113, 115, 117–118, 118, 118–119, 121, 128–131, 131, 131–135, 135, 135–136, 136, 136–137, 139, 142–143, 143, 143–144, 146, 152, 152, 152–153, 163, 163, 163–164, 168, 168, 168–169, 171, 171, 171–172, 174, 174, 174, 174, 174–176, 178, 182, 182, 182–183, 185, 189, 192, 197, 200, 27–29, 32–33, 48, 48, 48–49, 53, 53, 53, 60, 60, 60, 60–62, 62, 62, 71, 80, 87, 96–97, 99, 99, 99
   http.js100%100%100%100%
   https.js94.12%80%100%100%19
   koa-router.js19.75%4.17%40%25%19–21, 26, 28, 28, 28–29, 32, 34, 34, 34, 34, 34–35, 38–40, 40, 40–41, 44–47, 47, 47–49, 51–52, 52, 52–55, 57, 59, 59, 59–63, 65, 67, 67, 67–68, 71, 73, 81, 81, 81, 81, 81–83, 83, 83–84, 86
   redis.js89.86%76.19%100%95.35%17–19, 32, 34, 53, 65
lib/metric
   active-trace-histogram.js6.90%0%0%11.76%13, 13, 13–18, 22, 22, 22–23, 26, 26, 26–28, 28, 28–30, 30, 30–31, 33
   active-trace.js65.45%64.29%57.14%67.65%26–27, 46–47, 51, 53, 53, 53–54, 57–58, 58, 58–60, 63
   agent-stats-monitor.js14.29%0%0%21.05%15–18, 22, 26, 26, 26–27, 29–31, 33–35, 38, 44
   histogram-schema.js100%100%100%100%
   ping-scheduler.js12.50%0%0%18.18%12–15, 17–18, 22, 22, 22–23, 25
   resource-stats-collector.js20%25%0%25%10, 18–19, 23, 30–31, 38–39, 41–45, 47, 47, 47, 49, 51
   v8-compatibility.js95.24%100%100%92.86%21
lib/sampler
   sampler.js60.87%37.50%100%69.23%17, 20, 20, 20–21, 21, 21–22, 24
   sampling-flag.js55.56%16.67%100%70%16, 20, 20, 20, 20, 20–21, 23
lib/utils
   ant-path-matcher.js84.59%79.82%86.36%87.36%107, 107, 109, 124, 126–127, 127, 127–128, 131, 166–167, 175–176, 219, 225, 237–238, 242, 252, 257, 272, 276, 302, 304, 307–311, 324, 330–331, 335, 42–44, 55, 55, 55, 55, 55–56, 58, 92–93
   convert-utils.js47.37%25%50%66.67%10–11, 11–12, 12, 17–18, 21–22
   logger.js73.17%60%88.89%72.73%25, 25, 25–27, 29, 37–38, 48–49
   scheduler.js78.85%64.29%90.91%81.48%15, 22–24, 26–27, 50–52, 60
   simple-cache.js66.67%68.75%55.56%69.57%30, 32–33, 40–41, 41, 41–43, 48, 53, 57
   string-utils.js66.67%100%0%100%
lib/utils/log
   log-level-logger.js42.86%100%20%55.56%18, 21, 24, 27
   logger-output-adaptor.js5.66%0%16.67%8%15, 19, 19, 19, 19, 19–20, 20, 20–21, 23, 25, 27, 31, 31, 31, 31, 31–32, 32, 32–33, 35, 37, 39, 43, 43, 43, 43, 43–44, 44, 44–45, 47, 49, 51, 55, 55, 55, 55, 55–57, 59
   logger2.js53.03%50%48.15%57.14%103, 107, 111–112, 123, 127, 19, 36, 40, 44, 48, 60, 64, 68, 72, 76, 80

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

76.60%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
lib
   agent.js74.70%62.50%75%78.18%130, 130, 130–134, 136, 140, 142–143, 29–32, 57–58, 79
   config.js87.31%85%100%85.32%107, 118–121, 124–127, 130–133, 178–179, 197–199, 203, 206, 210–211, 217, 239, 249
   supports.js21.74%0%16.67%30.77%14, 14, 14–15, 18, 18, 18–19, 22, 25, 28, 31, 35
lib/client
   data-sender-factory.js100%100%100%100%
   data-sender.js49.15%36.36%42.86%60%24, 28, 28, 28–29, 39, 41, 41, 41–43, 43, 43–44, 49, 49, 49–50, 55, 55, 55–56, 61, 61, 61–62
   grpc-bidirectional-stream.js53.33%31.58%71.43%68.42%17, 17, 17, 17, 17, 17–18, 22, 22–23, 27, 27, 27–28, 32, 32, 32–33, 41
   grpc-client-side-stream.js73.13%57.14%87.50%83.87%22–23, 25–27, 38, 38, 38, 38, 38, 38–39, 43, 43, 43–44, 65
   grpc-data-sender.js75%56.90%88%81.65%117, 126, 126, 126–127, 144, 152–153, 159, 173, 173, 173, 173, 173–174, 187, 187, 187, 187, 187–188, 196–197, 201, 201, 201, 201, 201–202, 208–209, 209, 209–210, 212, 216–217, 217, 217–218, 220, 81–82, 90–91
   grpc-stream.js95.18%88.89%100%97.83%37–38, 78, 96
   grpc-unary-rpc.js97.44%90.91%100%100%36
   pinpoint-client.js58.33%100%33.33%66.67%20, 23, 27
lib/constant
   annotation-key.js100%100%100%100%
   annotation.js100%100%100%100%
   commaned-type.js100%100%100%100%
   http-header.js100%100%100%100%
   method-descriptor.js100%100%100%100%
   method-type.js100%100%100%100%
   service-type.js100%100%100%100%
   valued-type.js100%100%100%100%
lib/context
   annotation-key-utils.js23.08%9.09%100%28.57%14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36
   annotation-key.js94.74%66.67%100%100%21
   annotation.js100%100%100%100%
   api-meta-service.js93.75%75%100%97.06%30, 45, 64
   async-id-accessor.js71.43%100%50%80%10
   async-id.js100%100%100%100%
   async-method-descriptor.js100%100%100%100%
   async-trace.js91.67%75%83.33%94.74%53, 66–67
   buffered-storage.js93.88%76.92%100%100%23, 34, 63
   context-manager.js94.44%75%100%100%15, 28
   disable-async-trace.js25%100%0%50%13, 21
   disable-span-event-recorder.js30%0%18.75%50%36, 36, 36–38, 40, 42, 70
   disable-trace.js43.75%0%44.44%62.50%33, 33, 33–35, 40, 40, 40–41, 50, 50, 50, 50
   express-method-descriptor-builder.js33.33%20%100%40%11–12, 15–16, 16, 16, 16, 16–17, 17, 17–18, 20, 22
   id-generator.js100%100%100%100%
   koa-method-descriptor-builder.js71.43%50%100%75%11–12
   make-method-descriptor-builder.js91.15%86.36%100%93.22%16, 22, 25, 29, 40–41, 64–65, 86–87
   method-descriptor-builder.js82.38%85.53%75%82.35%109, 118, 127, 137–138, 145–146, 148, 148–149, 157–158, 205–206, 209–210, 28, 31, 45, 52–53, 72, 76, 80–81, 85–86, 95–96
   method-descriptor.js91.11%100%84.62%92.31%43, 47
   sequence-generator.js86.67%75%100%87.50%17–18
   sequence-generators.js100%100%100%100%
   service-type.js75%40%100%80%24, 26, 26, 31–32, 37–38
   span-chunk.js91.53%70%100%95%15–16, 58, 68–69
   span-event-recorder.js62.22%50.85%72.22%70.69%101, 108, 114, 114, 114, 114, 114–116, 121, 128, 128, 128, 128, 128–129, 129, 129–130, 130, 130, 130, 130–131, 135, 135, 135, 135, 135–137, 143, 27, 31, 37, 43, 49, 55–56, 61, 65, 71, 78–81
   span-event.js92.31%80%100%96%10–11, 36
   span-events.js95.56%87.50%100%96.67%22, 25
   span-recorder.js64.56%56.10%80%71.43%19, 25, 31–34, 43, 49, 55, 61, 67, 67, 67, 67, 67–68, 68, 68–69, 73, 78, 78, 78, 78, 78–79
   span.js94.67%72.73%100%98.31%15–16, 46, 61
   string-meta-service.js34.48%0%50%38.10%25, 25, 25, 27–28, 28, 28–33, 35, 39–40, 42, 44
   trace-context.js93.48%91.30%100%93.22%105, 34–35, 76–77, 92
   trace-id.js100%100%100%100%
   trace.js63.11%41.38%75%70.97%100, 102–103, 107, 107, 107, 107, 107, 109–111, 119, 119, 119, 119, 52–53, 57–59, 62, 64, 67–68, 68, 68, 68, 68–70, 84, 91, 97–99
   transaction-id.js88.89%80%100%92.86%30, 32, 36
lib/data
   grpc-data-convertor.js59.79%50.85%65.22%61.81%107–108, 118–119, 130, 130, 130, 130, 130–131, 136, 136, 136–137, 139–148, 150–151, 155–156, 16, 164–165, 17, 181–182, 191–192, 198, 198, 198–199, 201, 203–205, 207–210, 214, 217–218, 220–223, 239, 241–242, 242, 242, 242, 242, 242–243, 246–247, 251–252, 289–290, 32–33, 51–52, 61, 61, 61–62, 64–67, 69, 69, 69–71, 74–85, 87–88, 90–91, 95–96
   typed-value.js53.33%40%66.67%59.26%15, 15, 15, 20–21, 26, 26, 26–27, 29, 31–32, 37, 45–47, 49, 49, 49–50
lib/data/dto
   agent-info.js95.24%0%100%100%14
   api-meta-info.js95.65%88.89%100%100%10
   string-meta-info.js85.71%0%100%100%10
lib/instrumentation
   http-shared.js79.01%64.15%92.31%85.42%109–110, 140, 143, 143, 143–144, 144, 144–145, 147, 147, 147–148, 150, 158, 37, 40–41, 56, 67–68, 68, 68, 68, 68–69, 69, 69–70, 72, 74, 91
   module-hook.js82.46%66.67%100%83.33%37, 42, 50–51, 54, 67, 93, 93, 93–94
   request-data.js100%100%100%100%
   request-header-utils.js87.63%74.19%100%93.33%19–20, 29, 35, 51, 53, 58, 73–74, 84–85, 89
lib/instrumentation/module
   express.js45.45%28.17%63.16%52.94%100, 102, 106, 106, 106–112, 112, 112, 112, 112–113, 115, 117–118, 118, 118–119, 121, 128–131, 131, 131–135, 135, 135–136, 136, 136–137, 139, 142–143, 143, 143–144, 146, 152, 152, 152–153, 163, 163, 163–164, 168, 168, 168–169, 171, 171, 171–172, 174, 174, 174, 174, 174–176, 178, 182, 182, 182–183, 185, 189, 192, 197, 200, 27–29, 32–33, 48, 48, 48–49, 53, 53, 53, 60, 60, 60, 60–62, 62, 62, 71, 80, 87, 96–97, 99, 99, 99
   http.js100%100%100%100%
   https.js94.12%80%100%100%19
   koa-router.js19.75%4.17%40%25%19–21, 26, 28, 28, 28–29, 32, 34, 34, 34, 34, 34–35, 38–40, 40, 40–41, 44–47, 47, 47–49, 51–52, 52, 52–55, 57, 59, 59, 59–63, 65, 67, 67, 67–68, 71, 73, 81, 81, 81, 81, 81–83, 83, 83–84, 86
   redis.js89.86%76.19%100%95.35%17–19, 32, 34, 53, 65
lib/metric
   active-trace-histogram.js6.90%0%0%11.76%13, 13, 13–18, 22, 22, 22–23, 26, 26, 26–28, 28, 28–30, 30, 30–31, 33
   active-trace.js65.45%64.29%57.14%67.65%26–27, 46–47, 51, 53, 53, 53–54, 57–58, 58, 58–60, 63
   agent-stats-monitor.js14.29%0%0%21.05%15–18, 22, 26, 26, 26–27, 29–31, 33–35, 38, 44
   histogram-schema.js100%100%100%100%
   ping-scheduler.js12.50%0%0%18.18%12–15, 17–18, 22, 22, 22–23, 25
   resource-stats-collector.js20%25%0%25%10, 18–19, 23, 30–31, 38–39, 41–45, 47, 47, 47, 49, 51
   v8-compatibility.js95.24%100%100%92.86%21
lib/sampler
   sampler.js60.87%37.50%100%69.23%17, 20, 20, 20–21, 21, 21–22, 24
   sampling-flag.js55.56%16.67%100%70%16, 20, 20, 20, 20, 20–21, 23
lib/utils
   ant-path-matcher.js84.59%79.82%86.36%87.36%107, 107, 109, 124, 126–127, 127, 127–128, 131, 166–167, 175–176, 219, 225, 237–238, 242, 252, 257, 272, 276, 302, 304, 307–311, 324, 330–331, 335, 42–44, 55, 55, 55, 55, 55–56, 58, 92–93
   convert-utils.js47.37%25%50%66.67%10–11, 11–12, 12, 17–18, 21–22
   logger.js73.17%60%88.89%72.73%25, 25, 25–27, 29, 37–38, 48–49
   scheduler.js78.85%64.29%90.91%81.48%15, 22–24, 26–27, 50–52, 60
   simple-cache.js66.67%68.75%55.56%69.57%30, 32–33, 40–41, 41, 41–43, 48, 53, 57
   string-utils.js66.67%100%0%100%
lib/utils/log
   log-level-logger.js42.86%100%20%55.56%18, 21, 24, 27
   logger-output-adaptor.js5.66%0%16.67%8%15, 19, 19, 19, 19, 19–20, 20, 20–21, 23, 25, 27, 31, 31, 31, 31, 31–32, 32, 32–33, 35, 37, 39, 43, 43, 43, 43, 43–44, 44, 44–45, 47, 49, 51, 55, 55, 55, 55, 55–57, 59
   logger2.js53.03%50%48.15%57.14%103, 107, 111–112, 123, 127, 19, 36, 40, 44, 48, 60, 64, 68, 72, 76, 80

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

76.60%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
lib
   agent.js74.70%62.50%75%78.18%130, 130, 130–134, 136, 140, 142–143, 29–32, 57–58, 79
   config.js87.31%85%100%85.32%107, 118–121, 124–127, 130–133, 178–179, 197–199, 203, 206, 210–211, 217, 239, 249
   supports.js21.74%0%16.67%30.77%14, 14, 14–15, 18, 18, 18–19, 22, 25, 28, 31, 35
lib/client
   data-sender-factory.js100%100%100%100%
   data-sender.js49.15%36.36%42.86%60%24, 28, 28, 28–29, 39, 41, 41, 41–43, 43, 43–44, 49, 49, 49–50, 55, 55, 55–56, 61, 61, 61–62
   grpc-bidirectional-stream.js53.33%31.58%71.43%68.42%17, 17, 17, 17, 17, 17–18, 22, 22–23, 27, 27, 27–28, 32, 32, 32–33, 41
   grpc-client-side-stream.js73.13%57.14%87.50%83.87%22–23, 25–27, 38, 38, 38, 38, 38, 38–39, 43, 43, 43–44, 65
   grpc-data-sender.js75%56.90%88%81.65%117, 126, 126, 126–127, 144, 152–153, 159, 173, 173, 173, 173, 173–174, 187, 187, 187, 187, 187–188, 196–197, 201, 201, 201, 201, 201–202, 208–209, 209, 209–210, 212, 216–217, 217, 217–218, 220, 81–82, 90–91
   grpc-stream.js95.18%88.89%100%97.83%37–38, 78, 96
   grpc-unary-rpc.js97.44%90.91%100%100%36
   pinpoint-client.js58.33%100%33.33%66.67%20, 23, 27
lib/constant
   annotation-key.js100%100%100%100%
   annotation.js100%100%100%100%
   commaned-type.js100%100%100%100%
   http-header.js100%100%100%100%
   method-descriptor.js100%100%100%100%
   method-type.js100%100%100%100%
   service-type.js100%100%100%100%
   valued-type.js100%100%100%100%
lib/context
   annotation-key-utils.js23.08%9.09%100%28.57%14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36
   annotation-key.js94.74%66.67%100%100%21
   annotation.js100%100%100%100%
   api-meta-service.js93.75%75%100%97.06%30, 45, 64
   async-id-accessor.js71.43%100%50%80%10
   async-id.js100%100%100%100%
   async-method-descriptor.js100%100%100%100%
   async-trace.js91.67%75%83.33%94.74%53, 66–67
   buffered-storage.js93.88%76.92%100%100%23, 34, 63
   context-manager.js94.44%75%100%100%15, 28
   disable-async-trace.js25%100%0%50%13, 21
   disable-span-event-recorder.js30%0%18.75%50%36, 36, 36–38, 40, 42, 70
   disable-trace.js43.75%0%44.44%62.50%33, 33, 33–35, 40, 40, 40–41, 50, 50, 50, 50
   express-method-descriptor-builder.js33.33%20%100%40%11–12, 15–16, 16, 16, 16, 16–17, 17, 17–18, 20, 22
   id-generator.js100%100%100%100%
   koa-method-descriptor-builder.js71.43%50%100%75%11–12
   make-method-descriptor-builder.js91.15%86.36%100%93.22%16, 22, 25, 29, 40–41, 64–65, 86–87
   method-descriptor-builder.js82.38%85.53%75%82.35%109, 118, 127, 137–138, 145–146, 148, 148–149, 157–158, 205–206, 209–210, 28, 31, 45, 52–53, 72, 76, 80–81, 85–86, 95–96
   method-descriptor.js91.11%100%84.62%92.31%43, 47
   sequence-generator.js86.67%75%100%87.50%17–18
   sequence-generators.js100%100%100%100%
   service-type.js75%40%100%80%24, 26, 26, 31–32, 37–38
   span-chunk.js91.53%70%100%95%15–16, 58, 68–69
   span-event-recorder.js62.22%50.85%72.22%70.69%101, 108, 114, 114, 114, 114, 114–116, 121, 128, 128, 128, 128, 128–129, 129, 129–130, 130, 130, 130, 130–131, 135, 135, 135, 135, 135–137, 143, 27, 31, 37, 43, 49, 55–56, 61, 65, 71, 78–81
   span-event.js92.31%80%100%96%10–11, 36
   span-events.js95.56%87.50%100%96.67%22, 25
   span-recorder.js64.56%56.10%80%71.43%19, 25, 31–34, 43, 49, 55, 61, 67, 67, 67, 67, 67–68, 68, 68–69, 73, 78, 78, 78, 78, 78–79
   span.js94.67%72.73%100%98.31%15–16, 46, 61
   string-meta-service.js34.48%0%50%38.10%25, 25, 25, 27–28, 28, 28–33, 35, 39–40, 42, 44
   trace-context.js93.48%91.30%100%93.22%105, 34–35, 76–77, 92
   trace-id.js100%100%100%100%
   trace.js63.11%41.38%75%70.97%100, 102–103, 107, 107, 107, 107, 107, 109–111, 119, 119, 119, 119, 52–53, 57–59, 62, 64, 67–68, 68, 68, 68, 68–70, 84, 91, 97–99
   transaction-id.js88.89%80%100%92.86%30, 32, 36
lib/data
   grpc-data-convertor.js59.79%50.85%65.22%61.81%107–108, 118–119, 130, 130, 130, 130, 130–131, 136, 136, 136–137, 139–148, 150–151, 155–156, 16, 164–165, 17, 181–182, 191–192, 198, 198, 198–199, 201, 203–205, 207–210, 214, 217–218, 220–223, 239, 241–242, 242, 242, 242, 242, 242–243, 246–247, 251–252, 289–290, 32–33, 51–52, 61, 61, 61–62, 64–67, 69, 69, 69–71, 74–85, 87–88, 90–91, 95–96
   typed-value.js53.33%40%66.67%59.26%15, 15, 15, 20–21, 26, 26, 26–27, 29, 31–32, 37, 45–47, 49, 49, 49–50
lib/data/dto
   agent-info.js95.24%0%100%100%14
   api-meta-info.js95.65%88.89%100%100%10
   string-meta-info.js85.71%0%100%100%10
lib/instrumentation
   http-shared.js79.01%64.15%92.31%85.42%109–110, 140, 143, 143, 143–144, 144, 144–145, 147, 147, 147–148, 150, 158, 37, 40–41, 56, 67–68, 68, 68, 68, 68–69, 69, 69–70, 72, 74, 91
   module-hook.js82.46%66.67%100%83.33%37, 42, 50–51, 54, 67, 93, 93, 93–94
   request-data.js100%100%100%100%
   request-header-utils.js87.63%74.19%100%93.33%19–20, 29, 35, 51, 53, 58, 73–74, 84–85, 89
lib/instrumentation/module
   express.js45.45%28.17%63.16%52.94%100, 102, 106, 106, 106–112, 112, 112, 112, 112–113, 115, 117–118, 118, 118–119, 121, 128–131, 131, 131–135, 135, 135–136, 136, 136–137, 139, 142–143, 143, 143–144, 146, 152, 152, 152–153, 163, 163, 163–164, 168, 168, 168–169, 171, 171, 171–172, 174, 174, 174, 174, 174–176, 178, 182, 182, 182–183, 185, 189, 192, 197, 200, 27–29, 32–33, 48, 48, 48–49, 53, 53, 53, 60, 60, 60, 60–62, 62, 62, 71, 80, 87, 96–97, 99, 99, 99
   http.js100%100%100%100%
   https.js94.12%80%100%100%19
   koa-router.js19.75%4.17%40%25%19–21, 26, 28, 28, 28–29, 32, 34, 34, 34, 34, 34–35, 38–40, 40, 40–41, 44–47, 47, 47–49, 51–52, 52, 52–55, 57, 59, 59, 59–63, 65, 67, 67, 67–68, 71, 73, 81, 81, 81, 81, 81–83, 83, 83–84, 86
   redis.js89.86%76.19%100%95.35%17–19, 32, 34, 53, 65
lib/metric
   active-trace-histogram.js6.90%0%0%11.76%13, 13, 13–18, 22, 22, 22–23, 26, 26, 26–28, 28, 28–30, 30, 30–31, 33
   active-trace.js65.45%64.29%57.14%67.65%26–27, 46–47, 51, 53, 53, 53–54, 57–58, 58, 58–60, 63
   agent-stats-monitor.js14.29%0%0%21.05%15–18, 22, 26, 26, 26–27, 29–31, 33–35, 38, 44
   histogram-schema.js100%100%100%100%
   ping-scheduler.js12.50%0%0%18.18%12–15, 17–18, 22, 22, 22–23, 25
   resource-stats-collector.js20%25%0%25%10, 18–19, 23, 30–31, 38–39, 41–45, 47, 47, 47, 49, 51
   v8-compatibility.js95.24%100%100%92.86%21
lib/sampler
   sampler.js60.87%37.50%100%69.23%17, 20, 20, 20–21, 21, 21–22, 24
   sampling-flag.js55.56%16.67%100%70%16, 20, 20, 20, 20, 20–21, 23
lib/utils
   ant-path-matcher.js84.59%79.82%86.36%87.36%107, 107, 109, 124, 126–127, 127, 127–128, 131, 166–167, 175–176, 219, 225, 237–238, 242, 252, 257, 272, 276, 302, 304, 307–311, 324, 330–331, 335, 42–44, 55, 55, 55, 55, 55–56, 58, 92–93
   convert-utils.js47.37%25%50%66.67%10–11, 11–12, 12, 17–18, 21–22
   logger.js73.17%60%88.89%72.73%25, 25, 25–27, 29, 37–38, 48–49
   scheduler.js78.85%64.29%90.91%81.48%15, 22–24, 26–27, 50–52, 60
   simple-cache.js66.67%68.75%55.56%69.57%30, 32–33, 40–41, 41, 41–43, 48, 53, 57
   string-utils.js66.67%100%0%100%
lib/utils/log
   log-level-logger.js42.86%100%20%55.56%18, 21, 24, 27
   logger-output-adaptor.js5.66%0%16.67%8%15, 19, 19, 19, 19, 19–20, 20, 20–21, 23, 25, 27, 31, 31, 31, 31, 31–32, 32, 32–33, 35, 37, 39, 43, 43, 43, 43, 43–44, 44, 44–45, 47, 49, 51, 55, 55, 55, 55, 55–57, 59
   logger2.js53.03%50%48.15%57.14%103, 107, 111–112, 123, 127, 19, 36, 40, 44, 48, 60, 64, 68, 72, 76, 80

Please sign in to comment.