-
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
Initial work on uptime for observability homepage API #70135
Changes from 4 commits
deab3de
9aa5b81
0c514bf
8fd2418
dd18ab9
628f71c
ad6d359
38b89a5
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { fetchPingHistogram, fetchSnapshotCount } from '../state/api'; | ||
import { UptimeFetchDataResponse } from '../../../observability/public/typings/fetch_data_response'; | ||
|
||
export async function fetchUptimeOverviewData({ startTime, endTime, bucketSize }) { | ||
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. I noticed you're not using the 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. @cauemarcondes i have updated to use the bucketSize |
||
const snapshot = await fetchSnapshotCount({ | ||
cauemarcondes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
dateRangeStart: startTime, | ||
dateRangeEnd: endTime, | ||
}); | ||
const pings = await fetchPingHistogram({ dateStart: startTime, dateEnd: endTime }); | ||
const response: UptimeFetchDataResponse = { | ||
title: 'Uptime', | ||
appLink: '/app/uptime#/', // Todo is there some sort of helper that handles subpaths? | ||
shahzad31 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
stats: { | ||
monitors: { | ||
type: 'number', | ||
label: 'Monitors', | ||
value: snapshot.total, | ||
}, | ||
up: { | ||
type: 'number', | ||
label: 'Up', | ||
value: snapshot.up, | ||
}, | ||
down: { | ||
type: 'number', | ||
label: 'Down', | ||
value: snapshot.down, | ||
}, | ||
}, | ||
series: { | ||
up: { | ||
label: 'Up', | ||
coordinates: pings.histogram.map((p) => { | ||
return { x: p.x!, y: p.upCount || 0 }; | ||
}), | ||
}, | ||
down: { | ||
label: 'Down', | ||
coordinates: pings.histogram.map((p) => { | ||
return { x: p.x!, y: p.downCount || 0 }; | ||
}), | ||
}, | ||
}, | ||
}; | ||
return response; | ||
} |
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.
Hi @andrewvc I checked out your branch and I didn't see any problem. Can you tell me why you mentioned that it doesn't work?