Compare commits

...

2 Commits

Author SHA1 Message Date
Mark Sinclair 8bd6a1006b Data Observatory: add more logging for coingecko API failures 2026-02-20 14:38:59 +00:00
Mark Sinclair 1678fb6b94 Data Observatory: add env var PG_CERT and bump version 2026-02-19 17:08:06 +00:00
4 changed files with 22 additions and 7 deletions
Generated
+1 -1
View File
@@ -6209,7 +6209,7 @@ dependencies = [
[[package]]
name = "nym-data-observatory"
version = "1.0.1"
version = "1.0.3"
dependencies = [
"anyhow",
"async-trait",
+1 -1
View File
@@ -3,7 +3,7 @@
[package]
name = "nym-data-observatory"
version = "1.0.1"
version = "1.0.3"
authors.workspace = true
repository.workspace = true
homepage.workspace = true
+10 -1
View File
@@ -1,5 +1,6 @@
use anyhow::{Result, anyhow};
use sqlx::{Postgres, migrate::Migrator, postgres::PgConnectOptions};
use std::env;
use std::str::FromStr;
use tracing::info;
@@ -19,7 +20,15 @@ pub(crate) struct Storage {
impl Storage {
pub async fn init(connection_url: String) -> Result<Self> {
let connect_options = PgConnectOptions::from_str(&connection_url)?;
let mut connect_options = PgConnectOptions::from_str(&connection_url)?;
let ssl_cert_path = env::var("PG_CERT").ok();
if let Some(ssl_cert) = ssl_cert_path {
connect_options = connect_options
.ssl_mode(sqlx::postgres::PgSslMode::Require)
.ssl_root_cert(ssl_cert);
}
let pool = DbPool::connect_with(connect_options)
.await
+10 -4
View File
@@ -29,10 +29,16 @@ impl PriceScraper {
async fn get_coingecko_prices(&self) -> anyhow::Result<CoingeckoPriceResponse> {
tracing::info!("💰 Fetching CoinGecko prices from {COINGECKO_API_URL}");
let response = reqwest::get(COINGECKO_API_URL)
.await?
.json::<CoingeckoPriceResponse>()
.await;
let response = reqwest::get(COINGECKO_API_URL).await?;
if !response.status().is_success() {
tracing::error!(
"CoinGecko price query returned error: {}",
response.status()
);
}
let response = response.json::<CoingeckoPriceResponse>().await;
tracing::info!("Got response {:?}", response);
match response {