chore: make agent data port configurable independently from the agent connection port#2559
chore: make agent data port configurable independently from the agent connection port#2559abhilash-sivan wants to merge 1 commit into
Conversation
| { | ||
| host: agentOpts.host, | ||
| port: agentOpts.port, | ||
| port: agentOpts.dataPort, |
There was a problem hiding this comment.
If the customer sets AGENT_PORT, we will ignore the port or?
There was a problem hiding this comment.
We will continue using the customer-configured agent port for operations such as announcements and agent readiness checks etc.
For sending telemetry data, we will use a separate data port, which will be selected based on whether OTLP is enabled via configuration (yet to implement).
If the customer configures AGENT_PORT and OTLP is not enabled, then the same port will also be used for sending data.
There was a problem hiding this comment.
I have a question: if the customer has configured an agent port and enabled OTLP, what will be the data port?
There was a problem hiding this comment.
In this case, we will use the OTLP port as the data port because we will start communicating using OTLP, and currently only the dedicated OTLP ports can listen to and understand the OTLP format. So, we will use port 4318.
| * @param {{ agentPort: number }} defaultConfig | ||
| * @returns {number} | ||
| */ | ||
| function normalizeAgentDataPort(userConfig, defaultConfig) { |
There was a problem hiding this comment.
This method is same as normalizeAgentPort, is this intentional or is there something missing?
There was a problem hiding this comment.
Yes, this is currenlty same logic, but in future we will add logic for port switching here
// Future logic for OTLP enabled check can be added here to determine which port to use
There was a problem hiding this comment.
Could we simplify this by delegating to normalizeAgentPort when OTLP is not enabled?
if (userConfig.otlpEnabled) {
return defaultConfig.otlpPort; // 4317 or 4318
}
return normalizeAgentPort(userConfig, defaults);
There was a problem hiding this comment.
Yeah, this seems a clean approach.
But currently we don't have the logic
if (userConfig.otlpEnabled) {
return defaultConfig.otlpPort; // 4317 or 4318
}
so this will just return the normalizeAgentPort()
Also what if we allow the customers to configure data ports separately (in future). we can discuss this tomorrow
This PR prepares the codebase for independently configurable agent ports, allowing a separate port to be used for sending telemetry data such as traces and metrics.
This addresses the dual-port setup use case where the agent connection and announce cycle continue to use the default agent port, while telemetry data is sent to a separately configured OTLP endpoint.