partially revert attempt, timestamps don't match

This commit is contained in:
4cuck committed 2024-02-19 17:31:08 +01:00
1 parent 67ab478581
commit cea88d7e10
3 files changed
+32 -166

No files matched your search

+2 -6
View File
@@ -44,15 +44,11 @@ pub async fn graph(
let queried = std::time::Instant::now();
let mut data = String::with_capacity(8*healthy_data.len());
data.push_str("Date,Healthy,Dead,Tokens AVG,Requests AVG,Limited Tokens AVG\n");
data.push_str("Date,Healthy,Dead\n");
for entry in healthy_data {
let time = Utc.timestamp_opt(entry.time,0).unwrap().format("%Y-%m-%dT%H:%M:%SZ");
if let (Some(total_accs_avg),Some(total_requests_avg),Some(limited_accs_avg)) = (entry.total_accs_avg,entry.total_requests_avg,entry.limited_accs_avg){
writeln!(&mut data, "{time},{},{},{},{},{}",entry.alive,entry.dead,total_accs_avg,total_requests_avg,limited_accs_avg)
} else {
writeln!(&mut data, "{time},{},{},,,",entry.alive,entry.dead)
}
writeln!(&mut data, "{},{},{}",time,entry.alive,entry.dead)
.map_err(|e|ServerError::CSV(e.to_string()))?;
}
let formatted = std::time::Instant::now();
+3 -32
View File
@@ -16,36 +16,7 @@ async function loadGraph() {
rangeSelectorPlotFillGradientColor: 'rgba(123, 104, 238, 0)',
colorValue: 0.9,
fillAlpha: 0.4,
colors: ['#008000', '#ffa500','#008500','#058000'],
series: {
'Date': {
axis: 'y'
},
'Healthy': {
axis: 'y'
},
'Tokens AVG': {
axis: 'y2'
},
'Limited Tokens AVG': {
axis: 'y2'
},
'Requests AVG': {
axis: 'y2'
},
},
axes: {
y: {
axisLabelWidth: 60
},
y2: {
// set axis-related properties here
// drawGrid: false,
// drawAxis: false,
},
},
ylabel: 'Instances',
y2label: 'Tokens',
colors: ['#008000', '#ffa500'],
/*rollPeriod: 14,
showRoller: true,
customBars: true,
@@ -61,13 +32,13 @@ async function loadGraph() {
g.setAnnotations([
{
series: "Healthy",
x: "2023-05-18T00:00:01Z",
x: "2023-05-18",
shortText: "G",
text: "First API Change"
},
{
series: "Healthy",
x: "2024-01-24T00:00:01Z",
x: "2024-01-24",
shortText: "D",
text: "API Shutdown"
}