add structured logging to evaluation filter

This commit is contained in:
Daiderd Jordan 2020-05-21 20:52:01 +02:00
parent bd8bed6ad3
commit 8424c32478
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -3,7 +3,7 @@ use crate::ghevent;
use crate::message::{evaluationjob, Pr, Repo}; use crate::message::{evaluationjob, Pr, Repo};
use crate::worker; use crate::worker;
use tracing::info; use tracing::{debug_span, info};
pub struct EvaluationFilterWorker { pub struct EvaluationFilterWorker {
acl: acl::ACL, acl: acl::ACL,
@ -30,6 +30,9 @@ impl worker::SimpleWorker for EvaluationFilterWorker {
} }
fn consumer(&mut self, job: &ghevent::PullRequestEvent) -> worker::Actions { fn consumer(&mut self, job: &ghevent::PullRequestEvent) -> worker::Actions {
let span = debug_span!("job", pr = ?job.number);
let _enter = span.enter();
if !self.acl.is_repo_eligible(&job.repository.full_name) { if !self.acl.is_repo_eligible(&job.repository.full_name) {
info!("Repo not authorized ({})", job.repository.full_name); info!("Repo not authorized ({})", job.repository.full_name);
return vec![worker::Action::Ack]; return vec![worker::Action::Ack];