Skip to content

Commit 55b5b14

Browse files
[Synthetics] remove full screenshots (#189911)
## Summary We have not used full screenshot image data since early alpha versions of Synthetics (pre 7.14.0), and there is no reason to _not_ use screenshot blocks instead as they make far more efficient storage performance. ### Release note Removes support for Heartbeat browser monitor screenshots for lower versions of Heartbeat. Please upgrade to Heartbeat 7.17.24 to continue using Heartbeat browser monitor screenshots. ### Testing Screenshots are just for browser monitors, and browser monitors are in Beta in 7.17.x and will never be moved to GA. I don't believe this ticket needs additional testing beyond passing integration tests.
1 parent c119b87 commit 55b5b14

File tree

2 files changed

+2
-77
lines changed

2 files changed

+2
-77
lines changed

x-pack/plugins/uptime/server/rest_api/pings/journey_screenshots.test.ts

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -86,73 +86,6 @@ describe('journey screenshot route', () => {
8686
expect(response.body.screenshotRef).toEqual(mock);
8787
});
8888

89-
it('returns full screenshot blob', async () => {
90-
const mock = {
91-
synthetics: {
92-
blob: 'a blob',
93-
blob_mime: 'image/jpeg',
94-
step: {
95-
name: 'a step name',
96-
},
97-
type: 'step/screenshot',
98-
},
99-
totalSteps: 3,
100-
};
101-
const route = createJourneyScreenshotRoute({
102-
// @ts-expect-error incomplete implementation for testing
103-
requests: {
104-
getJourneyScreenshot: jest.fn().mockReturnValue(mock),
105-
},
106-
});
107-
108-
// @ts-expect-error incomplete implementation for testing
109-
expect(await route.handler(libs)).toMatchInlineSnapshot(`
110-
Object {
111-
"body": Object {
112-
"data": Array [
113-
105,
114-
185,
115-
104,
116-
],
117-
"type": "Buffer",
118-
},
119-
"headers": Object {
120-
"cache-control": "max-age=600",
121-
"caption-name": "a step name",
122-
"content-type": "image/jpeg",
123-
"max-steps": "3",
124-
},
125-
"message": "Ok",
126-
"status": 200,
127-
}
128-
`);
129-
});
130-
131-
it('defaults to png when mime is undefined', async () => {
132-
const mock = {
133-
synthetics: {
134-
blob: 'a blob',
135-
step: {
136-
name: 'a step name',
137-
},
138-
type: 'step/screenshot',
139-
},
140-
};
141-
const route = createJourneyScreenshotRoute({
142-
// @ts-expect-error incomplete implementation for testing
143-
requests: {
144-
getJourneyScreenshot: jest.fn().mockReturnValue(mock),
145-
},
146-
});
147-
148-
// @ts-expect-error incomplete implementation for testing
149-
const response = await route.handler(libs);
150-
151-
expect(response.status).toBe(200);
152-
// @ts-expect-error incomplete implementation for testing
153-
expect(response.headers['content-type']).toBe('image/png');
154-
});
155-
15689
it('returns 404 for screenshot missing blob', async () => {
15790
const route = createJourneyScreenshotRoute({
15891
// @ts-expect-error incomplete implementation for testing

x-pack/plugins/uptime/server/rest_api/pings/journey_screenshots.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import { schema } from '@kbn/config-schema';
9-
import { isRefResult, isFullScreenshot } from '../../../common/runtime_types/ping/synthetics';
9+
import { isRefResult } from '../../../common/runtime_types/ping/synthetics';
1010
import { UMServerLibs } from '../../lib/lib';
1111
import { ScreenshotReturnTypesUnion } from '../../lib/requests/get_journey_screenshot';
1212
import { UMRestApiRouteFactory } from '../types';
@@ -37,15 +37,7 @@ export const createJourneyScreenshotRoute: UMRestApiRouteFactory = (libs: UMServ
3737
stepIndex,
3838
});
3939

40-
if (isFullScreenshot(result) && typeof result.synthetics?.blob !== 'undefined') {
41-
return response.ok({
42-
body: Buffer.from(result.synthetics.blob, 'base64'),
43-
headers: {
44-
'content-type': result.synthetics.blob_mime || 'image/png', // falls back to 'image/png' for earlier versions of synthetics
45-
...getSharedHeaders(result.synthetics.step.name, result.totalSteps),
46-
},
47-
});
48-
} else if (isRefResult(result)) {
40+
if (isRefResult(result)) {
4941
return response.ok({
5042
body: {
5143
screenshotRef: result,

0 commit comments

Comments
 (0)