Skip to content

Commit

Permalink
Log config version in SCS Server
Browse files Browse the repository at this point in the history
Summary:
Other diffs in T161723796 added logging to Mononoke and LFS Server; this diff does the same to SCS Server.

We have no middleware here, so we just straight up log in the Thrift service handler.

Reviewed By: clara-9

Differential Revision: D55123060

fbshipit-source-id: b0ffc3277b6d569cdad35b210bca4b1eac824dcb
  • Loading branch information
andreacampi authored and facebook-github-bot committed Mar 20, 2024
1 parent 8803124 commit 9edc52d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions eden/mononoke/scs_server/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ rust_binary(
"//eden/mononoke/megarepo_api:megarepo_error",
"//eden/mononoke/metaconfig:metaconfig_types",
"//eden/mononoke/mononoke_api:mononoke_api",
"//eden/mononoke/mononoke_configs:mononoke_configs",
"//eden/mononoke/mononoke_types:mononoke_types",
"//eden/mononoke/permission_checker:permission_checker",
"//eden/mononoke/phases:phases",
Expand Down
1 change: 1 addition & 0 deletions eden/mononoke/scs_server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ fn main(fb: FacebookInit) -> Result<(), Error> {
scuba_builder,
args.scribe_logging_args.get_scribe(fb)?,
security_checker,
app.configs(),
&app.repo_configs().common,
);
let service = {
Expand Down
9 changes: 9 additions & 0 deletions eden/mononoke/scs_server/src/source_control_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use mononoke_api::RepoContext;
use mononoke_api::SessionContainer;
use mononoke_api::TreeContext;
use mononoke_api::TreeId;
use mononoke_configs::MononokeConfigs;
use mononoke_types::hash::Sha1;
use mononoke_types::hash::Sha256;
use once_cell::sync::Lazy;
Expand Down Expand Up @@ -102,6 +103,7 @@ pub(crate) struct SourceControlServiceImpl {
pub(crate) scuba_builder: MononokeScubaSampleBuilder,
pub(crate) identity: Identity,
pub(crate) scribe: Scribe,
pub(crate) configs: Arc<MononokeConfigs>,
identity_proxy_checker: Arc<ConnectionSecurityChecker>,
}

Expand All @@ -116,6 +118,7 @@ impl SourceControlServiceImpl {
mut scuba_builder: MononokeScubaSampleBuilder,
scribe: Scribe,
identity_proxy_checker: ConnectionSecurityChecker,
configs: Arc<MononokeConfigs>,
common_config: &CommonConfig,
) -> Self {
scuba_builder.add_common_server_data();
Expand All @@ -131,6 +134,7 @@ impl SourceControlServiceImpl {
common_config.internal_identity.id_data.as_str(),
),
scribe,
configs,
identity_proxy_checker: Arc::new(identity_proxy_checker),
}
}
Expand Down Expand Up @@ -182,6 +186,11 @@ impl SourceControlServiceImpl {
}
}

if let Some(config_info) = self.configs.as_ref().config_info().as_ref() {
scuba.add("config_store_version", config_info.content_hash.clone());
scuba.add("config_store_last_updated_at", config_info.last_updated_at);
}

let sampling_rate = core::num::NonZeroU64::new(if POPULAR_METHODS.contains(name) {
const FALLBACK_SAMPLING_RATE: u64 = 1000;
justknobs::get_as::<u64>("scm/mononoke:scs_popular_methods_sampling_rate", None)
Expand Down

0 comments on commit 9edc52d

Please sign in to comment.