Skip to content

Commit

Permalink
add isOfficial column and fix fields in influx
Browse files Browse the repository at this point in the history
  • Loading branch information
zefanjajobse committed Aug 30, 2023
1 parent e9b5d9d commit 2e2a603
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/connectors/influx_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,11 @@ pub fn build_server_data_point(
let mut data_point = DataPoint::builder(frontend_game_name);

data_point = match !server_info.guid.is_empty() {
true => data_point.tag("guid", &server_info.guid),
true => data_point.field("guid", server_info.guid.clone()),
false => data_point,
};
data_point = match !server_info.game_id.is_empty() {
true => data_point.tag("gameId", &server_info.game_id),
true => data_point.field("gameId", server_info.game_id.clone()),
false => data_point,
};
data_point = match server_info.is_official {
Expand All @@ -339,8 +339,8 @@ pub fn build_server_data_point(
data_point
.tag("platform", platform)
.tag("region", region)
.tag("serverName", &server_info.name)
.tag("type", data_type)
.field("serverName", server_info.name.clone())
.field(field, *amount)
.build()
}
Expand Down
11 changes: 7 additions & 4 deletions src/connectors/quest_db.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use questdb::ingress::{Buffer, SenderBuilder};
use crate::structs::{results, server_info};
use questdb::ingress::{Buffer, SenderBuilder};
use std::collections::HashMap;

// let mut sender = SenderBuilder::new("167.86.108.125", 9009).connect()?;
Expand Down Expand Up @@ -38,6 +38,10 @@ pub fn push_server(
true => buffer.column_str("map", server_info.map)?,
false => buffer,
};
buffer = match server_info.is_official {
Some(result) => buffer.column_bool("isOfficial", result)?,
None => buffer,
};

buffer
.column_i64("soldierAmount", server_info.soldiers)?
Expand All @@ -49,7 +53,6 @@ pub fn push_server(
Ok(())
}


// pub fn push_totals(global_result: &results::RegionResult) -> anyhow::Result<()> {
// let mut quest_sender = SenderBuilder::new("167.86.108.125", 9009).connect()?;
// let buffer = &mut Buffer::new();
Expand Down Expand Up @@ -210,6 +213,6 @@ pub fn push_server(
// }
// }
// }

// Ok(())
// }
// }

0 comments on commit 2e2a603

Please sign in to comment.