Skip to content

Commit

Permalink
[pinpoint-apm#210] Remove no needs grpcUnaryRPC
Browse files Browse the repository at this point in the history
  • Loading branch information
feelform committed Aug 14, 2024
1 parent b1a1026 commit 95795ab
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 62 deletions.
49 changes: 0 additions & 49 deletions lib/client/grpc-unary-rpc.js

This file was deleted.

6 changes: 3 additions & 3 deletions test/client/grpc-data-sender.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const AsyncId = require('../../lib/context/async-id')
const SpanChunk = require('../../lib/context/span-chunk')
const Span = require('../../lib/context/span')
const SpanEvent = require('../../lib/context/span-event')
const MockgRPCDataSender = require('./mock-grpc-data-sender')
const MockGrpcDataSender = require('./mock-grpc-data-sender')

test('Should send span ', function (t) {
const expectedSpan = {
Expand Down Expand Up @@ -64,7 +64,7 @@ test('Should send span ', function (t) {
agentStartTime: 1592574173350
}), expectedSpan)

const grpcDataSender = new MockgRPCDataSender('', 0, 0, 0, {agentId: 'agent', applicationName: 'applicationName', agentStartTime: 1234344})
const grpcDataSender = new MockGrpcDataSender('', 0, 0, 0, {agentId: 'agent', applicationName: 'applicationName', agentStartTime: 1234344})
grpcDataSender.sendSpan(span)

t.plan(20)
Expand Down Expand Up @@ -120,7 +120,7 @@ test('Should send span ', function (t) {
t.equal(actual.getLoggingtransactioninfo(), 0, 'logging transaction info')
})

const grpcDataSender = new MockgRPCDataSender('', 0, 0, 0, {agentId: 'agent', applicationName: 'applicationName', agentStartTime: 1234344})
const grpcDataSender = new MockGrpcDataSender('', 0, 0, 0, {agentId: 'agent', applicationName: 'applicationName', agentStartTime: 1234344})

test('sendSpanChunk redis.SET.end', function (t) {
let expectedSpanChunk = {
Expand Down
10 changes: 2 additions & 8 deletions test/client/mock-grpc-data-sender.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@

'use strict'
const GrpcDataSender = require('../../lib/client/grpc-data-sender')
const GrpcUnaryRPC = require('../../lib/client/grpc-unary-rpc')

class MockgRPCDataSender extends GrpcDataSender {
class MockGrpcDataSender extends GrpcDataSender {
initializeClients() {
let self = this
this.agentClient = {
requestAgentInfo: function (pAgentInfo) {
self.actualAgentInfo = pAgentInfo
}
}
this.requestAgentInfo = new GrpcUnaryRPC('requestAgentInfo', this.agentClient, this.agentClient.requestAgentInfo, 0, 0)

this.metadataClient = {
requestApiMetaData: function (pApiMetaData) {
Expand All @@ -32,10 +30,6 @@ class MockgRPCDataSender extends GrpcDataSender {
self.actualSqlUidMetaData = pSqlUidMetaData
}
}
this.requestApiMetaData = new GrpcUnaryRPC('requestApiMetaData', this.metadataClient, this.metadataClient.requestApiMetaData, 0, 0)
this.requestStringMetaData = new GrpcUnaryRPC('requestStringMetaData', this.metadataClient, this.metadataClient.requestStringMetaData, 0, 0)
this.requestSqlMetaData = new GrpcUnaryRPC('requestSqlMetaData', this.metadataClient, this.metadataClient.requestSqlMetaData, 0, 0)
this.requestSqlUidMetaData = new GrpcUnaryRPC('requestSqlUidMetaData', this.metadataClient, this.metadataClient.requestSqlUidMetaData, 0, 0)
this.actualSpans = []
}

Expand Down Expand Up @@ -99,4 +93,4 @@ class MockgRPCDataSender extends GrpcDataSender {
}
}

module.exports = MockgRPCDataSender
module.exports = MockGrpcDataSender
4 changes: 2 additions & 2 deletions test/support/data-sender-mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const StringMetaInfo = require('../../lib/data/dto/string-meta-info')
const Span = require('../../lib/context/span')
const SpanChunk = require('../../lib/context/span-chunk')
const DataSender = require('../../lib/client/data-sender')
const MockgRPCDataSender = require('../client/mock-grpc-data-sender')
const MockGrpcDataSender = require('../client/mock-grpc-data-sender')
const SqlMetaData = require('../../lib/client/sql-meta-data')

class MockDataSender extends DataSender {
Expand Down Expand Up @@ -52,7 +52,7 @@ class MockDataSender extends DataSender {
const dataSender = () => {
return new MockDataSender({
enabledDataSending: true,
}, new MockgRPCDataSender('', 0, 0, 0, {
}, new MockGrpcDataSender('', 0, 0, 0, {
agentId: 'agent',
applicationName: 'applicationName',
agentStartTime: 1234344
Expand Down

0 comments on commit 95795ab

Please sign in to comment.