Skip to content

Commit

Permalink
feat: add more instruments
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Mar 17, 2024
1 parent 1b6a173 commit 52a9c27
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 2 additions & 0 deletions server/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ pub struct PipelineStatus {
pub available_servers: u64,
}

#[tracing::instrument(skip(pool))]
pub async fn pipeline_status(pool: DbPool) -> anyhow::Result<Vec<PipelineStatus>> {
let mut conn = pool
.get()
Expand Down Expand Up @@ -313,6 +314,7 @@ pub async fn pipeline_status(pool: DbPool) -> anyhow::Result<Vec<PipelineStatus>
Ok(res)
}

#[tracing::instrument(skip(pool))]
pub async fn worker_status(pool: DbPool) -> anyhow::Result<Vec<Worker>> {
let mut conn = pool
.get()
Expand Down
5 changes: 3 additions & 2 deletions server/src/bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ use buildit_utils::github::{get_archs, OpenPRError, OpenPRRequest};
use chrono::Local;
use diesel::{Connection, ExpressionMethods, OptionalExtension, QueryDsl, RunQueryDsl};
use serde::Deserialize;
use tracing::warn;

use std::borrow::Cow;
use teloxide::{
prelude::*,
types::{ChatAction, ParseMode},
utils::command::BotCommands,
};
use tracing::{info_span, warn, Instrument};

Check warning on line 19 in server/src/bot.rs

View workflow job for this annotation

GitHub Actions / build

unused imports: `Instrument`, `info_span`

#[derive(BotCommands, Clone, Debug)]
#[command(
Expand Down Expand Up @@ -66,6 +65,7 @@ fn handle_archs_args(archs: Vec<&str>) -> Vec<&str> {
archs
}

#[tracing::instrument(skip(pool))]
async fn status(pool: DbPool) -> anyhow::Result<String> {
let mut res = String::from("__*Queue Status*__\n\n");

Expand Down Expand Up @@ -676,6 +676,7 @@ pub async fn answer(bot: Bot, msg: Message, cmd: Command, pool: DbPool) -> Respo
Ok(())
}

#[tracing::instrument(skip(bot, msg))]
async fn bot_send_message_handle_length(
bot: &Bot,
msg: &Message,
Expand Down
2 changes: 2 additions & 0 deletions server/src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub struct GithubToken {
pub token_type: String,
}

#[tracing::instrument(skip(msg, arguments))]
pub async fn login_github(
msg: &Message,
arguments: String,
Expand Down Expand Up @@ -67,6 +68,7 @@ pub fn get_packages_from_pr(pr: &PullRequest) -> Vec<String> {
}

/// Create octocrab instance authenticated as github installation
#[tracing::instrument]
pub async fn get_crab_github_installation() -> anyhow::Result<Option<Octocrab>> {
if let Some(id) = ARGS
.github_app_id
Expand Down
7 changes: 1 addition & 6 deletions server/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,4 @@ diesel::table! {
diesel::joinable!(jobs -> pipelines (pipeline_id));
diesel::joinable!(pipelines -> users (creator_user_id));

diesel::allow_tables_to_appear_in_same_query!(
jobs,
pipelines,
users,
workers,
);
diesel::allow_tables_to_appear_in_same_query!(jobs, pipelines, users, workers,);

0 comments on commit 52a9c27

Please sign in to comment.