-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Synthetics] Add push monitor api #131270
Changes from all commits
6645147
0609acb
98ef413
8bf704e
dead4ff
b5403b4
a826d30
96f87b5
9071b40
7673e57
b183ba3
e4dbe4f
8d6e8b0
dab30a3
bb85e7a
ba5d12c
f6e3921
a4d311d
2deb0d6
5c21e23
92b0746
14e4c44
4b3e7ca
502649b
0f3573d
4a49b2c
04081f5
7653ae0
38e82aa
e52700b
c13d5c0
8e66ba9
b984a29
9c94dec
9812133
25e55d9
0b89a0b
519f98b
1a50b86
8a80e65
4db8490
373ff73
f7775ae
ce0dab8
eafcbab
a9cbdf4
74ff776
d2ce516
c9fa14b
493ed2f
b82e50f
2c9093c
b0712e3
bbe93f3
f6c5378
ecd04e1
4f02c18
8eb5bce
ff282fa
7f48719
8f89640
463de3f
32e9cac
2823548
f570715
76a3269
913f44d
9502b2a
8a8723f
b28eae6
72f2a92
9af59f2
017747a
378dc42
7477fe6
5da7b2d
b026d9e
0205cb6
e832b56
5cf6ffc
deed911
a6b7bd4
0b34ad2
368273f
143bb63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ import { | |
ResponseBodyIndexPolicy, | ||
ScheduleUnit, | ||
ScreenshotOption, | ||
SourceType, | ||
TCPAdvancedFields, | ||
TCPSimpleFields, | ||
TLSFields, | ||
|
@@ -41,6 +42,7 @@ export const DEFAULT_COMMON_FIELDS: CommonFields = { | |
[ConfigKey.NAME]: '', | ||
[ConfigKey.LOCATIONS]: [], | ||
[ConfigKey.NAMESPACE]: DEFAULT_NAMESPACE_STRING, | ||
[ConfigKey.MONITOR_SOURCE_TYPE]: SourceType.UI, | ||
}; | ||
|
||
export const DEFAULT_BROWSER_ADVANCED_FIELDS: BrowserAdvancedFields = { | ||
|
@@ -58,10 +60,9 @@ export const DEFAULT_BROWSER_ADVANCED_FIELDS: BrowserAdvancedFields = { | |
|
||
export const DEFAULT_BROWSER_SIMPLE_FIELDS: BrowserSimpleFields = { | ||
...DEFAULT_COMMON_FIELDS, | ||
[ConfigKey.SCHEDULE]: { | ||
unit: ScheduleUnit.MINUTES, | ||
number: '10', | ||
}, | ||
[ConfigKey.JOURNEY_ID]: '', | ||
[ConfigKey.PROJECT_ID]: '', | ||
[ConfigKey.PLAYWRIGHT_OPTIONS]: '', | ||
[ConfigKey.METADATA]: { | ||
script_source: { | ||
is_generated_script: false, | ||
|
@@ -70,21 +71,26 @@ export const DEFAULT_BROWSER_SIMPLE_FIELDS: BrowserSimpleFields = { | |
is_zip_url_tls_enabled: false, | ||
}, | ||
[ConfigKey.MONITOR_TYPE]: DataStream.BROWSER, | ||
[ConfigKey.PARAMS]: '', | ||
[ConfigKey.PORT]: undefined, | ||
[ConfigKey.SCHEDULE]: { | ||
unit: ScheduleUnit.MINUTES, | ||
number: '10', | ||
}, | ||
[ConfigKey.SOURCE_INLINE]: '', | ||
[ConfigKey.SOURCE_PROJECT_CONTENT]: '', | ||
[ConfigKey.SOURCE_ZIP_URL]: '', | ||
[ConfigKey.SOURCE_ZIP_USERNAME]: '', | ||
[ConfigKey.SOURCE_ZIP_PASSWORD]: '', | ||
[ConfigKey.SOURCE_ZIP_FOLDER]: '', | ||
[ConfigKey.SOURCE_ZIP_PROXY_URL]: '', | ||
[ConfigKey.PARAMS]: '', | ||
[ConfigKey.ZIP_URL_TLS_CERTIFICATE_AUTHORITIES]: undefined, | ||
[ConfigKey.ZIP_URL_TLS_CERTIFICATE]: undefined, | ||
[ConfigKey.ZIP_URL_TLS_KEY]: undefined, | ||
[ConfigKey.ZIP_URL_TLS_KEY_PASSPHRASE]: undefined, | ||
[ConfigKey.ZIP_URL_TLS_VERIFICATION_MODE]: undefined, | ||
[ConfigKey.ZIP_URL_TLS_VERSION]: undefined, | ||
[ConfigKey.URLS]: undefined, | ||
[ConfigKey.PORT]: undefined, | ||
[ConfigKey.URLS]: '', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just for the sanity purpose, we should probably sort these keys in alphabetical order |
||
}; | ||
|
||
export const DEFAULT_HTTP_SIMPLE_FIELDS: HTTPSimpleFields = { | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -44,4 +44,7 @@ export enum API_URLS { | |||||
RUN_ONCE_MONITOR = '/internal/uptime/service/monitors/run_once', | ||||||
TRIGGER_MONITOR = '/internal/uptime/service/monitors/trigger', | ||||||
SERVICE_ALLOWED = '/internal/uptime/service/allowed', | ||||||
|
||||||
// Project monitor public endpoint | ||||||
SYNTHETICS_MONITORS_PROJECT = '/api/synthetics/service/project/monitors', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
i am 50/50 on this |
||||||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,50 @@ | ||||||
/* | ||||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||||||
* or more contributor license agreements. Licensed under the Elastic License | ||||||
* 2.0; you may not use this file except in compliance with the Elastic License | ||||||
* 2.0. | ||||||
*/ | ||||||
|
||||||
import * as t from 'io-ts'; | ||||||
import { ScreenshotOptionCodec } from './monitor_configs'; | ||||||
|
||||||
export const ProjectMonitorThrottlingConfigCodec = t.interface({ | ||||||
download: t.number, | ||||||
upload: t.number, | ||||||
latency: t.number, | ||||||
}); | ||||||
|
||||||
export const ProjectBrowserMonitorCodec = t.intersection([ | ||||||
t.interface({ | ||||||
id: t.string, | ||||||
name: t.string, | ||||||
schedule: t.number, | ||||||
content: t.string, | ||||||
locations: t.array(t.string), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happens when user doesn't provide these? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adjusted the logic to make it required. Now if the user doesn't pass it, it'll end up in the |
||||||
}), | ||||||
t.partial({ | ||||||
throttling: ProjectMonitorThrottlingConfigCodec, | ||||||
screenshot: ScreenshotOptionCodec, | ||||||
tags: t.array(t.string), | ||||||
ignoreHTTPSErrors: t.boolean, | ||||||
apmServiceName: t.string, | ||||||
playwrightOptions: t.record(t.string, t.unknown), | ||||||
filter: t.interface({ | ||||||
match: t.string, | ||||||
}), | ||||||
params: t.record(t.string, t.unknown), | ||||||
enabled: t.boolean, | ||||||
}), | ||||||
]); | ||||||
|
||||||
export const ProjectMonitorsRequestCodec = t.interface({ | ||||||
project: t.string, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's project from the synthetics agent side. I could ask @vigneshshanmugam to change it. I prefer using the |
||||||
keep_stale: t.boolean, | ||||||
monitors: t.array(ProjectBrowserMonitorCodec), | ||||||
}); | ||||||
|
||||||
export type ProjectMonitorThrottlingConfig = t.TypeOf<typeof ProjectMonitorThrottlingConfigCodec>; | ||||||
|
||||||
export type ProjectBrowserMonitor = t.TypeOf<typeof ProjectBrowserMonitorCodec>; | ||||||
|
||||||
export type ProjectMonitorsRequest = t.TypeOf<typeof ProjectMonitorsRequestCodec>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's JOURNEY_ID here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Journey ID is the the user-provided id for the journey.