Skip to content

Commit

Permalink
[pinpoint-apm#117] fix `error TS9006: Declaration emit for this file …
Browse files Browse the repository at this point in the history
…requires using private name`
  • Loading branch information
feelform committed Sep 27, 2022
1 parent 80d621a commit fb9b626
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lib/client/grpc-data-sender.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const grpc = require('@grpc/grpc-js')
const log = require('../utils/logger')
const services = require('../data/v1/Service_grpc_pb')
const dataConvertor = require('../data/grpc-data-convertor')
const pingIdGenerator = require('../context/sequence-generator').pingIdGenerator
const pingIdGenerator = require('../context/sequence-generators').pingIdGenerator
const GrpcBidirectionalStream = require('./grpc-bidirectional-stream')
const GrpcClientSideStream = require('./grpc-client-side-stream')
const GrpcUnaryRPC = require('./grpc-unary-rpc')
Expand Down
2 changes: 1 addition & 1 deletion lib/context/api-meta-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

'use strict'

const apiMetaCacheKeyGenerator = require('../context/sequence-generator').apiMetaCacheKeyGenerator
const apiMetaCacheKeyGenerator = require('../context/sequence-generators').apiMetaCacheKeyGenerator
const SimpleCache = require('../utils/simple-cache')
const GeneralMethodDescriptor = require('../constant/method-descriptor').GeneralMethodDescriptor
const ApiMetaInfo = require('../data/dto/api-meta-info')
Expand Down
2 changes: 1 addition & 1 deletion lib/context/disable-span-event-recorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'use strict'

const AsyncId = require('./async-id')
const asyncIdGenerator = require('./sequence-generator').asyncIdGenerator
const asyncIdGenerator = require('./sequence-generators').asyncIdGenerator

class DisableSpanEventRecorder {
constructor() {
Expand Down
10 changes: 1 addition & 9 deletions lib/context/sequence-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,4 @@ class SequenceGenerator{
}
}

module.exports = {
SequenceGenerator,
transactionIdGenerator: new SequenceGenerator(),
asyncIdGenerator: new SequenceGenerator(1),
stringMetaCacheKeyGenerator: new SequenceGenerator(1),
apiMetaCacheKeyGenerator: new SequenceGenerator(1),
pingIdGenerator: new SequenceGenerator(),
dummyIdGenerator: new SequenceGenerator(),
}
module.exports = SequenceGenerator
11 changes: 11 additions & 0 deletions lib/context/sequence-generators.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const SequenceGenerator = require('./sequence-generator')

module.exports = {
transactionIdGenerator: new SequenceGenerator(),
asyncIdGenerator: new SequenceGenerator(1),
stringMetaCacheKeyGenerator: new SequenceGenerator(1),
apiMetaCacheKeyGenerator: new SequenceGenerator(1),
pingIdGenerator: new SequenceGenerator(),
dummyIdGenerator: new SequenceGenerator(),
}

4 changes: 2 additions & 2 deletions lib/context/span-event-recorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const Annotation = require('./annotation')
const DefaultAnnotationKey = require('../constant/annotation-key').DefaultAnnotationKey
const StringMetaService = require('./string-meta-service')
const AsyncId = require('./async-id')
const asyncIdGenerator = require('./sequence-generator').asyncIdGenerator
const dummyIdGenerator = require('./sequence-generator').dummyIdGenerator
const asyncIdGenerator = require('./sequence-generators').asyncIdGenerator
const dummyIdGenerator = require('./sequence-generators').dummyIdGenerator
const AnnotationKeyUtils = require('./annotation-key-utils')

// https://github.com/pinpoint-apm/pinpoint/blob/master/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/context/SpanEventRecorder.java
Expand Down
13 changes: 9 additions & 4 deletions lib/context/trace-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ class TraceContext {
this.dataSender = null
}

/**
* trace context singleton instance
* @param {string} options
* @param {string} dataSender
* @param {string} config
* @returns {TraceContext}
* @constructor
*/
static init (options, dataSender, config) {
if (!options.agentId || !options.applicationName) {
throw new Error('Fail to initialize pinpoint context')
Expand Down Expand Up @@ -132,7 +140,4 @@ class TraceContext {
}
}

module.exports = {
init: TraceContext.init
}

module.exports = TraceContext
2 changes: 1 addition & 1 deletion lib/context/transaction-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

'use strict'

const transactionIdGenerator = require('./sequence-generator').transactionIdGenerator
const transactionIdGenerator = require('./sequence-generators').transactionIdGenerator

const DELIMETER = '^'

Expand Down
1 change: 1 addition & 0 deletions lib/instrumentation/module/mysql2.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@ module.exports = function (agent, version, mysql2) {
}
}
}
}
2 changes: 1 addition & 1 deletion test/context/transaction-id.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
const test = require('tape')
const { log, fixture, util } = require('../test-helper')

const transactionIdGenerator = require('../../lib/context/sequence-generator').transactionIdGenerator
const transactionIdGenerator = require('../../lib/context/sequence-generators').transactionIdGenerator
const TransactionId = require('../../lib/context/transaction-id')

test('Should create with sequence number', function (t) {
Expand Down

0 comments on commit fb9b626

Please sign in to comment.