Skip to content

Audit Synthetics plugin log levels#218399

Merged
maryam-saeidi merged 14 commits intoelastic:mainfrom
maryam-saeidi:audit-synthetics-log-level
Jun 12, 2025
Merged

Audit Synthetics plugin log levels#218399
maryam-saeidi merged 14 commits intoelastic:mainfrom
maryam-saeidi:audit-synthetics-log-level

Conversation

@maryam-saeidi
Copy link
Member

@maryam-saeidi maryam-saeidi commented Apr 16, 2025

Closes https://github.com/elastic/observability-dev/issues/4432

Summary

Auditing log levels in the Synthetics plugin.

Example

Throwing error when creating a new monitor:

Before

1.
[2025-04-23T12:29:37.594+02:00][ERROR][plugins.synthetics] Error: newMonitorPromise failed!
    at /Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15
    at async AddEditMonitorAPI.syncNewMonitor (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)
    at async handler (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)

2.
[2025-04-23T12:29:37.595+02:00][ERROR][plugins.synthetics] Unable to create Synthetics monitor https://www.elastic.co/

3.
[2025-04-23T12:29:38.758+02:00][ERROR][plugins.synthetics] Error: newMonitorPromise failed!
    at /Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15
    at async AddEditMonitorAPI.syncNewMonitor (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)
    at async handler (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)

4.
[2025-04-23T12:29:38.760+02:00][ERROR][plugins.synthetics] Unable to create synthetics monitor

After

[2025-05-12T16:06:23.160+02:00][ERROR][plugins.synthetics] Unable to create Synthetics monitor with name https://www.elastic.co/ Error: newMonitorPromise failed!
    at /Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15
    at async AddEditMonitorAPI.syncNewMonitor (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)
    at async handler (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)
⚠️ Note

After merging this PR, we will also have stacktrace locally.

❓ Questions

  1. When calling synthetics/params API with wrong parameters, we get [2025-05-13T11:05:52.401+02:00][ERROR][http] 400 Bad Request, which path is responsible for this error? (Since it is from http, so it is not logged in synthetics. I am wondering where the validation is happening in this case)
    Answer: It was here: https://github.com/elastic/kibana/blob/main/src/core/packages/http/router-server-internal/src/route.ts#L124

@maryam-saeidi maryam-saeidi added release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels v8.19.0 labels Apr 16, 2025
@maryam-saeidi maryam-saeidi self-assigned this Apr 16, 2025
@maryam-saeidi maryam-saeidi requested a review from a team as a code owner April 16, 2025 09:32
@botelastic botelastic bot added the Team:actionable-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics. label Apr 16, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

