@@ -6,7 +6,7 @@ use reqwest::header::{HeaderMap, HeaderValue, USER_AGENT};
66use serde:: Deserialize ;
77use sqlx:: PgPool ;
88use tokio:: sync:: Mutex ;
9- use tracing:: { info, warn } ;
9+ use tracing:: info;
1010
1111use crate :: {
1212 auth:: check_is_moderator_from_headers,
@@ -72,7 +72,7 @@ struct DelphiReport {
7272 pub url : String ,
7373 pub project_id : crate :: models:: ids:: ProjectId ,
7474 #[ serde( rename = "version_id" ) ]
75- pub _version_id : crate :: models:: ids:: VersionId ,
75+ pub version_id : crate :: models:: ids:: VersionId ,
7676 pub file_id : crate :: models:: ids:: FileId ,
7777 /// A sequential, monotonically increasing version number for the
7878 /// Delphi version that generated this report.
@@ -128,23 +128,23 @@ pub struct DelphiRunParameters {
128128}
129129
130130#[ post( "ingest" , guard = "admin_key_guard" ) ]
131+ #[ tracing:: instrument(
132+ level = "info" ,
133+ skip_all,
134+ fields(
135+ %report. url,
136+ %report. file_id,
137+ %report. project_id,
138+ %report. version_id,
139+ )
140+ ) ]
131141async fn ingest_report (
132142 pool : web:: Data < PgPool > ,
133143 redis : web:: Data < RedisPool > ,
134- report : web:: Bytes ,
135- // web::Json(report): web::Json<DelphiReport>,
144+ web:: Json ( report) : web:: Json < DelphiReport > ,
136145) -> Result < ( ) , ApiError > {
137- info ! (
138- "Json: {}" ,
139- serde_json:: to_string_pretty(
140- & serde_json:: from_slice:: <serde_json:: Value >( & report) . unwrap( )
141- )
142- . unwrap( )
143- ) ;
144- let report = serde_json:: from_slice :: < DelphiReport > ( & report) . unwrap ( ) ;
145-
146146 if report. issues . is_empty ( ) {
147- info ! ( "No issues found for file {}" , report . url ) ;
147+ info ! ( "No issues found for file" ) ;
148148 return Ok ( ( ) ) ;
149149 }
150150
@@ -163,10 +163,9 @@ async fn ingest_report(
163163 . upsert ( & mut transaction)
164164 . await ?;
165165
166- warn ! (
167- "Delphi found {} issues in file {}" ,
168- report. issues. len( ) ,
169- report. url
166+ info ! (
167+ num_issues = %report. issues. len( ) ,
168+ "Delphi found issues in file" ,
170169 ) ;
171170
172171 for ( issue_type, issue_details) in report. issues {
0 commit comments