feat(server): include repo in missing handler logs

Closes kemitix/git-next#78
This commit is contained in:
Paul Campbell 2024-05-09 20:39:04 +01:00
parent e8062788a0
commit b7aa417831
3 changed files with 6 additions and 7 deletions

View file

@ -62,7 +62,7 @@ impl RepoActor {
}
impl Actor for RepoActor {
type Context = Context<Self>;
#[tracing::instrument(name = "RepoActor::stopping", skip_all)]
#[tracing::instrument(name = "RepoActor::stopping", skip_all, fields(repo = %self.details))]
fn stopping(&mut self, ctx: &mut Self::Context) -> Running {
info!("Checking webhook");
match self.webhook_id.take() {
@ -95,7 +95,7 @@ impl std::fmt::Display for RepoActor {
pub struct CloneRepo;
impl Handler<CloneRepo> for RepoActor {
type Result = ();
#[tracing::instrument(name = "RepoActor::CloneRepo", skip_all, fields(repo = %self, gitdir = %self.details.gitdir))]
#[tracing::instrument(name = "RepoActor::CloneRepo", skip_all, fields(repo = %self.details, gitdir = %self.details.gitdir))]
fn handle(&mut self, _msg: CloneRepo, ctx: &mut Self::Context) -> Self::Result {
info!("Message Received");
let gitdir = self.details.gitdir.clone();
@ -119,7 +119,7 @@ impl Handler<CloneRepo> for RepoActor {
pub struct LoadConfigFromRepo;
impl Handler<LoadConfigFromRepo> for RepoActor {
type Result = ();
#[tracing::instrument(name = "RepoActor::LoadConfigFromRepo", skip_all, fields(repo = %self))]
#[tracing::instrument(name = "RepoActor::LoadConfigFromRepo", skip_all, fields(repo = %self.details))]
fn handle(&mut self, _msg: LoadConfigFromRepo, ctx: &mut Self::Context) -> Self::Result {
info!("Message Received");
let details = self.details.clone();
@ -255,7 +255,7 @@ impl Handler<StartMonitoring> for RepoActor {
pub struct WebhookRegistered(pub WebhookId, pub WebhookAuth);
impl Handler<WebhookRegistered> for RepoActor {
type Result = ();
#[tracing::instrument(name = "RepoActor::WebhookRegistered", skip_all, fields(webhook_id = %msg.0))]
#[tracing::instrument(name = "RepoActor::WebhookRegistered", skip_all, fields(repo = %self.details, webhook_id = %msg.0))]
fn handle(&mut self, msg: WebhookRegistered, _ctx: &mut Self::Context) -> Self::Result {
info!("Message Received");
self.webhook_id.replace(msg.0);
@ -268,7 +268,7 @@ impl Handler<WebhookRegistered> for RepoActor {
pub struct AdvanceMainTo(pub gitforge::Commit);
impl Handler<AdvanceMainTo> for RepoActor {
type Result = ();
#[tracing::instrument(name = "RepoActor::AdvanceMainTo", skip_all, fields(commit = %msg.0))]
#[tracing::instrument(name = "RepoActor::AdvanceMainTo", skip_all, fields(repo = %self.details, commit = %msg.0))]
fn handle(&mut self, msg: AdvanceMainTo, ctx: &mut Self::Context) -> Self::Result {
info!("Message Received");
let Some(repo_config) = self.details.repo_config.clone() else {

View file

@ -212,7 +212,6 @@ impl Server {
let (forge_name, repo_alias, actor) = actor;
let span = tracing::info_span!("start_actor", forge = %forge_name, repo = %repo_alias);
let _guard = span.enter();
info!("Starting");
let addr = actor.start();
addr.do_send(CloneRepo);
info!("Started");

View file

@ -30,7 +30,7 @@ impl Handler<WebhookMessage> for WebhookRouter {
let repo_alias = RepoAlias(msg.path().clone());
debug!(repo = %repo_alias, "Router...");
if let Some(recipient) = self.repos.get(&repo_alias) {
info!("Sending to Recipient");
info!(repo = %repo_alias, "Sending to Recipient");
recipient.do_send(msg);
}
}