@maryam-saeidi maryam-saeidi marked this pull request as draft April 17, 2025 07:47
@maryam-saeidi maryam-saeidi requested a review from shahzad31 April 17, 2025 07:51
@maryam-saeidi maryam-saeidi marked this pull request as ready for review June 5, 2025 12:30
Comment on lines 95 to 98
server.logger.error(
`Unable to inspect Synthetics monitor ${monitorWithDefaults[ConfigKey.NAME]}`
`Unable to inspect Synthetics monitor ${monitorWithDefaults[ConfigKey.NAME]}`,
{ error }
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this can be removed, likely not needed. since user will see this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked Discover and I didn't see such a log. On second thought, since we will return 500, I'll keep it in case there is a code issue that we need to be aware of. If we see the reported error logs are not useful for us, we can remove them later.

Comment on lines +117 to +119
// TODO Shouldn't we throw this error?
// What can go wrong here and should we log it as error?
logger.error(`Failed to fetch Synthetics suggestions: ${error}`, { error });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, it can be removed

Comment on lines +62 to +63
// TODO What can go wrong here and should we log it as error?
server.logger.error(`Unable to get Synthetics enablement`, { error: e });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likely not needed

Comment on lines +94 to +95
// TODO What can go wrong here and should we log it as error?
server.logger.error(`Unable to disable Synthetics`, { error: e });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since being thrown , it can be removed

await service.pushConfigs();
} else {
if (!service.isAllowed) {
// TODO is this log needed?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @maryam-saeidi

Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,

thank you for taking care of these !!

@maryam-saeidi maryam-saeidi merged commit 3279797 into elastic:main Jun 12, 2025
11 checks passed
@maryam-saeidi maryam-saeidi deleted the audit-synthetics-log-level branch June 12, 2025 13:55
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19

https://github.com/elastic/kibana/actions/runs/15612523986

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.19 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 218399

Questions ?

Please refer to the Backport tool documentation

@maryam-saeidi
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

maryam-saeidi added a commit to maryam-saeidi/kibana that referenced this pull request Jun 13, 2025
Closes elastic/observability-dev#4432

## Summary

Auditing [log
levels](https://docs.elastic.dev/kibana-dev-docs/services/logging#log-level)
in the Synthetics plugin.

### Example
Throwing error when creating a new monitor:
<img
src="https://github.com/user-attachments/assets/7cead63b-c209-4174-a4f7-7dfad40aa34d"
width=500 />

#### Before
```
1.
[2025-04-23T12:29:37.594+02:00][ERROR][plugins.synthetics] Error: newMonitorPromise failed!
    at /Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15
    at async AddEditMonitorAPI.syncNewMonitor (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)
    at async handler (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)

2.
[2025-04-23T12:29:37.595+02:00][ERROR][plugins.synthetics] Unable to create Synthetics monitor https://www.elastic.co/

3.
[2025-04-23T12:29:38.758+02:00][ERROR][plugins.synthetics] Error: newMonitorPromise failed!
    at /Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15
    at async AddEditMonitorAPI.syncNewMonitor (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)
    at async handler (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)

4.
[2025-04-23T12:29:38.760+02:00][ERROR][plugins.synthetics] Unable to create synthetics monitor
```

#### After
```
[2025-05-12T16:06:23.160+02:00][ERROR][plugins.synthetics] Unable to create Synthetics monitor with name https://www.elastic.co/ Error: newMonitorPromise failed!
    at /Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15
    at async AddEditMonitorAPI.syncNewMonitor (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)
    at async handler (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)
```
##### ⚠️ Note
After merging this [PR](elastic#219940),
we will also have stacktrace locally.

### ❓ Questions
1. When calling `synthetics/params` API with wrong parameters, we get
`[2025-05-13T11:05:52.401+02:00][ERROR][http] 400 Bad Request`, which
path is responsible for this error? (Since it is from `http`, so it is
not logged in synthetics. I am wondering where the validation is
happening in this case)
**Answer**: It was here:
https://github.com/elastic/kibana/blob/main/src/core/packages/http/router-server-internal/src/route.ts#L124

(cherry picked from commit 3279797)

# Conflicts:
#	x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/bulk_cruds/edit_monitor_bulk.ts
#	x-pack/solutions/observability/plugins/synthetics/server/routes/suggestions/route.ts
maryam-saeidi added a commit that referenced this pull request Jun 13, 2025
# Backport

This will backport the following commits from `main` to `8.19`:
- [Audit Synthetics plugin log levels
(#218399)](#218399)

<!--- Backport version: 10.0.0 -->

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

<!--BACKPORT [{"author":{"name":"Maryam
Saeidi","email":"maryam.saeidi@elastic.co"},"sourceCommit":{"committedDate":"2025-06-12T13:55:03Z","message":"Audit
Synthetics plugin log levels (#218399)\n\nCloses
https://github.com/elastic/observability-dev/issues/4432\n\n##
Summary\n\nAuditing
[log\nlevels](https://docs.elastic.dev/kibana-dev-docs/services/logging#log-level)\nin
the Synthetics plugin.\n\n### Example\nThrowing error when creating a
new
monitor:\n<img\nsrc=\"https://github.com/user-attachments/assets/7cead63b-c209-4174-a4f7-7dfad40aa34d\"\nwidth=500
/>\n\n####
Before\n```\n1.\n[2025-04-23T12:29:37.594+02:00][ERROR][plugins.synthetics]
Error: newMonitorPromise failed!\n at
/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15\n
at async AddEditMonitorAPI.syncNewMonitor
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)\n
at async handler
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)\n\n2.\n[2025-04-23T12:29:37.595+02:00][ERROR][plugins.synthetics]
Unable to create Synthetics monitor
https://www.elastic.co/\n\n3.\n[2025-04-23T12:29:38.758+02:00][ERROR][plugins.synthetics]
Error: newMonitorPromise failed!\n at
/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15\n
at async AddEditMonitorAPI.syncNewMonitor
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)\n
at async handler
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)\n\n4.\n[2025-04-23T12:29:38.760+02:00][ERROR][plugins.synthetics]
Unable to create synthetics monitor\n```\n\n####
After\n```\n[2025-05-12T16:06:23.160+02:00][ERROR][plugins.synthetics]
Unable to create Synthetics monitor with name https://www.elastic.co/
Error: newMonitorPromise failed!\n at
/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15\n
at async AddEditMonitorAPI.syncNewMonitor
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)\n
at async handler
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)\n```\n#####
⚠️ Note\nAfter merging this
[PR](https://github.com/elastic/kibana/pull/219940),\nwe will also have
stacktrace locally.\n\n### ❓ Questions\n1. When calling
`synthetics/params` API with wrong parameters, we
get\n`[2025-05-13T11:05:52.401+02:00][ERROR][http] 400 Bad Request`,
which\npath is responsible for this error? (Since it is from `http`, so
it is\nnot logged in synthetics. I am wondering where the validation
is\nhappening in this case)\n**Answer**: It was
here:\nhttps://github.com/elastic/kibana/blob/main/src/core/packages/http/router-server-internal/src/route.ts#L124","sha":"327979743e08a9ae5433b3f2359817eacbfffb3d","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:obs-ux-management","backport:version","v9.1.0","v8.19.0"],"title":"Audit
Synthetics plugin log
levels","number":218399,"url":"https://github.com/elastic/kibana/pull/218399","mergeCommit":{"message":"Audit
Synthetics plugin log levels (#218399)\n\nCloses
https://github.com/elastic/observability-dev/issues/4432\n\n##
Summary\n\nAuditing
[log\nlevels](https://docs.elastic.dev/kibana-dev-docs/services/logging#log-level)\nin
the Synthetics plugin.\n\n### Example\nThrowing error when creating a
new
monitor:\n<img\nsrc=\"https://github.com/user-attachments/assets/7cead63b-c209-4174-a4f7-7dfad40aa34d\"\nwidth=500
/>\n\n####
Before\n```\n1.\n[2025-04-23T12:29:37.594+02:00][ERROR][plugins.synthetics]
Error: newMonitorPromise failed!\n at
/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15\n
at async AddEditMonitorAPI.syncNewMonitor
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)\n
at async handler
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)\n\n2.\n[2025-04-23T12:29:37.595+02:00][ERROR][plugins.synthetics]
Unable to create Synthetics monitor
https://www.elastic.co/\n\n3.\n[2025-04-23T12:29:38.758+02:00][ERROR][plugins.synthetics]
Error: newMonitorPromise failed!\n at
/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15\n
at async AddEditMonitorAPI.syncNewMonitor
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)\n
at async handler
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)\n\n4.\n[2025-04-23T12:29:38.760+02:00][ERROR][plugins.synthetics]
Unable to create synthetics monitor\n```\n\n####
After\n```\n[2025-05-12T16:06:23.160+02:00][ERROR][plugins.synthetics]
Unable to create Synthetics monitor with name https://www.elastic.co/
Error: newMonitorPromise failed!\n at
/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15\n
at async AddEditMonitorAPI.syncNewMonitor
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)\n
at async handler
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)\n```\n#####
⚠️ Note\nAfter merging this
[PR](https://github.com/elastic/kibana/pull/219940),\nwe will also have
stacktrace locally.\n\n### ❓ Questions\n1. When calling
`synthetics/params` API with wrong parameters, we
get\n`[2025-05-13T11:05:52.401+02:00][ERROR][http] 400 Bad Request`,
which\npath is responsible for this error? (Since it is from `http`, so
it is\nnot logged in synthetics. I am wondering where the validation
is\nhappening in this case)\n**Answer**: It was
here:\nhttps://github.com/elastic/kibana/blob/main/src/core/packages/http/router-server-internal/src/route.ts#L124","sha":"327979743e08a9ae5433b3f2359817eacbfffb3d"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/218399","number":218399,"mergeCommit":{"message":"Audit
Synthetics plugin log levels (#218399)\n\nCloses
https://github.com/elastic/observability-dev/issues/4432\n\n##
Summary\n\nAuditing
[log\nlevels](https://docs.elastic.dev/kibana-dev-docs/services/logging#log-level)\nin
the Synthetics plugin.\n\n### Example\nThrowing error when creating a
new
monitor:\n<img\nsrc=\"https://github.com/user-attachments/assets/7cead63b-c209-4174-a4f7-7dfad40aa34d\"\nwidth=500
/>\n\n####
Before\n```\n1.\n[2025-04-23T12:29:37.594+02:00][ERROR][plugins.synthetics]
Error: newMonitorPromise failed!\n at
/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15\n
at async AddEditMonitorAPI.syncNewMonitor
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)\n
at async handler
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)\n\n2.\n[2025-04-23T12:29:37.595+02:00][ERROR][plugins.synthetics]
Unable to create Synthetics monitor
https://www.elastic.co/\n\n3.\n[2025-04-23T12:29:38.758+02:00][ERROR][plugins.synthetics]
Error: newMonitorPromise failed!\n at
/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15\n
at async AddEditMonitorAPI.syncNewMonitor
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)\n
at async handler
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)\n\n4.\n[2025-04-23T12:29:38.760+02:00][ERROR][plugins.synthetics]
Unable to create synthetics monitor\n```\n\n####
After\n```\n[2025-05-12T16:06:23.160+02:00][ERROR][plugins.synthetics]
Unable to create Synthetics monitor with name https://www.elastic.co/
Error: newMonitorPromise failed!\n at
/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15\n
at async AddEditMonitorAPI.syncNewMonitor
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)\n
at async handler
(/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)\n```\n#####
⚠️ Note\nAfter merging this
[PR](https://github.com/elastic/kibana/pull/219940),\nwe will also have
stacktrace locally.\n\n### ❓ Questions\n1. When calling
`synthetics/params` API with wrong parameters, we
get\n`[2025-05-13T11:05:52.401+02:00][ERROR][http] 400 Bad Request`,
which\npath is responsible for this error? (Since it is from `http`, so
it is\nnot logged in synthetics. I am wondering where the validation
is\nhappening in this case)\n**Answer**: It was
here:\nhttps://github.com/elastic/kibana/blob/main/src/core/packages/http/router-server-internal/src/route.ts#L124","sha":"327979743e08a9ae5433b3f2359817eacbfffb3d"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
iblancof pushed a commit to iblancof/kibana that referenced this pull request Jun 16, 2025
Closes elastic/observability-dev#4432

## Summary

Auditing [log
levels](https://docs.elastic.dev/kibana-dev-docs/services/logging#log-level)
in the Synthetics plugin.

### Example
Throwing error when creating a new monitor:
<img
src="https://github.com/user-attachments/assets/7cead63b-c209-4174-a4f7-7dfad40aa34d"
width=500 />

#### Before
```
1.
[2025-04-23T12:29:37.594+02:00][ERROR][plugins.synthetics] Error: newMonitorPromise failed!
    at /Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15
    at async AddEditMonitorAPI.syncNewMonitor (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)
    at async handler (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)

2.
[2025-04-23T12:29:37.595+02:00][ERROR][plugins.synthetics] Unable to create Synthetics monitor https://www.elastic.co/

3.
[2025-04-23T12:29:38.758+02:00][ERROR][plugins.synthetics] Error: newMonitorPromise failed!
    at /Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15
    at async AddEditMonitorAPI.syncNewMonitor (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)
    at async handler (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)

4.
[2025-04-23T12:29:38.760+02:00][ERROR][plugins.synthetics] Unable to create synthetics monitor
```

#### After
```
[2025-05-12T16:06:23.160+02:00][ERROR][plugins.synthetics] Unable to create Synthetics monitor with name https://www.elastic.co/ Error: newMonitorPromise failed!
    at /Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:82:15
    at async AddEditMonitorAPI.syncNewMonitor (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor/add_monitor_api.ts:88:72)
    at async handler (/Users/maryam.saeidi/WebstormProjects/kibana-mary/x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts:123:11)
```
##### ⚠️ Note
After merging this [PR](elastic#219940),
we will also have stacktrace locally.

### ❓ Questions
1. When calling `synthetics/params` API with wrong parameters, we get
`[2025-05-13T11:05:52.401+02:00][ERROR][http] 400 Bad Request`, which
path is responsible for this error? (Since it is from `http`, so it is
not logged in synthetics. I am wondering where the validation is
happening in this case)
**Answer**: It was here:
https://github.com/elastic/kibana/blob/main/src/core/packages/http/router-server-internal/src/route.ts#L124
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:actionable-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics. v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants