[8.9] [Synthetics] Normalize monitor before mixing params. (#163176) (#163191)

# Backport

This will backport the following commits from `main` to `8.9`:
- [[Synthetics] Normalize monitor before mixing params.
(#163176)](https://github.com/elastic/kibana/pull/163176)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Abdul Wahab
Zahid","email":"awahab07@yahoo.com"},"sourceCommit":{"committedDate":"2023-08-04T17:25:10Z","message":"[Synthetics]
Normalize monitor before mixing params. (#163176)\n\nFixes #163042
\r\n\r\n## Summary\r\n\r\nNormalize the monitor object before mixing
global and
project-wide\r\nparams.","sha":"339eb28861e56a465cc9ce6f458d792d39414706","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Team:uptime","release_note:skip","v8.9.0","v8.10.0"],"number":163176,"url":"https://github.com/elastic/kibana/pull/163176","mergeCommit":{"message":"[Synthetics]
Normalize monitor before mixing params. (#163176)\n\nFixes #163042
\r\n\r\n## Summary\r\n\r\nNormalize the monitor object before mixing
global and
project-wide\r\nparams.","sha":"339eb28861e56a465cc9ce6f458d792d39414706"}},"sourceBranch":"main","suggestedTargetBranches":["8.9"],"targetPullRequestStates":[{"branch":"8.9","label":"v8.9.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/163176","number":163176,"mergeCommit":{"message":"[Synthetics]
Normalize monitor before mixing params. (#163176)\n\nFixes #163042
\r\n\r\n## Summary\r\n\r\nNormalize the monitor object before mixing
global and
project-wide\r\nparams.","sha":"339eb28861e56a465cc9ce6f458d792d39414706"}}]}]
BACKPORT-->

Co-authored-by: Abdul Wahab Zahid <awahab07@yahoo.com>
This commit is contained in:
Kibana Machine 2023-08-04 16:13:15 -04:00 committed by GitHub
parent 2540167153
commit 99b0b1dfa1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -318,13 +318,16 @@ export class SyntheticsMonitorClient {
const heartbeatConfigs: HeartbeatConfig[] = [];
for (const monitor of monitors) {
const attributes = monitor.attributes as unknown as MonitorFields;
const { str: paramsString } = mixParamsWithGlobalParams(paramsBySpace[spaceId], attributes);
const normalizedMonitor = normalizeSecrets(monitor).attributes as MonitorFields;
const { str: paramsString } = mixParamsWithGlobalParams(
paramsBySpace[spaceId],
normalizedMonitor
);
heartbeatConfigs.push(
formatHeartbeatRequest(
{
monitor: normalizeSecrets(monitor).attributes,
monitor: normalizedMonitor,
configId: monitor.id,
},
paramsString