Skip to content

Commit

Permalink
Fixes after PR
Browse files Browse the repository at this point in the history
  • Loading branch information
doracretu3pillar committed Sep 30, 2024
1 parent 24f3a77 commit 2618cbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,10 @@ describe('AddRemoteInstanceService:: ', () => {
custom_labels: {
test: 'test',
},
add_node: {
node_name: 'localhost',
node_type: 'NODE_TYPE_REMOTE_NODE',
},
pmm_agent_id: 'pmm-server',
port: '80',
qan_postgresql_pgstatements_agent: true,
metrics_mode: 2,
metrics_mode: 1,
node_id: 'node1',
};
expect(toPayload(data)).toStrictEqual(payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,15 @@ export const toPayload = (values: any, discoverName?: string, type?: InstanceAva
data.service_name = data.address;
}

if (
(!values.isAzure && data.add_node === undefined) ||
(data.address !== '127.0.0.1' && data.address !== 'localhost')
) {
if (data.address === '127.0.0.1' || data.address === 'localhost') {
data.node_id = data.node.value;
} else if (!values.isAzure && data.add_node === undefined) {
data.add_node = {
node_name: data.service_name,
node_type: 'NODE_TYPE_REMOTE_NODE',
};
}

if (data.address === '127.0.0.1' || data.address === 'localhost') {
data.node_id = data.node.value;
}

if (values.isRDS && discoverName) {
data.engine = discoverName;
}
Expand Down Expand Up @@ -190,9 +185,9 @@ export const toPayload = (values: any, discoverName?: string, type?: InstanceAva
data.pmm_agent_id = values.pmm_agent_id.value;

if (data.pmm_agent_id === PMM_SERVER_NODE_AGENT_ID) {
data.metrics_mode = 2;
} else {
data.metrics_mode = 1;
} else {
data.metrics_mode = 2;
}
delete data.tracking;
delete data.node;
Expand Down

0 comments on commit 2618cbf

Please sign in to comment.