Skip to content

Commit

Permalink
[#219] PCmdServiceHandshake
Browse files Browse the repository at this point in the history
* serviceConfig for retry, so rename refactoring
  • Loading branch information
feelform committed Aug 29, 2024
1 parent ed33bec commit b3b5401
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 9 deletions.
2 changes: 2 additions & 0 deletions lib/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class Agent {
this.startSchedule(agentId, agentStartTime)
this.initializeSupportModules()

this.dataSender.sendSupportedServicesCommand()

log.warn('[Pinpoint Agent][' + agentId + '] Init Completed')
}

Expand Down
32 changes: 32 additions & 0 deletions lib/client/command/command-type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Pinpoint Node.js Agent
* Copyright 2020-present NAVER Corp.
* Apache License v2.0
*/

'use strict'
const cmdMessages = require('../../data/v1/Cmd_pb')

class CommandType {
static ECHO = new CommandType('ECHO', cmdMessages.PCommandType.ECHO)
static ACTIVE_THREAD_COUNT = new CommandType('ACTIVE_THREAD_COUNT', cmdMessages.PCommandType.ACTIVE_THREAD_COUNT)
static supportedServices = [CommandType.ECHO, CommandType.ACTIVE_THREAD_COUNT]

constructor(name, value) {
this.name = name
this.value = value
}

static supportedServicesCommandMessage() {
const message = new cmdMessages.PCmdMessage()
const command = new cmdMessages.PCmdServiceHandshake()

CommandType.supportedServices.forEach(commandType => {
command.addSupportcommandservicekey(commandType.value)
})
message.setHandshakemessage(command)
return message
}
}

module.exports = CommandType
4 changes: 2 additions & 2 deletions lib/client/data-sender.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class DataSender {
}
}

sendControlHandshake(params) {
sendSupportedServicesCommand() {
if (this.enabledDataSending) {
this.dataSender.sendControlHandshake(params)
this.dataSender.sendSupportedServicesCommand()
}
}

Expand Down
13 changes: 7 additions & 6 deletions lib/client/grpc-data-sender.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ const dataConvertor = require('../data/grpc-data-convertor')
const GrpcBidirectionalStream = require('./grpc-bidirectional-stream')
const GrpcClientSideStream = require('./grpc-client-side-stream')
const Scheduler = require('../utils/scheduler')
const makeAgentInformationMetadataInterceptor = require('./grpc/make-agent-information-metadata-interceptor')
const socketIdInterceptor = require('./grpc/socketid-interceptor')
const grpcBuiltInRetryHeaderInterceptor = require('./grpc/grpc-built-in-retry-header-interceptor')
const makeAgentInformationMetadataInterceptor = require('./interceptor/make-agent-information-metadata-interceptor')
const socketIdInterceptor = require('./interceptor/socketid-interceptor')
const grpcBuiltInRetryHeaderInterceptor = require('./interceptor/grpc-built-in-retry-header-interceptor')
const CallArgumentsBuilder = require('./call-arguments-builder')
const OptionsBuilder = require('./grpc/options-builder')
const OptionsBuilder = require('./retry/options-builder')
const CommandType = require('./command/command-type')

// AgentInfoSender.java
// refresh daily
Expand Down Expand Up @@ -285,8 +286,8 @@ class GrpcDataSender {
}
}

sendControlHandshake(params) {
const pCmdMessage = dataConvertor.convertCmdMessage(params)
sendSupportedServicesCommand() {
const pCmdMessage = CommandType.supportedServicesCommandMessage()
if (log.isDebug()) {
log.debug(`sendControlHandshake pCmdMessage: ${JSON.stringify(pCmdMessage.toObject())}`)
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const defaultConfig = require('./pinpoint-config-default')
const log = require('./utils/logger')
const { setLog } = require('./supports')
const { makeLogLevelLog } = require('./utils/log/log-level-logger')
const ServiceConfigBuilder = require('./client/grpc/service-config-builder')
const ServiceConfigBuilder = require('./client/retry/service-config-builder')

const valueOfString = (envName) => {
return () => {
Expand Down

0 comments on commit b3b5401

Please sign in to comment.